def openSensel(): handle = None (error, device_list) = sensel.getDeviceList() print "num devices", device_list.num_devices if device_list.num_devices != 0: (error, handle) = sensel.openDeviceByID(device_list.devices[0].idx) return handle
def open_sensel(): handle = None error, device_list = sensel.getDeviceList() if device_list.num_devices != 0: error, handle = sensel.openDeviceByID(device_list.devices[0].idx) error, info = sensel.getSensorInfo(handle) print(info) return handle, info
def openSensel(): """ Finds the sensel device, if none is detected, return None. This None should throw an error in subsequent functions. """ handle = None (error, device_list) = sensel.getDeviceList() if device_list.num_devices != 0: (error, handle) = sensel.openDeviceByID(device_list.devices[0].idx) return handle
def open(self, index=0): handle = None (error_num, device_list) = sensel.getDeviceList() if error_num != 0: raise SenselError(error_num) if device_list.num_devices > index: device = device_list.devices[index] self.serial_num = bytearray(device.serial_num).decode() self.com_port = bytearray(device.com_port).decode() logging.debug( 'Opening sensel device {} (idx: {}, serial_num: {}, com_port: {}' .format(index, device.idx, self.serial_num, self.com_port)) (error_num, handle) = sensel.openDeviceByID(device.idx) if error_num != 0: raise SenselError(error_num) return handle
# The above copyright notice and this permission notice shall be included in all copies or # substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, # INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR # PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE # FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR # OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. ########################################################################## import sensel import binascii if __name__ == "__main__": handle = None (error, device_list) = sensel.getDeviceList() if device_list.num_devices != 0: (error, handle) = sensel.openDeviceByID(device_list.devices[0].idx) if handle != None: (error, info) = sensel.getSensorInfo(handle) print "\nSensel Device: " + str( bytearray(device_list.devices[0].serial_num)) print "Width: " + str(info.width) + "mm" print "Height: " + str(info.height) + "mm" print "Cols: " + str(info.num_cols) print "Rows: " + str(info.num_rows) error = sensel.close(handle)
def open_sensel(): handle = None error, device_list = sensel.getDeviceList() if device_list.num_devices != 0: error, handle = sensel.openDeviceByID(device_list.devices[0].idx) return handle
def _openSensel(self): handle = None (error, device_list) = sensel.getDeviceList() if device_list.num_devices != 0: (error, handle) = sensel.openDeviceByID(device_list.devices[0].idx) self.handle = handle