Blame view

Twear/3rd/Mediatek/GATTLinker.h 1.47 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
51
52
53
54
55
56
57
58
59
60
  //
  //  GATTLinker.h
  //  MTKBleManager
  //
  //  Created by user on 11/7/14.
  //  Copyright (c) 2014 ___MTK___. All rights reserved.
  //
  
  #import "Linker.h"
  #import "MTKBleManager.h"
  
  extern NSString *const kDOGPServiceUUIDString;
  extern NSString *const kDOGPReadCharUUIDString;
  extern NSString *const kDOGPWriteCharUUIDString;
  
  const static int STATE_READ_NONE = 0;
  const static int STATE_READ_WAIT_FOR_RESPONSE = 1;
  const static int STATE_READ_NEED_TO_READ = 2;
  
  @protocol LinkerListenerProtocol <NSObject>
  
  - (void)onDataArrived: (NSData *)data;
  - (void)onDataSent: (float)percent Tag: (NSString *)sessionTag;
  - (void)onConnectionStateChange: (int)newState;
  
  @end
  
  @interface GATTLinker : Linker
  
  + (id) initGattLinkerInstance: (CBPeripheral *)peripheral readChar: (CBCharacteristic *)readCh writeChar: (CBCharacteristic *)writeCh;
  + (id) getGattLinkerInstance;
  
  -(void)close;
  
  - (void) write: (NSData *)data;
  
  -(void)readNextDataValue;
  
  -(void)writeDataDirectly:(NSData*)data;
  
  - (void) changeDataBuffer: (int)SessionDataSize;
  
  //for MTKBleManager
  - (void) onReadCharacteristicCallBack: (CBCharacteristic *)ch error: (NSError *)er;
  - (void) onWriteCharacteristicCallBack: (CBCharacteristic *)ch error: (NSError *)er;
  
  -(void)onConnectionStateChange:(int)newState;
  
  -(BOOL)isConnected;
  -(BOOL)isHandShakeDone;
  
  -(void)setHandShakeDone:(BOOL)done;
  
  -(void)setRemoteDeviceVersion:(int)version;
  
  -(BOOL)setMaxWriteLength:(int)length;
  
  @property (nonatomic) id<LinkerListenerProtocol> mLinkerListener;
  
  @end