示例#1
0
    def get_service_changed_cfg(self):
        config = driver.ble_cfg_t()
        cfg = config.gatts_cfg.service_changed
        cfg = driver.ble_gatts_cfg_service_changed_t()
        cfg.service_changed = self.service_changed_char

        return driver.BLE_GATTS_CFG_SERVICE_CHANGED, config
示例#2
0
 def get_gap_config(self):
     config = driver.ble_cfg_t()
     config.conn_cfg.conn_cfg_tag = self.conn_tag
     cfg = config.conn_cfg.params.gap_conn_cfg
     cfg.conn_count = self.conn_count
     cfg.event_length = self.event_length
     return driver.BLE_CONN_CFG_GAP, config
示例#3
0
    def get_role_count_cfg(self):
        config = driver.ble_cfg_t()
        cfg = config.gap_cfg.role_count_cfg
        cfg.periph_role_count = self.periph_role_count
        cfg.central_role_count = self.central_role_count
        cfg.central_sec_count = self.central_sec_count

        return driver.BLE_GAP_CFG_ROLE_COUNT, config
示例#4
0
    def get_device_name_cfg(self):
        config = driver.ble_cfg_t()
        cfg = config.gap_cfg.device_name_cfg
        cfg.current_len = 0
        cfg.max_len = driver.BLE_GAP_DEVNAME_DEFAULT_LEN
        cfg.write_perm.sm = 0
        cfg.write_perm.lv = 0
        cfg.vloc = driver.BLE_GATTS_VLOC_STACK

        return driver.BLE_GAP_CFG_DEVICE_NAME, config
示例#5
0
    def get_device_name_cfg(self):
        config = driver.ble_cfg_t()
        cfg = config.gap_cfg.device_name_cfg
        cfg.current_len = len(self.device_name)
        cfg.max_len = cfg.current_len
        cfg.p_value = util.list_to_uint8_array(self.device_name).cast()
        cfg.write_perm.sm = 0
        cfg.write_perm.lv = 0
        cfg.vloc = driver.BLE_GATTS_VLOC_USER

        return driver.BLE_GAP_CFG_DEVICE_NAME, config
示例#6
0
 def get_gatts_config(self):
     config = driver.ble_cfg_t()
     config.conn_cfg.conn_cfg_tag = self.conn_tag
     cfg = config.conn_cfg.params.gatts_conn_cfg
     cfg.hvn_tx_queue_size = self.hvn_tx_queue_size
     return driver.BLE_CONN_CFG_GATTS, config
示例#7
0
 def get_gatt_config(self):
     config = driver.ble_cfg_t()
     config.conn_cfg.conn_cfg_tag = self.conn_tag
     cfg = config.conn_cfg.params.gatt_conn_cfg
     cfg.att_mtu = self.max_att_mtu
     return driver.BLE_CONN_CFG_GATT, config
示例#8
0
    def get_attr_tab_size_cfg(self):
        config = driver.ble_cfg_t()
        cfg = config.gatts_cfg.attr_tab_size
        cfg.attr_tab_size = self.attr_table_size

        return driver.BLE_GATTS_CFG_ATTR_TAB_SIZE, config
示例#9
0
    def get_vs_uuid_cfg(self):
        config = driver.ble_cfg_t()
        cfg = config.common_cfg.vs_uuid_cfg
        cfg.vs_uuid_count = self.vs_uuid_count

        return driver.BLE_COMMON_CFG_VS_UUID, config