Use The Human Interface Device (Hid) Module - Digi Connect IT 16 User Manual

Hide thumbs Also See for Connect IT 16:
Table of Contents

Advertisement

Applications
prior to execution.
"""
import os
import threading
import sys
from digidevice.sms import Callback, send
COND = threading.Condition()
def sms_test_callback(sms, condtion):
print(f"SMS message from {sms['from']} received")
print(sms)
condition.acquire()
condition.notify()
condition.release()
def send_sms(destination, msg):
print("sending SMS message", msg)
if len(destination) > 10:
destination = "1" + destination
send(destination, msg)
if __name__ == '__main__':
if len(sys.argv) > 1:
dest = sys.argv[1]
else:
dest = '15005550006'
my_callback = Callback(sms_test_callback, COND)
send_sms("+" + dest, 'Hello World!')
print("Please send an SMS message now.")
print("Execution halted until a message is received or 60 seconds have
passed.")
# acquire the semaphore and wait until a callback occurs
COND.acquire()
try:
COND.wait(60.0)
except Exception as err:
print("exception occured while waiting")
print(err)
COND.release()
my_callback.unregister_callback()

Use the Human Interface Device (HID) module

The Python hid module provides a programmatic access to a USB Human Interface Device (HID) from
within a Python script.
For example, to determine information about a USB-connected keyboard:
1. Log into the Connect IT 16/48 command line as a user with shell access.
Depending on your device configuration, you may be presented with an Access selection
menu. Type shell to access the device shell.
2. At the shell prompt, use the python command with no parameters to enter an interactive
Python session:
# python
Python 3.6.12 (default, Jan 11 2021, 10:25:21)
Digi Connect IT® 16/48 User Guide
Use the Human Interface Device (HID) module
476

Advertisement

Table of Contents
loading

This manual is also suitable for:

Connect it 48

Table of Contents