app_losspack.c 705 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include "app_losspack.h"
  2. #include "bsp_time.h"
  3. #include "app_flash.h"
  4. #include "system.h"
  5. #include "hal_ble_client.h"
  6. #include "ble_comm.h"
  7. #if LOSSPACK_ENANBLE
  8. uint16_t lose_pack_all =0;
  9. void LossPack_process(void){
  10. uint16_t pack_l =0;
  11. uint8_t rssi = 0-host_get_rssi();
  12. pack_l = lose_pack_all;
  13. uint8_t buf[8];
  14. uint8_t L = 0;
  15. buf[L++] = (uint8_t)(pack_l>>8);
  16. buf[L++] = (uint8_t)(pack_l);
  17. buf[L++] = (uint8_t)(rssi);
  18. BLE_Client_Tx_Send(0,(BLE_CMD_n)0x03,buf,L);
  19. // SEGGER_RTT_printf(0,"lose_pack_all:%d, h_rssi=%d\r\n",lose_pack_all,rssi);
  20. lose_pack_all = 0;
  21. }
  22. void app_losspack_Init(void)
  23. {
  24. if(mFlash.isHost)Process_Start(1000,"LossPack_process",LossPack_process);
  25. }
  26. #endif