candle_defs.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. Copyright (c) 2016 Hubert Denkmair <hubert@denkmair.de>
  3. This file is part of the candle windows API.
  4. This library is free software: you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation, either
  7. version 3 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. #pragma once
  16. #include <stdint.h>
  17. #include <windows.h>
  18. #include <winbase.h>
  19. #include <winusb.h>
  20. #include <setupapi.h>
  21. #include <devguid.h>
  22. #include <regstr.h>
  23. #undef __CRT__NO_INLINE
  24. #include <strsafe.h>
  25. #define __CRT__NO_INLINE
  26. #include "candle.h"
  27. #define CANDLE_MAX_DEVICES 32
  28. #define CANDLE_URB_COUNT 30
  29. #pragma pack(push,1)
  30. typedef struct {
  31. uint32_t byte_order;
  32. } candle_host_config_t;
  33. typedef struct {
  34. uint8_t reserved1;
  35. uint8_t reserved2;
  36. uint8_t reserved3;
  37. uint8_t icount;
  38. uint32_t sw_version;
  39. uint32_t hw_version;
  40. } candle_device_config_t;
  41. typedef struct {
  42. uint32_t mode;
  43. uint32_t flags;
  44. } candle_device_mode_t;
  45. #pragma pack(pop)
  46. typedef struct {
  47. OVERLAPPED ovl;
  48. uint8_t buf[128];
  49. } canlde_rx_urb;
  50. typedef struct {
  51. wchar_t path[256];
  52. candle_devstate_t state;
  53. candle_err_t last_error;
  54. HANDLE deviceHandle;
  55. WINUSB_INTERFACE_HANDLE winUSBHandle;
  56. UCHAR interfaceNumber;
  57. UCHAR bulkInPipe;
  58. UCHAR bulkOutPipe;
  59. candle_device_config_t dconf;
  60. candle_capability_t bt_const;
  61. canlde_rx_urb rxurbs[CANDLE_URB_COUNT];
  62. HANDLE rxevents[CANDLE_URB_COUNT];
  63. } candle_device_t;
  64. typedef struct {
  65. uint8_t num_devices;
  66. candle_err_t last_error;
  67. candle_device_t dev[CANDLE_MAX_DEVICES];
  68. } candle_list_t;