Hi.
I applied https://github.com/crfosse/Thingy-52-to-nRF52xx project for get thingy motion data by nRF52840.
#define THINGY_UUID_BASE {0x42, 0x00, 0x74, 0xA9, 0xFF, 0x52, 0x10, 0x9B, 0x33, 0x49, 0x35, 0x9B, 0x00, 0x01, 0x68, 0xEF} #define THINGY_UIS_UUID_SERVICE 0x0300 #define THINGY_UIS_UUID_BUTTON_CHAR 0x0302 #define THINGY_UIS_UUID_LED_CHAR 0x0301 #define THINGY_TES_UUID_SERVICE 0x0400 #define THINGY_TES_UUID_CONFIG_CHAR 0x0401 /**< The UUID of the config Characteristic. */ #define THINGY_TES_UUID_TAP_CHAR 0x0402 /**< The UUID of the tap Characteristic. */ #define THINGY_TES_UUID_ORIENTATION_CHAR 0x0403 /**< The UUID of the orientation Characteristic. */ #define THINGY_TES_UUID_QUATERNION_CHAR 0x0404 /**< The UUID of the quaternion Characteristic. */ #define THINGY_TES_UUID_PEDOMETER_CHAR 0x0405 /**< The UUID of the pedometer Characteristic. */ #define THINGY_TES_UUID_RAW_CHAR 0x0406 /**< The UUID of the raw data Characteristic. */ #define THINGY_TES_UUID_EULER_CHAR 0x0407 /**< The UUID of the euler Characteristic. */ #define THINGY_TES_UUID_ROT_MAT_CHAR 0x0408 /**< The UUID of the rotation matrix Characteristic. */ #define THINGY_TES_UUID_HEADING_CHAR 0x0409 /**< The UUID of the compass heading Characteristic. */ #define THINGY_TES_UUID_GRAVITY_CHAR 0x040A /**< The UUID of the gravity vector Characteristic. */
static void thingy_tes_init(void) { ret_code_t err_code; ble_thingy_tes_c_init_t thingy_tes_c_init_obj; thingy_tes_c_init_obj.evt_handler = thingy_tes_c_evt_handler; for (uint32_t i = 0; i < NRF_SDH_BLE_CENTRAL_LINK_COUNT; i++) { err_code = ble_thingy_tes_c_init(&m_thingy_tes_c[i], &thingy_tes_c_init_obj); APP_ERROR_CHECK(err_code); } }
uint32_t ble_thingy_tes_c_init(ble_thingy_tes_c_t * p_ble_thingy_tes_c, ble_thingy_tes_c_init_t * p_ble_thingy_tes_c_init) { uint32_t err_code; ble_uuid_t thingy_tes_uuid; ble_uuid128_t thingy_tes_base_uuid = {THINGY_UUID_BASE}; VERIFY_PARAM_NOT_NULL(p_ble_thingy_tes_c); VERIFY_PARAM_NOT_NULL(p_ble_thingy_tes_c_init); VERIFY_PARAM_NOT_NULL(p_ble_thingy_tes_c_init->evt_handler); p_ble_thingy_tes_c->peer_thingy_tes_db.euler_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.euler_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.heading_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.heading_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.orient_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.orient_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.pedometer_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.pedometer_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.quat_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.quat_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.raw_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.raw_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.rot_cccd_hanlde = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.rot_hanlde = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.tap_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.tap_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.gravity_cccd_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->peer_thingy_tes_db.gravity_handle = BLE_GATT_HANDLE_INVALID; p_ble_thingy_tes_c->conn_handle = BLE_CONN_HANDLE_INVALID; p_ble_thingy_tes_c->evt_handler = p_ble_thingy_tes_c_init->evt_handler; err_code = sd_ble_uuid_vs_add(&thingy_tes_base_uuid, &p_ble_thingy_tes_c->uuid_type); if (err_code != NRF_SUCCESS) { return err_code; } VERIFY_SUCCESS(err_code); thingy_tes_uuid.type = p_ble_thingy_tes_c->uuid_type; thingy_tes_uuid.uuid = THINGY_TES_UUID_SERVICE; return ble_db_discovery_evt_register(&thingy_tes_uuid); }
void ble_thingy_tes_on_db_disc_evt(ble_thingy_tes_c_t * p_ble_thingy_tes_c, ble_db_discovery_evt_t const * p_evt) { // Check if the Led Button Service was discovered. if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE && p_evt->params.discovered_db.srv_uuid.uuid == THINGY_TES_UUID_SERVICE && p_evt->params.discovered_db.srv_uuid.type == p_ble_thingy_tes_c->uuid_type) { ble_thingy_tes_c_evt_t evt; evt.evt_type = BLE_THINGY_TES_C_EVT_DISCOVERY_COMPLETE; evt.conn_handle = p_evt->conn_handle; //NRF_LOG_INFO("tes discover count : %d", p_evt->params.discovered_db.char_count); for (uint32_t i = 0; i < p_evt->params.discovered_db.char_count; i++) { const ble_gatt_db_char_t * p_char = &(p_evt->params.discovered_db.charateristics[i]); NRF_LOG_INFO("<i=%d> UUID : %x", i, p_char->characteristic.uuid.uuid); switch (p_char->characteristic.uuid.uuid) { case THINGY_TES_UUID_TAP_CHAR: evt.params.peer_db.tap_cccd_handle = p_char->cccd_handle; evt.params.peer_db.tap_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("402 evt TAP handle = %d", p_char->characteristic.handle_value); break; case THINGY_TES_UUID_ORIENTATION_CHAR: evt.params.peer_db.orient_cccd_handle = p_char->cccd_handle; evt.params.peer_db.orient_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("403 evt Orientation handle = %d", evt.params.peer_db.orient_handle); break; case THINGY_TES_UUID_QUATERNION_CHAR: evt.params.peer_db.quat_cccd_handle = p_char->cccd_handle; evt.params.peer_db.quat_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("404 evt Quaternion handle = %d", evt.params.peer_db.quat_handle); case THINGY_TES_UUID_PEDOMETER_CHAR: evt.params.peer_db.pedometer_cccd_handle = p_char->cccd_handle; evt.params.peer_db.pedometer_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("405 evt step counter handle = %d", evt.params.peer_db.pedometer_handle); case THINGY_TES_UUID_RAW_CHAR: evt.params.peer_db.raw_cccd_handle = p_char->cccd_handle; evt.params.peer_db.raw_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("406 evt raw data handle = %d", evt.params.peer_db.raw_handle); break; case THINGY_TES_UUID_EULER_CHAR: evt.params.peer_db.euler_cccd_handle = p_char->cccd_handle; evt.params.peer_db.euler_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("407 evt euler handle = %d", evt.params.peer_db.euler_handle); break; /*case THINGY_tes_UUID_ROT_MAT_CHAR: evt.params.peer_db.rot_cccd_hanlde = p_char->cccd_handle; evt.params.peer_db.rot_hanlde = p_char->characteristic.handle_value; NRF_LOG_INFO("408 evt rotation matrix handle = %d", evt.params.peer_db.rot_hanlde); case THINGY_tes_UUID_HEADING_CHAR: evt.params.peer_db.heading_cccd_handle = p_char->cccd_handle; evt.params.peer_db.heading_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("409 evt heading handle = %d", evt.params.peer_db.heading_handle); case THINGY_tes_UUID_GRAVITY_CHAR: evt.params.peer_db.gravity_cccd_handle = p_char->cccd_handle; evt.params.peer_db.gravity_handle = p_char->characteristic.handle_value; NRF_LOG_INFO("410 evt gravity handle = %d", evt.params.peer_db.gravity_handle);*/ default: break; } } //If the instance has been assigned prior to db_discovery, assign the db_handles if (p_ble_thingy_tes_c->conn_handle != BLE_CONN_HANDLE_INVALID) { if ((p_ble_thingy_tes_c->peer_thingy_tes_db.euler_cccd_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.euler_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.pedometer_cccd_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.pedometer_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.quat_cccd_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.quat_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.raw_cccd_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.raw_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.tap_cccd_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.tap_handle = BLE_GATT_HANDLE_INVALID)) /*(p_ble_thingy_tes_c->peer_thingy_tes_db.heading_cccd_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.heading_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.orient_cccd_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.orient_handle = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.rot_cccd_hanlde = BLE_GATT_HANDLE_INVALID)&& (p_ble_thingy_tes_c->peer_thingy_tes_db.rot_hanlde = BLE_GATT_HANDLE_INVALID)&&*/ { p_ble_thingy_tes_c->peer_thingy_tes_db = evt.params.peer_db; } } p_ble_thingy_tes_c->evt_handler(p_ble_thingy_tes_c, &evt); } /*else if(p_evt->evt_type != BLE_DB_DISCOVERY_COMPLETE) { ble_thingy_tes_c_evt_t evt; evt.evt_type = 0; p_ble_thingy_tes_c->evt_handler(p_ble_thingy_tes_c, &evt); }*/ }
But It still found 6 Service for motion service, didn't take handle values.
What can I have to do?
There are no compile errors.
Thank you for reading and your help.