# Path: mod/mod_protocol.py
# CMD_ARGS = {
#     'ALL': {
#         'pi': [],
#         'say': [str,],
#         'l': [int,int,int,int,],
#         'displ_bright': [int],
#         'glcd_text': [int,int,int,str],
#         'glcd_dialog': [str],
#         'glcd_draw': [int,int,int,str],
#         'uc': [],
#         'ud': [],
#         'a': [int,str,int,str,float,float,float,int,int,],
#         'd': [int,],
#         'g': [int],
#         's': [int,float],
#         'ncp': [int,int,int],
#         'is': [int,int,int,int,int,str,str,],
#         'b': [int,int],
#         'bn': [str,],
#         'bd': [int],
#         'ba': [int,int,str,],
#         'br': [int,int,int],
#         'p': [int,int,int],
#         'pn': [str,],
#         'pb': [int,str],
#         'pr': [],
#         'ps': [],
#         'psa': [str,],
#         'pcl': [],
#         'pbd': [int,int],
#         'sr': [int,int],
#         'ssg': [int,int],
#         'sn': [int,str,],
#         'ssl': [int],
#         'sss': [],
#         'ssa': [str,],
#         'ssd': [int],
#         'ts': [float,str,int],
#         'tn': [],
#         'tf': [],
#         'ti': [int],
#         'restore': [],
#         'r': [int,],
#         'c': [int,int,],
#         'upr': [int],
#         'ups': [int],
#         'lp': [int],
#         'reset_eeprom': [],
#         'screenshot': [int,str],
#         'enc_clicked': [int],
#         'enc_left': [int],
#         'enc_right': [int],
#         'button_clicked': [int],
#         'pot_call_check': [int],
#         'pot_call_ok': [int],
#         'control_skip_enable': [],
#         'control_bad_skip': [],
#         'save_pot_cal': [int,int],
#         'sys_gio': [int,int,float],
#         'sys_ghp': [float],
#         'sys_ngc': [int],
#         'sys_ngt': [int],
#         'sys_ngd': [int],
#         'sys_cmm': [int],
#         'sys_cmr': [int],
#         'sys_pbg': [int],
#         'sys_ams': [],
#         'sys_bts': [],
#         'sys_btd': [],
#         'sys_ctl': [str],
#         'sys_ver': [str],
#         'sys_ser': [],
#         'sys_usb': [int],
#         'sys_mnr': [int],
#         'sys_rbt': [],
#         'sys_led': [int,int,],
#         'sys_nam': [int,str],
#         'sys_uni': [int,str],
#         'sys_val': [int,str],
#         'sys_ind': [int,float],
#         'sys_pch': [int],
#         'sys_spc': [int],
#     },
#     'DUO': {
#         'boot': [int,int,str,],
#         'fn': [int],
#         'bc': [int,int],
#         'n': [int],
#         'si': [int,int,int],
#         'ncp': [int,int], # TODO
#     },
#     'DUOX': {
#         'boot': [int,int,str,],
#         'ss': [int],
#         'sl': [int],
#         'sc': [],
#         'pa': [int,int,int,int,int,int],
#         's_contrast': [int,int],
#         'exp_overcurrent': [],
#     },
#     'DWARF': {
#         'cs': [int,int],
#         'pa': [int,int,int,int,int,int,int,int],
#     },
# }


from mod.mod_protocol import CMD_ARGS
            resp['value'] = float(resps[1])
        except IndexError:
            resp['ok'] = False

    elif datatype == 'string':
        # resp is a simple string, just pass it direcly
        pass

    else:
        try:
            resp = int(resp)
        except ValueError:
            resp = None

        if datatype == 'boolean' and resp is not None:
            resp = resp >= 0

    return resp

class Protocol(object):
    COMMANDS_ARGS = {}
    COMMANDS_FUNC = {}
    COMMANDS_USED = []

    RESPONSES = (
        "r", "resp", "few arguments", "many arguments", "not found",
    )

    @classmethod
    def register_cmd_callback(cls, model, cmd, func):

# Path: mod/mod_protocol.py
# CMD_ARGS = {
#     'ALL': {
#         'pi': [],
#         'say': [str,],
#         'l': [int,int,int,int,],
#         'displ_bright': [int],
#         'glcd_text': [int,int,int,str],
#         'glcd_dialog': [str],
#         'glcd_draw': [int,int,int,str],
#         'uc': [],
#         'ud': [],
#         'a': [int,str,int,str,float,float,float,int,int,],
#         'd': [int,],
#         'g': [int],
#         's': [int,float],
#         'ncp': [int,int,int],
#         'is': [int,int,int,int,int,str,str,],
#         'b': [int,int],
#         'bn': [str,],
#         'bd': [int],
#         'ba': [int,int,str,],
#         'br': [int,int,int],
#         'p': [int,int,int],
#         'pn': [str,],
#         'pb': [int,str],
#         'pr': [],
#         'ps': [],
#         'psa': [str,],
#         'pcl': [],
#         'pbd': [int,int],
#         'sr': [int,int],
#         'ssg': [int,int],
#         'sn': [int,str,],
#         'ssl': [int],
#         'sss': [],
#         'ssa': [str,],
#         'ssd': [int],
#         'ts': [float,str,int],
#         'tn': [],
#         'tf': [],
#         'ti': [int],
#         'restore': [],
#         'r': [int,],
#         'c': [int,int,],
#         'upr': [int],
#         'ups': [int],
#         'lp': [int],
#         'reset_eeprom': [],
#         'screenshot': [int,str],
#         'enc_clicked': [int],
#         'enc_left': [int],
#         'enc_right': [int],
#         'button_clicked': [int],
#         'pot_call_check': [int],
#         'pot_call_ok': [int],
#         'control_skip_enable': [],
#         'control_bad_skip': [],
#         'save_pot_cal': [int,int],
#         'sys_gio': [int,int,float],
#         'sys_ghp': [float],
#         'sys_ngc': [int],
#         'sys_ngt': [int],
#         'sys_ngd': [int],
#         'sys_cmm': [int],
#         'sys_cmr': [int],
#         'sys_pbg': [int],
#         'sys_ams': [],
#         'sys_bts': [],
#         'sys_btd': [],
#         'sys_ctl': [str],
#         'sys_ver': [str],
#         'sys_ser': [],
#         'sys_usb': [int],
#         'sys_mnr': [int],
#         'sys_rbt': [],
#         'sys_led': [int,int,],
#         'sys_nam': [int,str],
#         'sys_uni': [int,str],
#         'sys_val': [int,str],
#         'sys_ind': [int,float],
#         'sys_pch': [int],
#         'sys_spc': [int],
#     },
#     'DUO': {
#         'boot': [int,int,str,],
#         'fn': [int],
#         'bc': [int,int],
#         'n': [int],
#         'si': [int,int,int],
#         'ncp': [int,int], # TODO
#     },
#     'DUOX': {
#         'boot': [int,int,str,],
#         'ss': [int],
#         'sl': [int],
#         'sc': [],
#         'pa': [int,int,int,int,int,int],
#         's_contrast': [int,int],
#         'exp_overcurrent': [],
#     },
#     'DWARF': {
#         'cs': [int,int],
#         'pa': [int,int,int,int,int,int,int,int],
#     },
# }


# Path: mod/protocol.py
from mod.mod_protocol import CMD_ARGS

            resp['value'] = float(resps[1])
        except IndexError:
            resp['ok'] = False

    elif datatype == 'string':
        # resp is a simple string, just pass it direcly
        pass

    else:
        try:
            resp = int(resp)
        except ValueError:
            resp = None

        if datatype == 'boolean' and resp is not None:
            resp = resp >= 0

    return resp

class Protocol(object):
    COMMANDS_ARGS = {}
    COMMANDS_FUNC = {}
    COMMANDS_USED = []

    RESPONSES = (
        "r", "resp", "few arguments", "many arguments", "not found",
    )

    @classmethod
    def register_cmd_callback(cls, model, cmd, func):

        if model not in CMD_ARGS.keys():