nrf5/modules/ubluepy: Adding ad_types constants in new object. Linking in ad_types object into the ubluepy.constants local dict.

This commit is contained in:
Glenn Ruben Bakke 2017-04-01 22:37:39 +02:00
parent 0887b95bb9
commit bb196a2b09

View File

@ -31,11 +31,57 @@
#include "modubluepy.h"
STATIC const mp_map_elem_t ubluepy_constants_ad_types_locals_dict_table[] = {
// GAP AD Types
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_FLAGS), MP_OBJ_NEW_SMALL_INT(0x01) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_16BIT_SERVICE_UUID_MORE_AVAILABLE), MP_OBJ_NEW_SMALL_INT(0x02) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_16BIT_SERVICE_UUID_COMPLETE), MP_OBJ_NEW_SMALL_INT(0x03) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_32BIT_SERVICE_UUID_MORE_AVAILABLE), MP_OBJ_NEW_SMALL_INT(0x04) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_32BIT_SERVICE_UUID_COMPLETE), MP_OBJ_NEW_SMALL_INT(0x05) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_128BIT_SERVICE_UUID_MORE_AVAILABLE), MP_OBJ_NEW_SMALL_INT(0x06) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_128BIT_SERVICE_UUID_COMPLETE), MP_OBJ_NEW_SMALL_INT(0x07) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SHORT_LOCAL_NAME), MP_OBJ_NEW_SMALL_INT(0x08) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_COMPLETE_LOCAL_NAME), MP_OBJ_NEW_SMALL_INT(0x09) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_TX_POWER_LEVEL), MP_OBJ_NEW_SMALL_INT(0x0A) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_CLASS_OF_DEVICE), MP_OBJ_NEW_SMALL_INT(0x0D) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SIMPLE_PAIRING_HASH_C), MP_OBJ_NEW_SMALL_INT(0x0E) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R), MP_OBJ_NEW_SMALL_INT(0x0F) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SECURITY_MANAGER_TK_VALUE), MP_OBJ_NEW_SMALL_INT(0x10) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SECURITY_MANAGER_OOB_FLAGS), MP_OBJ_NEW_SMALL_INT(0x11) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SLAVE_CONNECTION_INTERVAL_RANGE), MP_OBJ_NEW_SMALL_INT(0x12) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SOLICITED_SERVICE_UUIDS_16BIT), MP_OBJ_NEW_SMALL_INT(0x14) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SOLICITED_SERVICE_UUIDS_128BIT), MP_OBJ_NEW_SMALL_INT(0x15) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SERVICE_DATA), MP_OBJ_NEW_SMALL_INT(0x16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_PUBLIC_TARGET_ADDRESS), MP_OBJ_NEW_SMALL_INT(0x17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_RANDOM_TARGET_ADDRESS), MP_OBJ_NEW_SMALL_INT(0x18) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_APPEARANCE), MP_OBJ_NEW_SMALL_INT(0x19) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_ADVERTISING_INTERVAL), MP_OBJ_NEW_SMALL_INT(0x1A) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_LE_BLUETOOTH_DEVICE_ADDRESS), MP_OBJ_NEW_SMALL_INT(0x1B) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_LE_ROLE), MP_OBJ_NEW_SMALL_INT(0x1C) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SIMPLE_PAIRING_HASH_C256), MP_OBJ_NEW_SMALL_INT(0x1D) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SIMPLE_PAIRING_RANDOMIZER_R256), MP_OBJ_NEW_SMALL_INT(0x1E) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SERVICE_DATA_32BIT_UUID), MP_OBJ_NEW_SMALL_INT(0x20) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_SERVICE_DATA_128BIT_UUID), MP_OBJ_NEW_SMALL_INT(0x21) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_URI), MP_OBJ_NEW_SMALL_INT(0x24) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_3D_INFORMATION_DATA), MP_OBJ_NEW_SMALL_INT(0x3D) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_AD_TYPE_MANUFACTURER_SPECIFIC_DATA), MP_OBJ_NEW_SMALL_INT(0xFF) },
};
STATIC MP_DEFINE_CONST_DICT(ubluepy_constants_ad_types_locals_dict, ubluepy_constants_ad_types_locals_dict_table);
const mp_obj_type_t ubluepy_constants_ad_types_type = {
{ &mp_type_type },
.name = MP_QSTR_ad_types,
.locals_dict = (mp_obj_t)&ubluepy_constants_ad_types_locals_dict
};
STATIC const mp_map_elem_t ubluepy_constants_locals_dict_table[] = {
// GAP events
{ MP_OBJ_NEW_QSTR(MP_QSTR_EVT_GAP_CONNECTED), MP_OBJ_NEW_SMALL_INT(16) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_EVT_GAP_DISCONNECTED), MP_OBJ_NEW_SMALL_INT(17) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_UUID_CCCD), MP_OBJ_NEW_SMALL_INT(0x2902) },
{ MP_OBJ_NEW_QSTR(MP_QSTR_ad_types), (mp_obj_t)(&ubluepy_constants_ad_types_type) },
};
STATIC MP_DEFINE_CONST_DICT(ubluepy_constants_locals_dict, ubluepy_constants_locals_dict_table);