app_main.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #include <stddef.h>
  2. #include <stdio.h>
  3. #include "base/common.h"
  4. #include <drivers/hci_driver.h>
  5. #include "btp/btp.h"
  6. #define LOG_MODULE_NAME tester
  7. #include "logging/bt_log.h"
  8. bool socket_connected = false;
  9. void bt_ready(int err)
  10. {
  11. if (err)
  12. {
  13. BT_INFO("Bluetooth init failed (err %d)\n", err);
  14. return;
  15. }
  16. BT_INFO("Bluetooth initialized\n");
  17. tester_init();
  18. //
  19. // //Socket initialization for BTP communication
  20. // socket_connected = tester_socket_init();
  21. // if (socket_connected){
  22. // BT_INFO("Start to initialize BTP.\n");
  23. // tester_init_core();
  24. // int ret = tester_btp_pkt_send(BTP_SERVICE_ID_CORE, BTP_CORE_EV_IUT_READY, BTP_INDEX_NONE,NULL, 0);
  25. // if (ret < 0){
  26. // BT_INFO("IUT ready event failed\n");
  27. // return;
  28. // }
  29. // }
  30. //
  31. // BT_INFO("Sent IUT ready event\n");
  32. }
  33. void app_polling_work(void)
  34. {
  35. //Read socket and Process
  36. // if (socket_connected) {
  37. // testr_btp_pkt_process();
  38. // } else{
  39. // socket_connected = tester_socket_init();
  40. // if (socket_connected){
  41. // tester_init();
  42. // int ret = tester_btp_pkt_send(BTP_SERVICE_ID_CORE, BTP_CORE_EV_IUT_READY, BTP_INDEX_NONE,NULL, 0);
  43. // if(!ret){
  44. // BT_INFO("Sent IUT ready event\n");
  45. // }
  46. // }
  47. // }
  48. tester_polling_work();
  49. }