
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import "TagConnectStatus.h"
#import "Micros.h"

/*!
 @class Tag
 @abstract Tag is a connectable ble device. This class contains all information of tag device.
 */
@interface Tag : NSObject

@property (nonatomic, retain) NSString* _mac;
@property (nonatomic, retain) NSString* _name;
@property (nonatomic, assign) int _rssi;
@property (nonatomic, assign) int _rssiAtOneMeter;
@property (nonatomic, assign) TagConnectStatus _connectStatus;
@property (nonatomic, retain) NSDate* _dateLastScaned;
@property (nonatomic, retain) NSDate* _dateConnected;//连接上了就记录下时间，方便统计连接时长
@property (nonatomic, retain) NSDate* _dateDisconnected;//断开链接的时间，方便判断是否tag丢失
@property (nonatomic, assign) NSDate* _dateReceivingHelloFromTag;//tag会在连接成功后5秒内，发送hello数据包
//是否需要自动维持连接状态，即使断开了，timer也会自动把它连上
@property (nonatomic, assign) BOOL _keepConnect;
//使用一个bool变量，标识现在是不是正在readingRssi
@property (nonatomic, assign) BOOL _isReadingRssi;
@property (nonatomic, retain) NSData* _manufactureData;


@property (nonatomic, strong) CBPeripheral* _peripheral;
@property (nonatomic, strong) CBService* _uartService;
@property (nonatomic, strong) CBCharacteristic* _uartTXCharacteristic;
@property (nonatomic, strong) CBCharacteristic* _uartRXCharacteristic;

-(bool) hasIBeaconData;
-(NSData*) getIBeaconUUID;
-(long) getIBeaconMajorID;
-(long) getIBeaconMinorID;

@end
