mgmt.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. BlueZ - Bluetooth protocol stack for Linux
  3. Copyright (C) 2010 Nokia Corporation
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License version 2 as
  6. published by the Free Software Foundation;
  7. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  8. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  9. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
  10. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
  11. CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
  12. WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
  16. COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
  17. SOFTWARE IS DISCLAIMED.
  18. */
  19. struct mgmt_hdr {
  20. __le16 opcode;
  21. __le16 len;
  22. } __packed;
  23. #define MGMT_HDR_SIZE 4
  24. #define MGMT_OP_READ_VERSION 0x0001
  25. struct mgmt_rp_read_version {
  26. __u8 version;
  27. __le16 revision;
  28. } __packed;
  29. #define MGMT_OP_READ_INDEX_LIST 0x0003
  30. struct mgmt_rp_read_index_list {
  31. __le16 num_controllers;
  32. __le16 index[0];
  33. } __packed;
  34. #define MGMT_OP_READ_INFO 0x0004
  35. struct mgmt_cp_read_info {
  36. __le16 index;
  37. } __packed;
  38. struct mgmt_rp_read_info {
  39. __le16 index;
  40. __u8 type;
  41. __u8 powered;
  42. __u8 connectable;
  43. __u8 discoverable;
  44. __u8 pairable;
  45. __u8 sec_mode;
  46. bdaddr_t bdaddr;
  47. __u8 dev_class[3];
  48. __u8 features[8];
  49. __u16 manufacturer;
  50. __u8 hci_ver;
  51. __u16 hci_rev;
  52. } __packed;
  53. struct mgmt_mode {
  54. __le16 index;
  55. __u8 val;
  56. } __packed;
  57. #define MGMT_OP_SET_POWERED 0x0005
  58. #define MGMT_OP_SET_DISCOVERABLE 0x0006
  59. #define MGMT_OP_SET_CONNECTABLE 0x0007
  60. #define MGMT_OP_SET_PAIRABLE 0x0008
  61. #define MGMT_OP_ADD_UUID 0x0009
  62. struct mgmt_cp_add_uuid {
  63. __le16 index;
  64. __u8 uuid[16];
  65. __u8 svc_hint;
  66. } __packed;
  67. #define MGMT_OP_REMOVE_UUID 0x000A
  68. struct mgmt_cp_remove_uuid {
  69. __le16 index;
  70. __u8 uuid[16];
  71. } __packed;
  72. #define MGMT_OP_SET_DEV_CLASS 0x000B
  73. struct mgmt_cp_set_dev_class {
  74. __le16 index;
  75. __u8 major;
  76. __u8 minor;
  77. } __packed;
  78. #define MGMT_OP_SET_SERVICE_CACHE 0x000C
  79. struct mgmt_cp_set_service_cache {
  80. __le16 index;
  81. __u8 enable;
  82. } __packed;
  83. #define MGMT_EV_CMD_COMPLETE 0x0001
  84. struct mgmt_ev_cmd_complete {
  85. __le16 opcode;
  86. __u8 data[0];
  87. } __packed;
  88. #define MGMT_EV_CMD_STATUS 0x0002
  89. struct mgmt_ev_cmd_status {
  90. __u8 status;
  91. __le16 opcode;
  92. } __packed;
  93. #define MGMT_EV_CONTROLLER_ERROR 0x0003
  94. struct mgmt_ev_controller_error {
  95. __le16 index;
  96. __u8 error_code;
  97. } __packed;
  98. #define MGMT_EV_INDEX_ADDED 0x0004
  99. struct mgmt_ev_index_added {
  100. __le16 index;
  101. } __packed;
  102. #define MGMT_EV_INDEX_REMOVED 0x0005
  103. struct mgmt_ev_index_removed {
  104. __le16 index;
  105. } __packed;
  106. #define MGMT_EV_POWERED 0x0006
  107. #define MGMT_EV_DISCOVERABLE 0x0007
  108. #define MGMT_EV_CONNECTABLE 0x0008
  109. #define MGMT_EV_PAIRABLE 0x0009