27 CPhidget_getDeviceName(IFK, &name);
28 CPhidget_getSerialNumber(IFK, &serialNo);
37 sprintf_s(msg, 99,
"Encoder::AttachHandler %s (%s) reattached!", name, interfaceKit->
config->
friendlyName.c_str());
42 sprintf_s(msg, 99,
"Encoder::AttachHandler %s (%s) attached!", name, interfaceKit->
config->
friendlyName.c_str());
58 CPhidget_getDeviceName(IFK, &name);
59 CPhidget_getSerialNumber(IFK, &serialNo);
62 sprintf_s(msg, 99,
"Encoder::DetachHandler %s (%s) detached!", name, interfaceKit->
config->
friendlyName.c_str());
79 sprintf_s(msg, 99,
"Encoder::ErrorHandler Error handled. %s", unknown);
91 sprintf_s(msg, 99,
"Encoder::InputChangeHandler Received digital data for undefined index: %d (%d)", Index, State);
154 CPhidgetEncoder_getPosition(IFK, Index, &Position);
159 sprintf_s(msg, 199,
"Encoder::PositionChangeHandler Received encoder data for undefined index: %d time: %d rpos: %d pos: %d", Index, Time, RelativePosition, Position);
273 int serialNo, version, numInputs, numEncoders;
276 CPhidget_getDeviceType(reinterpret_cast<CPhidgetHandle>(phid), &ptr);
277 CPhidget_getSerialNumber(reinterpret_cast<CPhidgetHandle>(phid), &serialNo);
278 CPhidget_getDeviceVersion(reinterpret_cast<CPhidgetHandle>(phid), &version);
280 CPhidgetEncoder_getInputCount(phid, &numInputs);
281 CPhidgetEncoder_getEncoderCount(phid, &numEncoders);
284 sprintf_s(msg, 99,
"Encoder::display_properties Type: %s", ptr);
286 sprintf_s(msg, 99,
"Encoder::display_properties Serial Number: %i", serialNo);
288 sprintf_s(msg, 99,
"Encoder::display_properties Version: %i", version);
290 sprintf_s(msg, 99,
"Encoder::display_properties Digital Inputs: %d", numInputs);
292 sprintf_s(msg, 99,
"Encoder::display_properties Encoders: %d", numEncoders);
311 CPhidgetEncoder_create(&
ifKit);
314 CPhidget_set_OnAttach_Handler(reinterpret_cast<CPhidgetHandle>(
ifKit),
AttachHandler,
this);
315 CPhidget_set_OnDetach_Handler(reinterpret_cast<CPhidgetHandle>(
ifKit),
DetachHandler,
this);
316 CPhidget_set_OnError_Handler(reinterpret_cast<CPhidgetHandle>(
ifKit),
ErrorHandler,
this);
331 sprintf_s(msg, 99,
"Encoder::ctor Waiting for encoder %i to be attached...",
config->
serialno);
333 result = CPhidget_waitForAttachment(reinterpret_cast<CPhidgetHandle>(
ifKit), 5000);
336 CPhidget_getErrorDescription(result, &err);
337 sprintf_s(msg, 99,
"Encoder::ctor Problem waiting for attachment of %i: %s",
config->
serialno, err);
350 CPhidget_close(reinterpret_cast<CPhidgetHandle>(
ifKit));
351 CPhidget_delete(reinterpret_cast<CPhidgetHandle>(
ifKit));
void Initialize(Logger *logger, EncoderConfig *config, Bus *prmBus)
okay, the portable keyboard numbers don't work like the outside keypad because the outside keypad is ...
static int CCONV ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
CPhidgetEncoderHandle ifKit
static int CCONV PositionChangeHandler(CPhidgetEncoderHandle IFK, void *usrptr, int Index, int Time, int RelativePosition)
void Log(const char *msg, Level level=Info, int errorCode=0)
These have to be in this order.
static int CCONV DetachHandler(CPhidgetHandle IFK, void *userptr)
int display_properties(CPhidgetEncoderHandle phid) const
static int CCONV InputChangeHandler(CPhidgetEncoderHandle IFK, void *usrptr, int Index, int State)
static int CCONV AttachHandler(CPhidgetHandle IFK, void *userptr)