def test_arduino_startup_in(self):
     d = {'lcd_mode': 0, 'lcd_max': 2, 'arduino_ready': False}
     o = {'lcd_mode': 0, 'lcd_mode_change': False, 'arduino_ready': True}
     info('TESTING Handle command for ARDUINO_STARTUP')
     to = handle_command(0, 0, ARDUINO_STARTUP, d)
     info('TESTING OUTPUT:', to)
     self.assertEquals(to, o)
     print('---------------------------------------------')
 def test_mode_down_in(self):
     d = {'lcd_mode': 0, 'lcd_max': 2, 'arduino_ready': True}
     o = {'lcd_mode': 2, 'lcd_mode_change': True, 'arduino_ready': True}
     info('TESTING Handle command for MODE_DOWN')
     to = handle_command(0, 0, MODE_DOWN_IN, d)
     info('TESTING OUTPUT:', to)
     self.assertEquals(to, o)
     print('---------------------------------------------')
 def test_analog_in(self):
     d = {'lcd_mode': 0, 'lcd_max': 1, 'arduino_ready': False}
     o = {'lcd_mode': 0, 'lcd_mode_change': False, 'arduino_ready': False}
     info(
         'TESTING Handle command for ANALOG_IN:5;32;4;45;42 , or 1:5;32;4;45;42'
     )
     to = handle_command(0, 0, ANALOG_IN + ':5', d)
     info('TESTING OUTPUT:', to)
     self.assertEquals(to, o)
     print('---------------------------------------------')
 def test_digital_in(self):
     d = {'lcd_mode': 0, 'lcd_max': 1, 'arduino_ready': True}
     o = {'lcd_mode': 0, 'lcd_mode_change': False, 'arduino_ready': True}
     info(
         'TESTING',
         'Handle command for DIGITAL_IN:5, or 0:5, the 5 decoded digital should start with 101...'
     )
     to = handle_command(0, 0, DIGITAL_IN + ':5', d)
     info('TESTING OUTPUT:', to)
     self.assertEquals(to, o)
     print('---------------------------------------------')
예제 #5
0
def handle_message(message):

    uid = message.from_user.id

    if uid in ADMIN_LIST:
        response = commandHandler.handle_command(message.text)
        response_type = str(type(response))
    else:
        response = f'Insufficient Permissions (Your id: {uid})'
        response_type = 'str'

    if 'str' in response_type:
        bot.send_message(message.chat.id, response)
    elif 'Image' in response_type:
        bot.send_photo(message.chat.id, response)
예제 #6
0
def handle_command(command):
    vessel = conn.space_center.active_vessel
    data_in = {'lcd_mode': lcd_mode, 'lcd_max': lcd_max}
    out = commandHandler.handle_command(conn, vessel, command, data_in)
    lcd_mode = out['lcd_mode']
    lcd_mode_change = out['lcd_mode_change']