Quelltext /~heha/hs/UNI-T/dmm.zip/src/th.cpp

#include "dmm.h"
#include <string.h>

EXTERN_C void _cdecl _fltused(){};

struct TH1942:INDATA{
 void _stdcall Handler();
};

void TH1942::Handler() {
 switch (msg) {
  case init:{
   rmax=32;
   counts=50000;
//   baud=9600;
  }break;

  case data:{
   if (rlen<9) {ok=true; return;}
   READOUT ro;
   if (rlen>sizeof(ro.digits)+7) return;
   ZeroMemory(&ro,sizeof(ro));
   memcpy(ro.digits,rbuf+8,rlen-9);
   ro.value=strtod(ro.digits,NULL);
   SetData(0,&ro,1);
   rlen=0;
   ok=true;
  }nobreak;

  case tout:
  case open:{
   SendBytes(":FETCH?\r",8);
  }break;
 }
}

EXTERN_C bool /*_declspec(dllexport)*/ WINAPI EnumAll(int n, ENUMINFO* ei) {
 if (n) return false;
 strcpy(ei->ManufName,"TongHui");
 strcpy(ei->ModelName,"TH1942");	// "Stalingrad"
 ei->IconIndex=2;
 ei->ExtraAlloc=0;
 ei->pHandler=(void(_stdcall INDATA::*)())&TH1942::Handler;
 ei->lParam=0;
 return true;
}
Vorgefundene Kodierung: UTF-80