Beispiel #1
0
def _handle_command_status(pkt):
    result = {}
    status, ncmd, opcode = struct.unpack("<BBH", pkt)
    (ogf, ocf) = utils.ogf_and_ocf_from_opcode(opcode)
    result["status"] = status
    result["number_of_commands"] = ncmd
    result["opcode"] = opcode
    result["opcode_group_field"] = ogf
    result["opcode_command_field"] = ocf
    return result
Beispiel #2
0
def _handle_command_status(pkt):
    result = {}
    status, ncmd, opcode = struct.unpack("<BBH", pkt)
    (ogf, ocf) = utils.ogf_and_ocf_from_opcode(opcode)
    result["status"] = status
    result["number_of_commands"] = ncmd
    result["opcode"] = opcode
    result["opcode_group_field"] = ogf
    result["opcode_command_field"] = ocf
    return result
Beispiel #3
0
def _handle_command_complete(pkt):
    result = {}
    ncmd, opcode = struct.unpack("<BH", pkt[:3])
    (ogf, ocf) = utils.ogf_and_ocf_from_opcode(opcode)
    result["number_of_commands"] = ncmd
    result["opcode"] = opcode
    result["opcode_group_field"] = ogf
    result["opcode_command_field"] = ocf
    result["command_return_values"] = ""
    if len(pkt) > 3:
        result["command_return_values"] = pkt[3:]
    # Since we only care about BLE commands, we ignore the command return values
    # here. A full-powered bluetooth parsing module would check the OCF above
    # and parse the return values based on that OCF. We return the return values
    # to the user should the used want to parse the return values.
    return result
Beispiel #4
0
def _handle_command_complete(pkt):
    result = {}
    ncmd, opcode = struct.unpack("<BH", pkt[:3])
    (ogf, ocf) = utils.ogf_and_ocf_from_opcode(opcode)
    result["number_of_commands"] = ncmd
    result["opcode"] = opcode
    result["opcode_group_field"] = ogf
    result["opcode_command_field"] = ocf
    result["command_return_values"] = ""
    if len(pkt) > 3:
        result["command_return_values"] = pkt[3:]
    # Since we only care about BLE commands, we ignore the command return values
    # here. A full-powered bluetooth parsing module would check the OCF above
    # and parse the return values based on that OCF. We return the return values
    # to the user should the used want to parse the return values.
    return result