コード例 #1
0
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
コード例 #2
0
def open_all_morphs():
    (error_num, device_list) = sensel.getDeviceList()
    if error_num != 0:
        raise SenselError(error_num)
    result = [
        Morph(i, tag='-{}'.format(i)) for i in range(device_list.num_devices)
    ]
    return result
コード例 #3
0
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
コード例 #4
0
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
コード例 #5
0
 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
コード例 #6
0
# 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)
コード例 #7
0
ファイル: main.py プロジェクト: ctsexton/multitouch
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
コード例 #8
0
ファイル: board.py プロジェクト: zsyzgu/TouchType
 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