12 CPhidget_getDeviceName(IFK, &name);
13 CPhidget_getSerialNumber(IFK, &serialNo);
19 sprintf_s(msg, 99,
"Analog::AttachHandler %s (%i) attached!", name, serialNo);
31 CPhidget_getDeviceName(IFK, &name);
32 CPhidget_getSerialNumber(IFK, &serialNo);
35 sprintf_s(msg, 99,
"Analog::DetachHandler %s (%i) detached!", name, serialNo);
45 sprintf_s(msg, 99,
"Analog::ErrorHandler Error handled. %s", unknown);
55 int serialNo, version, numAnalog;
59 CPhidget_getDeviceType(reinterpret_cast<CPhidgetHandle>(phid), &ptr);
60 CPhidget_getSerialNumber(reinterpret_cast<CPhidgetHandle>(phid), &serialNo);
61 CPhidget_getDeviceVersion(reinterpret_cast<CPhidgetHandle>(phid), &version);
62 CPhidgetAnalog_getOutputCount(phid, &numAnalog);
63 CPhidgetAnalog_getVoltageMax(phid, 0, &max);
64 CPhidgetAnalog_getVoltageMin(phid, 0, &min);
67 sprintf_s(msg, 99,
"Analog::display_properties Type: %s", ptr);
69 sprintf_s(msg, 99,
"Analog::display_properties Serial Number: %i", serialNo);
71 sprintf_s(msg, 99,
"Analog::display_properties Version: %i", version);
73 sprintf_s(msg, 99,
"Analog::display_properties Analog Outputs: %d", numAnalog);
75 sprintf_s(msg, 99,
"Analog::display_properties Maximum Output: +%0.1lfV", max);
77 sprintf_s(msg, 99,
"Analog::display_properties Minimum Output: %0.1lfV", min);
96 CPhidgetAnalog_create(&
ifKit);
99 CPhidget_set_OnAttach_Handler(reinterpret_cast<CPhidgetHandle>(
ifKit),
AttachHandler,
this);
100 CPhidget_set_OnDetach_Handler(reinterpret_cast<CPhidgetHandle>(
ifKit),
DetachHandler,
this);
101 CPhidget_set_OnError_Handler(reinterpret_cast<CPhidgetHandle>(
ifKit),
ErrorHandler,
this);
107 logger->
Log(
"Analog::ctor Waiting for analog to be attached....");
108 result = CPhidget_waitForAttachment(reinterpret_cast<CPhidgetHandle>(
ifKit), 5000);
111 CPhidget_getErrorDescription(result, &err);
113 sprintf_s(msg, 99,
"Analog::ctor Problem waiting for attachment of %i: %s",
config->
serialno, err);
124 CPhidgetAnalog_getEnabled(
ifKit, i, &enabled);
131 CPhidgetAnalog_setVoltage(
ifKit, i, 0.0);
133 CPhidgetAnalog_setEnabled(
ifKit, i, PTRUE);
138 CPhidgetAnalog_setEnabled(
ifKit, i, PFALSE);
149 CPhidget_close(reinterpret_cast<CPhidgetHandle>(
ifKit));
150 CPhidget_delete(reinterpret_cast<CPhidgetHandle>(
ifKit));
178 sprintf_s(msg, 99,
"Analog::FrameMove Undefined analog channel (index %i) triggered: %s (%i)", i,
config->
channels[i].trigger.c_str(),
config->
serialno);
186 CPhidgetAnalog_setVoltage(
ifKit, i, busValue);
double PlatformFrontRightBellow
static int CCONV DetachHandler(CPhidgetHandle IFK, void *userptr)
double PlatformFrontLeftBellow
std::vector< Channel > channels
okay, the portable keyboard numbers don't work like the outside keypad because the outside keypad is ...
void Initialize(Logger *logger, AnalogConfig *config, Bus *prmBus)
int display_properties(CPhidgetAnalogHandle phid) const
static int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
static int CCONV AttachHandler(CPhidgetHandle IFK, void *userptr)
double PlatformBackLeftBellow
void Log(const char *msg, Level level=Info, int errorCode=0)
These have to be in this order.
double PlatformBackRightBellow
CPhidgetAnalogHandle ifKit