sensel.h
IntroductionFunctions
senselAllocateFrameDataSENSEL_API SenselStatus WINAPI senselAllocateFrameData( SENSEL_HANDLE handle, SenselFrameData **data); ParametersReturn ValueSENSEL_OK on success or error DiscussionAllocates a FrameData and initializes all buffers according to device capabilities. senselCloseSENSEL_API SenselStatus WINAPI senselClose( SENSEL_HANDLE handle); ParametersReturn ValueSENSEL_OK on success or error DiscussionCloses the device associated with handle and frees all memory. senselFreeFrameDataSENSEL_API SenselStatus WINAPI senselFreeFrameData( SENSEL_HANDLE handle, SenselFrameData *data); ParametersReturn ValueSENSEL_OK on success or error DiscussionFrees all memory allocated to FrameData including the FrameData itself. senselGetBufferControlSENSEL_API SenselStatus WINAPI senselGetBufferControl( SENSEL_HANDLE handle, unsigned char *num); ParametersReturn ValueSENSEL_OK on success or error DiscussionGets the number of frame buffers the device should store internaly. senselGetContactsEnableBlobMergeSENSEL_API SenselStatus WINAPI senselGetContactsEnableBlobMerge( SENSEL_HANDLE handle, unsigned char *val); ParametersReturn ValueSENSEL_OK on success or error DiscussionGet contact blob merging setting senselGetContactsMaskSENSEL_API SenselStatus WINAPI senselGetContactsMask( SENSEL_HANDLE handle, unsigned char *mask); ParametersReturn ValueSENSEL_OK on success or error DiscussionGets the current contact mask setting for the device senselGetContactsMinForceSENSEL_API SenselStatus WINAPI senselGetContactsMinForce( SENSEL_HANDLE handle, unsigned short *val); ParametersReturn ValueSENSEL_OK on success or error DiscussionGets the minimum force a contact needs to have to be reported senselGetDeviceListSENSEL_API SenselStatus WINAPI senselGetDeviceList( SenselDeviceList *list); ParametersReturn ValueSENSEL_OK on success or error DiscussionScans for all availale sensel devices and populates list accordingly senselGetDynamicBaselineEnabled(SENSEL_HANDLE, unsigned char *)SENSEL_API SenselStatus WINAPI senselGetDynamicBaselineEnabled( SENSEL_HANDLE handle, unsigned char *val); ParametersReturn ValueSENSEL_OK on success or error DiscussionReturns state of dynamic baseline enabled flag senselGetFirmwareInfoSENSEL_API SenselStatus WINAPI senselGetFirmwareInfo( SENSEL_HANDLE handle, SenselFirmwareInfo *fw_info); ParametersReturn ValueSENSEL_OK on success or error DiscussionRetrieve firmware device information senselGetFrameSENSEL_API SenselStatus WINAPI senselGetFrame( SENSEL_HANDLE handle, SenselFrameData *data); ParametersReturn ValueSENSEL_OK on success or error DiscussionReturns one frame of data in data. senselGetFrameContentSENSEL_API SenselStatus WINAPI senselGetFrameContent( SENSEL_HANDLE handle, unsigned char *content); ParametersReturn ValueSENSEL_OK on success or error DiscussionGet the current frame content mask from the device senselGetLEDBrightnessSENSEL_API SenselStatus WINAPI senselGetLEDBrightness( SENSEL_HANDLE handle, unsigned char led_id, unsigned short *brightness); ParametersReturn ValueSENSEL_OK on success or error DiscussionRetrieve the current brightness of an LED senselGetMaxFrameRateSENSEL_API SenselStatus WINAPI senselGetMaxFrameRate( SENSEL_HANDLE handle, unsigned short *val); ParametersReturn ValueSENSEL_OK on success or error DiscussionGets the maximum framerate at which the device should report senselGetMaxLEDBrightnessSENSEL_API SenselStatus WINAPI senselGetMaxLEDBrightness( SENSEL_HANDLE handle, unsigned short *max_brightness); ParametersReturn ValueSENSEL_OK on success or error DiscussionRetrieve the maximum brightness value an LED can be set to senselGetNumAvailableFramesSENSEL_API SenselStatus WINAPI senselGetNumAvailableFrames( SENSEL_HANDLE handle, unsigned int *num_avail_frames); ParametersReturn ValueSENSEL_OK on success or error DiscussionReturns in num_avail_frames the number of data frames available. senselGetNumAvailableLEDsSENSEL_API SenselStatus WINAPI senselGetNumAvailableLEDs( SENSEL_HANDLE handle, unsigned char *num_leds); ParametersReturn ValueSENSEL_OK on success or error DiscussionRetrieve number of LEDs available on the device senselGetPowerButtonPressedSENSEL_API SenselStatus WINAPI senselGetPowerButtonPressed( SENSEL_HANDLE handle, unsigned char *pressed); ParametersReturn ValueSENSEL_OK on success or error DiscussionPressed will be 1 if button was pressed or 0 otherwize senselGetScanDetailSENSEL_API SenselStatus WINAPI senselGetScanDetail( SENSEL_HANDLE handle, SenselScanDetail *detail); ParametersReturn ValueSENSEL_OK on success or error DiscussionGet the current scanning level setting senselGetScanModeSENSEL_API SenselStatus WINAPI senselGetScanMode( SENSEL_HANDLE handle, SenselScanMode *mode); ParametersReturn ValueSENSEL_OK on success or error DiscussionGets the current scan mode. senselGetSensorInfoSENSEL_API SenselStatus WINAPI senselGetSensorInfo( SENSEL_HANDLE handle, SenselSensorInfo *info); ParametersReturn ValueSENSEL_OK on success or error DiscussionRetrieves the sensor information senselGetSupportedFrameContentSENSEL_API SenselStatus WINAPI senselGetSupportedFrameContent( SENSEL_HANDLE handle, unsigned char *content); ParametersReturn ValueSENSEL_OK on success or error DiscussionRetrieve the frame content that the device supports senselOpenSENSEL_API SenselStatus WINAPI senselOpen( SENSEL_HANDLE *handle); ParametersReturn ValueSENSEL_OK on success or error DiscussionOpens the first available Sensel sensor senselOpenDeviceByComPortSENSEL_API SenselStatus WINAPI senselOpenDeviceByComPort( SENSEL_HANDLE *handle, unsigned char *com_port); ParametersReturn ValueSENSEL_OK on success or error DiscussionOpens the devices associated to the given com_port as returned by senselGetDeviceList. senselGetDeviceList must be called prior to this call senselOpenDeviceByIDSENSEL_API SenselStatus WINAPI senselOpenDeviceByID( SENSEL_HANDLE *handle, unsigned char idx); ParametersReturn ValueSENSEL_OK on success or error DiscussionOpens the devices associated to the given idx as returned by senselGetDeviceList. senselGetDeviceList must be called prior to this call senselOpenDeviceBySerialNumSENSEL_API SenselStatus WINAPI senselOpenDeviceBySerialNum( SENSEL_HANDLE *handle, unsigned char *serial_num); ParametersReturn ValueSENSEL_OK on success or error DiscussionOpens the devices associated to the given serial_num as returned by senselGetDeviceList. senselGetDeviceList must be called prior to this call senselReadRegSENSEL_API SenselStatus WINAPI senselReadReg( SENSEL_HANDLE handle, unsigned char reg, unsigned char size, unsigned char *buf); ParametersReturn ValueSENSEL_OK on success or error DiscussionReads size bytes from register reg and stores the value in buf. senselReadRegVSSENSEL_API SenselStatus WINAPI senselReadRegVS( SENSEL_HANDLE handle, unsigned char reg, unsigned int buf_size, unsigned char *buf, unsigned int *read_size); ParametersReturn ValueSENSEL_OK on success or error DiscussionReads up to buf_size bytes from register reg and stores it in buf. On success, read_size will contain the number of bytes read from the register. senselReadSensorSENSEL_API SenselStatus WINAPI senselReadSensor( SENSEL_HANDLE handle); ParametersReturn ValueSENSEL_OK on success or error DiscussionReads out and stores all pending frames from the sensor senselSetBufferControlSENSEL_API SenselStatus WINAPI senselSetBufferControl( SENSEL_HANDLE handle, unsigned char num); ParametersReturn ValueSENSEL_OK on success or error DiscussionSets the number of frame buffers the device should store internaly. senselSetContactsEnableBlobMergeSENSEL_API SenselStatus WINAPI senselSetContactsEnableBlobMerge( SENSEL_HANDLE handle, unsigned char val); ParametersReturn ValueSENSEL_OK on success or error DiscussionSet contact blob merging setting senselSetContactsMaskSENSEL_API SenselStatus WINAPI senselSetContactsMask( SENSEL_HANDLE handle, unsigned char mask); ParametersReturn ValueSENSEL_OK on success or error DiscussionSets the contact information reported by the sensor mask can be any combination of CONTACT_MASK_* Contacts returned in subsequent GetFrame calls will reflect this setting. senselSetContactsMinForceSENSEL_API SenselStatus WINAPI senselSetContactsMinForce( SENSEL_HANDLE handle, unsigned short val); ParametersReturn ValueSENSEL_OK on success or error DiscussionSets the minimum force a contact needs to have to be reported senselSetDynamicBaselineEnabled(SENSEL_HANDLE, unsigned char)SENSEL_API SenselStatus WINAPI senselSetDynamicBaselineEnabled( SENSEL_HANDLE handle, unsigned char val); ParametersReturn ValueSENSEL_OK on success or error DiscussionEnables or disables dynamic baselining based on val. If dynamic baseline is disabled, the baseline does not evolve over time. senselSetFrameContentSENSEL_API SenselStatus WINAPI senselSetFrameContent( SENSEL_HANDLE handle, unsigned char content); ParametersReturn ValueSENSEL_OK on success or error DiscussionSets the information returned by the sensor. content can be any combination of FRAME_CONTENT_*_MASK. FrameData returned in subsequent GetFrame calls will reflect this setting. senselSetLEDBrightnessSENSEL_API SenselStatus WINAPI senselSetLEDBrightness( SENSEL_HANDLE handle, unsigned char led_id, unsigned short brightness); ParametersReturn ValueSENSEL_OK on success or error DiscussionUpdate the brightness of one LED senselSetMaxFrameRateSENSEL_API SenselStatus WINAPI senselSetMaxFrameRate( SENSEL_HANDLE handle, unsigned short val); ParametersReturn ValueSENSEL_OK on success or error DiscussionSets the maximum framerate at which the device should report senselSetScanDetailSENSEL_API SenselStatus WINAPI senselSetScanDetail( SENSEL_HANDLE handle, SenselScanDetail detail); ParametersReturn ValueSENSEL_OK on success or error DiscussionSet the level of scanning detail returned by the device. This setting trades precision for performance. senselSetScanModeSENSEL_API SenselStatus WINAPI senselSetScanMode( SENSEL_HANDLE handle, SenselScanMode mode); ParametersReturn ValueSENSEL_OK on success or error DiscussionSets the current scan mode. senselSoftResetSENSEL_API SenselStatus WINAPI senselSoftReset( SENSEL_HANDLE handle); ParametersReturn ValueSENSEL_OK on success or error DiscussionExecutes a soft reset the device referenced by handle. All registers are reset to their initial state senselStartScanningSENSEL_API SenselStatus WINAPI senselStartScanning( SENSEL_HANDLE handle); ParametersReturn ValueSENSEL_OK on success or error DiscussionStart sensor scanning senselStopScanningSENSEL_API SenselStatus WINAPI senselStopScanning( SENSEL_HANDLE handle); ParametersReturn ValueSENSEL_OK on success or error DiscussionStop sensor scanning senselWriteRegSENSEL_API SenselStatus WINAPI senselWriteReg( SENSEL_HANDLE handle, unsigned char reg, unsigned char size, unsigned char *buf); ParametersReturn ValueSENSEL_OK on success or error DiscussionWrites size bytes from buf into register reg senselWriteRegVSSENSEL_API SenselStatus WINAPI senselWriteRegVS( SENSEL_HANDLE handle, unsigned char reg, unsigned int size, unsigned char *buf, unsigned int *write_size); ParametersReturn ValueSENSEL_OK on success or error DiscussionWrite up to size bytes from buf to register reg. On success, write_size will contain the number of bytes written to the register. Typedefs
SENSEL_HANDLEtypedef void *SENSEL_HANDLE; DiscussionHandle to a Sensel device SenselAccelDatatypedef struct { int x; // X axis acceleration int y; // Y axis acceleration int z; // Z axis acceleration } SenselAccelData; DiscussionAccelerometer information SenselContacttypedef struct { unsigned char content_bit_mask; // Mask of what contact data is valid unsigned char id; // Contact id unsigned int state; // Contact state (enum SenselContactState) float x_pos; // X position in mm float y_pos; // Y position in mm float total_force; // Total contact force in grams float area; // Area in sensor elements // CONTACT_MASK_ELLIPSE float orientation; // Angle in degrees float major_axis; // Length of the major axis in mm float minor_axis; // Length of the minor axis in mm // CONTACT_MASK_DELTAS float delta_x; // X contact displacement in mm float delta_y; // Y contact displacement in mm float delta_force; // Force delta in grams float delta_area; // Area delta in sensor elements // CONTACT_MASK_BOUNDING_BOX float min_x; // Bounding box min X coordinate in mm float min_y; // Bounding box min Y coordinate in mm float max_x; // Bounding box max X coordinate in mm float max_y; // Bounding box max Y coordinate in mm // CONTACT_MASK_PEAK float peak_x; // X position of the peak in mm float peak_y; // Y position of the peak in mm float peak_force; // Peak force in grams } SenselContact; DiscussionStructure containing all information related to a detected contact The content_bit_mask reflects which data is valid SenselContactStatetypedef enum { CONTACT_INVALID = 0, // Contact is invalid CONTACT_START = 1, // Contact has started CONTACT_MOVE = 2, // Contact has moved CONTACT_END = 3, // Contact has ended } SenselContactState; DiscussionDescribes the current state of a contact SenselDeviceIDtypedef struct { unsigned char idx; // ID of the sensor unsigned char serial_num[64]; // Serial number of the sensor unsigned char com_port[64]; // Com port associated with the sensor } SenselDeviceID; DiscussionSensel identifier information SenselDeviceListtypedef struct { unsigned char num_devices; // Num of devices found SenselDeviceID devices[SENSEL_MAX_DEVICES]; // Sensel device ID details } SenselDeviceList; DiscussionList of connected Sensel devices SenselFirmwareInfotypedef struct { unsigned char fw_protocol_version; // Sensel communication protocol supported by the device unsigned char fw_version_major; // Major version of the firmware unsigned char fw_version_minor; // Minor version of the firmware unsigned short fw_version_build; // ?? unsigned char fw_version_release; // ?? unsigned short device_id; // Sensel device type unsigned char device_revision; // Device revision } SenselFirmwareInfo; DiscussionStructure containing firmware information SenselFrameDatatypedef struct { unsigned char content_bit_mask; // Data contents of the frame int lost_frame_count; // Number of frames dropped unsigned char n_contacts; // Number of contacts SenselContact *contacts; // Array of contacts float *force_array; // Force image buffer unsigned char *labels_array; // Labels buffer SenselAccelData *accel_data; // Accelerometer data } SenselFrameData; DiscussionContainer for one frame of data. Available content of the frame needs to be checked by looking at the content_bit_mask SenselScanDetailtypedef enum { SCAN_DETAIL_HIGH = 0, // Scan at full resolution SCAN_DETAIL_MEDIUM = 1, // Scan at half resolution SCAN_DETAIL_LOW = 2, // Scan at quarter resolution SCAN_DETAIL_UNKNOWN = 3, } SenselScanDetail; DiscussionDescribes the current state of a contact SenselScanModetypedef enum { SCAN_MODE_DISABLE, SCAN_MODE_SYNC, SCAN_MODE_ASYNC, } SenselScanMode; DiscussionDevice scan reporting mode SenselSensorInfotypedef struct { unsigned char max_contacts; // Maximum number of contacts the sensor supports unsigned short num_rows; // Total number of rows unsigned short num_cols; // Total number of columns float width; // Width of the sensor in millimeters float height; // Height of the sensor in millimeters } SenselSensorInfo; DiscussionStructure containing sensor information SenselStatustypedef enum { SENSEL_OK = 0, // Call was successful SENSEL_ERROR = -1, // Call returned an error } SenselStatus; DiscussionStatus returned by API calls |