S&B Volcano vaporizer remote control with Pi Pico W
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * ble.h
  3. *
  4. * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * See <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef __BLE_H__
  19. #define __BLE_H__
  20. #include "btstack.h"
  21. #define BLE_MAX_NAME_LENGTH 32
  22. #define BLE_MAX_SCAN_RESULTS 32
  23. enum ble_scan_mode {
  24. BLE_SCAN_OFF = 0,
  25. BLE_SCAN_ON = 1,
  26. BLE_SCAN_TOGGLE = 2,
  27. };
  28. enum ble_remote_name_state {
  29. BLE_NAME_REQUEST = 0,
  30. BLE_NAME_INQUIRED,
  31. BLE_NAME_FETCHED,
  32. };
  33. struct ble_scan_result {
  34. bool set;
  35. uint32_t time;
  36. enum ble_remote_name_state state;
  37. bd_addr_t addr;
  38. bd_addr_type_t type;
  39. int8_t rssi;
  40. uint8_t page_scan_repetition_mode;
  41. uint16_t clock_offset;
  42. uint32_t class;
  43. char name[BLE_MAX_NAME_LENGTH + 1];
  44. };
  45. void ble_init(void);
  46. void ble_scan(enum ble_scan_mode mode);
  47. int ble_get_scan_results(struct ble_scan_result *buf, uint len);
  48. #endif // __BLE_H__