app_losspack.c 677 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. uint16_t lose_pack_all =0;
  8. void LossPack_process(void){
  9. uint16_t pack_l =0;
  10. uint8_t rssi = 0-host_get_rssi();
  11. pack_l = lose_pack_all;
  12. uint8_t buf[8];
  13. uint8_t L = 0;
  14. buf[L++] = (uint8_t)(pack_l>>8);
  15. buf[L++] = (uint8_t)(pack_l);
  16. buf[L++] = (uint8_t)(rssi);
  17. BLE_Client_Tx_Send(0,(BLE_CMD_n)0x03,buf,L);
  18. // SEGGER_RTT_printf(0,"lose_pack_all:%d, h_rssi=%d\r\n",lose_pack_all,rssi);
  19. lose_pack_all = 0;
  20. }
  21. void app_losspack_Init(void)
  22. {
  23. if(mFlash.isHost)Process_Start(1000,"LossPack_process",LossPack_process);
  24. }