Blame view

HDFwear/3rd/RTKOTASDK/RTKLEFoundation.framework/Headers/RTKLEGeneralDefines.h 1.21 KB
75d24c15   yangbin   123
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  //
  //  RTKLEGeneralDefines.h
  //  RTKLEFoundation
  //
  //  Created by jerome_gu on 2019/4/10.
  //  Copyright © 2019 Realtek. All rights reserved.
  //
  
  #ifndef RTKLEGeneralDefines_h
  #define RTKLEGeneralDefines_h
  
  #import <Foundation/Foundation.h>
  
  typedef void(^RTKLECompletionBlock)(BOOL success, NSError *_Nullable error);
  
  
  #pragma pack(push, 1)
  
  struct BDAddressByteStruct {
      uint8_t part0;
      uint8_t part1;
      uint8_t part2;
      uint8_t part3;
      uint8_t part4;
      uint8_t part5;
  };
  
  /**
   * BDAddress Type which store a BDAddress value.
   */
  typedef union {
      struct BDAddressByteStruct components;
      struct {
          uint64_t intValue : 48;
      } value;
      struct {
          uint16_t NAP;
          uint8_t UAP;
          uint32_t LAP : 24;
      } parts;
  } BDAddressType;
  
  #pragma pack(pop)
  
  
  #define BDAddressIsValid(addr) ((addr).parts.NAP>0 && (addr).parts.UAP>0)
  #define BDAddressIsEqual(addr1, addr2) ((addr1).value.intValue == (addr2).value.intValue)
  #define BDAddressString(addr) [NSString stringWithFormat:@"%.2x:%.2x:%.2x:%.2x:%.2x:%.2x", (addr).components.part0, (addr).components.part1, (addr).components.part2, (addr).components.part3, (addr).components.part4, (addr).components.part5]
  
  #endif /* RTKLEGeneralDefines_h */