Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * @brief Get the adv report of discovered devices
- * @param None
- * @retval None
- */
- void hci_le_advertising_report_event(uint8_t Num_Reports, Advertising_Report_t Advertising_Report[])
- {
- STBOX1_PRINTF("\rCalled 'hci_le_advertising_report_event'!\r\n");
- /*
- * Check if it is a SaveMeNow.AI device in PERIPHERAL mode.
- */
- for (int i = 0; i < Num_Reports; i++) {
- if(Advertising_Report[i].Length_Data > 10) {
- if(Advertising_Report[i].Data[5] == 0x53 && // S
- Advertising_Report[i].Data[6] == 0x4d && // M
- Advertising_Report[i].Data[7] == 0x4e && // N
- Advertising_Report[i].Data[8] == 0x5f) { // _
- // STBOX1_PRINTF("ALM Result: %d \r\n", Advertising_Report[i].Data[14]);
- // STBOX1_PRINTF("NUM Result: %d \r\n", Advertising_Report[i].Data[15]);
- // STBOX1_PRINTF("NAS Result: %d \r\n", Advertising_Report[i].Data[16]);
- // STBOX1_PRINTF("ML0 Result: %d \r\n", Advertising_Report[i].Data[17]);
- // STBOX1_PRINTF("ML1 Result: %d \r\n", Advertising_Report[i].Data[18]);
- // STBOX1_PRINTF("ML2 Result: %d \r\n", Advertising_Report[i].Data[19]);
- // STBOX1_PRINTF("\r\n");
- //
- // STBOX1_PRINTF("\r\nSignal: %d \r\n", Advertising_Report[i].RSSI);
- STBOX1_PRINTF("MAC = %x:%x:%x:%x:%x:%x\r\n",
- Advertising_Report[i].Address[5],
- Advertising_Report[i].Address[4],
- Advertising_Report[i].Address[3],
- Advertising_Report[i].Address[2],
- Advertising_Report[i].Address[1],
- Advertising_Report[i].Address[0]);
- if(Advertising_Report[i].Data[14] == 0x01) {
- BSP_LED_Off(LED_BLUE);
- BSP_LED_On(LED_GREEN);
- STBOX1_PRINTF("\rALARM! Connecting to the device!\r\n")
- // ALARM on device!!
- // Create connection with device!
- /*ret= aci_gap_create_connection(
- LE_Scan_Interval=0x0010,
- LE_Scan_Window=0x0010,
- Peer_Address_Type= ”Slave_B address type”,
- Peer_Address= ”Slave_B address”,
- Own_Address_Type = 0x0;
- Conn_Interval_Min=0x6c,
- Conn_Interval_Max=0x6c,
- Conn_Latency=0x00,
- Supervision_Timeout=0xc80,
- Minimum_CE_Length=0x000c,
- Maximum_CE_Length=0x000c);*/
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement