S&B Volcano vaporizer remote control with Pi Pico W
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ble.h 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. struct ble_scan_result {
  29. bool set;
  30. uint32_t time;
  31. bd_addr_t addr;
  32. bd_addr_type_t type;
  33. int8_t rssi;
  34. char name[BLE_MAX_NAME_LENGTH + 1];
  35. };
  36. void ble_init(void);
  37. bool ble_is_ready(void);
  38. void ble_scan(enum ble_scan_mode mode);
  39. int ble_get_scan_results(struct ble_scan_result *buf, uint len);
  40. #endif // __BLE_H__