|
|
|
@ -626,7 +626,7 @@ uint8_t P2P_Client_APP_Get_State( void ) { |
|
|
|
*/ |
|
|
|
tBleStatus Write_Char(uint16_t UUID, uint8_t Service_Instance, uint8_t *pPayload) |
|
|
|
{ |
|
|
|
|
|
|
|
log_debug("Write_Char", "enter", 0); |
|
|
|
tBleStatus ret = BLE_STATUS_INVALID_PARAMS; |
|
|
|
uint8_t index; |
|
|
|
|
|
|
|
@ -638,6 +638,7 @@ tBleStatus Write_Char(uint16_t UUID, uint8_t Service_Instance, uint8_t *pPayload |
|
|
|
switch(UUID) |
|
|
|
{ |
|
|
|
case P2P_WRITE_CHAR_UUID: /* SERVER RX -- so CLIENT TX */ |
|
|
|
log_debug("Write_Char", "payload 0x%x%x", 2, pPayload[0], pPayload[1]); |
|
|
|
ret =aci_gatt_write_without_resp(aP2PClientContext[index].connHandle, |
|
|
|
aP2PClientContext[index].P2PWriteToServerCharHdle, |
|
|
|
2, /* charValueLen */ |
|
|
|
@ -686,37 +687,38 @@ void Update_Service() |
|
|
|
{ |
|
|
|
|
|
|
|
case APP_BLE_DISCOVER_SERVICES: |
|
|
|
log_debug("Update_Service", "P2P_DISCOVER_SERVICES", 0); |
|
|
|
log_info("Update_Service", "P2P_DISCOVER_SERVICES", 0); |
|
|
|
break; |
|
|
|
case APP_BLE_DISCOVER_CHARACS: |
|
|
|
log_debug("Update_Service", "* GATT : Discover P2P Characteristics", 0); |
|
|
|
log_info("Update_Service", "* GATT : Discover P2P Characteristics", 0); |
|
|
|
aci_gatt_disc_all_char_of_service(aP2PClientContext[index].connHandle, |
|
|
|
aP2PClientContext[index].P2PServiceHandle, |
|
|
|
aP2PClientContext[index].P2PServiceEndHandle); |
|
|
|
|
|
|
|
break; |
|
|
|
case APP_BLE_DISCOVER_WRITE_DESC: /* Not Used - No decriptor */ |
|
|
|
log_debug("Update_Service", "* GATT : Discover Descriptor of TX - Write Characteritic", 0); |
|
|
|
log_info("Update_Service", "* GATT : Discover Descriptor of TX - Write Characteritic", 0); |
|
|
|
aci_gatt_disc_all_char_desc(aP2PClientContext[index].connHandle, |
|
|
|
aP2PClientContext[index].P2PWriteToServerCharHdle, |
|
|
|
aP2PClientContext[index].P2PWriteToServerCharHdle+2); |
|
|
|
|
|
|
|
break; |
|
|
|
case APP_BLE_DISCOVER_NOTIFICATION_CHAR_DESC: |
|
|
|
log_debug("Update_Service", "* GATT : Discover Descriptor of Rx - Notification Characteritic", 0); |
|
|
|
log_info("Update_Service", "* GATT : Discover Descriptor of Rx - Notification Characteritic", 0); |
|
|
|
aci_gatt_disc_all_char_desc(aP2PClientContext[index].connHandle, |
|
|
|
aP2PClientContext[index].P2PNotificationCharHdle, |
|
|
|
aP2PClientContext[index].P2PNotificationCharHdle+2); |
|
|
|
|
|
|
|
break; |
|
|
|
case APP_BLE_ENABLE_NOTIFICATION_DESC: |
|
|
|
log_debug("Update_Service", "* GATT : Enable Server Notification", 0); |
|
|
|
log_info("Update_Service", "* GATT : Enable Server Notification", 0); |
|
|
|
aci_gatt_write_char_desc(aP2PClientContext[index].connHandle, |
|
|
|
aP2PClientContext[index].P2PNotificationDescHandle, |
|
|
|
2, |
|
|
|
(uint8_t *)&enable); |
|
|
|
|
|
|
|
aP2PClientContext[index].state = APP_BLE_CONNECTED_CLIENT; |
|
|
|
log_info("Update_Service", "state: APP_BLE_CONNECTED_CLIENT", 0); |
|
|
|
// BSP_LED_Off(LED_RED);
|
|
|
|
|
|
|
|
break; |
|
|
|
@ -728,6 +730,7 @@ void Update_Service() |
|
|
|
(uint8_t *)&disable); |
|
|
|
|
|
|
|
aP2PClientContext[index].state = APP_BLE_CONNECTED_CLIENT; |
|
|
|
log_info("Update_Service", "state: APP_BLE_CONNECTED_CLIENT", 0); |
|
|
|
|
|
|
|
break; |
|
|
|
default: |
|
|
|
|