bluetooth.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:2k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  1. /* 
  2.    BlueZ - Bluetooth protocol stack for Linux
  3.    Copyright (C) 2000-2001 Qualcomm Incorporated
  4.    Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License version 2 as
  7.    published by the Free Software Foundation;
  8.    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  9.    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  10.    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
  11.    IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
  12.    CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES 
  13.    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 
  14.    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 
  15.    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16.    ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, 
  17.    COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS 
  18.    SOFTWARE IS DISCLAIMED.
  19. */
  20. /*
  21.  *  $Id: bluetooth.h,v 1.6 2001/08/03 04:19:49 maxk Exp $
  22.  */
  23. #ifndef __BLUETOOTH_H
  24. #define __BLUETOOTH_H
  25. #include <asm/types.h>
  26. #include <asm/byteorder.h>
  27. #ifndef AF_BLUETOOTH
  28. #define AF_BLUETOOTH 31
  29. #define PF_BLUETOOTH AF_BLUETOOTH
  30. #endif
  31. #define BTPROTO_L2CAP   0
  32. #define BTPROTO_HCI     1
  33. #define SOL_HCI     0
  34. #define SOL_L2CAP   6
  35. /* Connection and socket states */
  36. enum {
  37. BT_CONNECTED = 1, /* Equal to TCP_ESTABLISHED to make net code happy */
  38. BT_OPEN,
  39. BT_BOUND,
  40. BT_LISTEN,
  41. BT_CONNECT,
  42. BT_CONFIG,
  43. BT_DISCONN,
  44. BT_CLOSED
  45. };
  46. /* Endianness conversions */
  47. #define htobs(a) __cpu_to_le16(a)
  48. #define htobl(a) __cpu_to_le32(a)
  49. #define btohs(a) __le16_to_cpu(a)
  50. #define btohl(a) __le32_to_cpu(a)
  51. /* BD Address */
  52. typedef struct {
  53. __u8 b[6];
  54. } __attribute__((packed)) bdaddr_t;
  55. #define BDADDR_ANY ((bdaddr_t *)"0000000000")
  56. /* Copy, swap, convert BD Address */
  57. static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2)
  58. {
  59. return memcmp(ba1, ba2, sizeof(bdaddr_t));
  60. }
  61. static inline void bacpy(bdaddr_t *dst, bdaddr_t *src)
  62. {
  63. memcpy(dst, src, sizeof(bdaddr_t));
  64. }
  65. void baswap(bdaddr_t *dst, bdaddr_t *src);
  66. char *batostr(bdaddr_t *ba);
  67. bdaddr_t *strtoba(char *str);
  68. int bterr(__u16 code);
  69. #endif /* __BLUETOOTH_H */