phidget.cpp
Go to the documentation of this file.
00001 
00060 #include <cob_phidgets/phidget.h>
00061 #include <iostream>
00062 #include <algorithm>
00063 #include <string>
00064 #include <cstring>
00065 
00066 Phidget::Phidget(CPhidgetHandle* handle, SensingMode mode)
00067         : _phiHandle(handle), _serialNumber(-1), _last_error(-1), _sensMode(mode)
00068 {
00069 }
00070 
00071 Phidget::~Phidget() 
00072 {
00073         CPhidget_close(*_phiHandle);
00074         CPhidget_delete(*_phiHandle);
00075 }
00076 
00077 auto Phidget::open(int serial_number) -> int
00078 {
00079         return CPhidget_open(*_phiHandle, serial_number);
00080 }
00081 
00082 auto Phidget::close(int serial_number) -> int 
00083 {
00084         return CPhidget_close(*_phiHandle);
00085 }
00086 
00087 auto Phidget::waitForAttachment(int timeout) -> int
00088 {
00089         return CPhidget_waitForAttachment(*_phiHandle, timeout);
00090 }
00091 
00092 auto Phidget::getDeviceType() -> std::string
00093 {
00094         char a[256];
00095         const char * deviceptr = a;
00096         CPhidget_getDeviceType(*_phiHandle, &deviceptr);
00097         return std::string(deviceptr);
00098 }
00099 
00100 auto Phidget::getDeviceName() -> std::string
00101 {
00102         char a[256];
00103         const char * deviceptr = a;
00104         CPhidget_getDeviceName(*_phiHandle, &deviceptr);
00105         return std::string(deviceptr);
00106 }
00107 
00108 auto Phidget::getDeviceLabel() -> std::string
00109 {
00110         char a[256];
00111         const char * deviceptr = a;
00112         CPhidget_getDeviceType(*_phiHandle, &deviceptr);
00113         return std::string(deviceptr);
00114 }
00115 
00116 auto Phidget::getLibraryVersion() -> std::string
00117 {
00118         char a[256];
00119         const char * deviceptr = a;
00120         CPhidget_getLibraryVersion(&deviceptr);
00121         return std::string(deviceptr);
00122 }
00123 
00124 auto Phidget::getDeviceSerialNumber() -> int
00125 {
00126         int sernum;
00127         CPhidget_getSerialNumber(*_phiHandle, &sernum);
00128         _serialNumber = sernum;
00129         return sernum;
00130 }
00131 
00132 auto Phidget::getDeviceVersion() -> int
00133 {
00134         int version;
00135         CPhidget_getDeviceVersion(*_phiHandle, &version);
00136         return version;
00137 }
00138 
00139 auto Phidget::getErrorDescription(int errorCode) -> std::string
00140 {
00141         char a[256];
00142         const char * errorPtr = a;
00143         CPhidget_getErrorDescription(errorCode, &errorPtr);
00144         return std::string(errorPtr);
00145 }
00146 
00147 auto Phidget::attachHandler() -> int
00148 {
00149         printf("attachHandler()");
00150         return 0;
00151 }
00152 
00153 auto Phidget::detachHandler() -> int
00154 {
00155         printf("detachHandler()");
00156         return 0;
00157 }
00158 
00159 auto Phidget::update() -> void
00160 {
00161         printf("Phidget::update()");
00162 }


cob_phidgets
Author(s): Florian Weisshardt, Benjamin Maidel
autogenerated on Sun Oct 5 2014 23:10:20