123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- //
- // iFreshSDK.h
- // iFreshSDK
- //
- // Created by zhang on 16/9/9.
- // Copyright © 2016年 taolei. All rights reserved.
- //
-
- #import <Foundation/Foundation.h>
- #import "iFreshModel.h"
-
- typedef NS_ENUM(NSUInteger, AiFrushDeviceType) {
- AiFrushDeviceTypeUnknown , //When not connected(未连接时)
- AiFrushDeviceTypeAC04 , //AC04 scale does not support KG(AC04的秤不支持KG)
- AiFrushDeviceTypeAC05 , //Some AC05 scales support KG(部分AC05的秤支持KG)
- };
-
- //咖啡定时功能
- typedef NS_ENUM(NSUInteger, BleCoffeeTimingWorkType) {
- BleCoffeeTimingWorkTypeStart = 1 , //Starting time(正计时开始)
- BleCoffeeTimingWorkTypePositivePause = 2 , //Positive timing pause(正计时暂停)
- BleCoffeeTimingWorkTypeReset = 3 , //reset(重置)
- BleCoffeeTimingWorkTypeCountdownPause = 4 , //Countdown pause(倒计时暂停)
- };
-
- typedef enum : NSUInteger {
-
- UNIT_g = 0,
- UNIT_ml,
- UNIT_lb,
- UNIT_oz,
- UNIT_kg,
- UNIT_jin
-
- } GN_UnitEnum;
-
-
- typedef enum : NSUInteger {
-
- bleOpen = 0,
- bleOff,
- bleConnect,
- bleBreak
-
- } GN_BleStatus;
-
- @protocol BleReturnValueDelegate <NSObject>
- @optional
-
- /**
- ble Penetrate Data(蓝牙透传数据)
-
- @param data Penetrate data(透传数据)
- */
- -(void)bluetoothManagerReturePenetrateData:(NSData *)data;
-
- /**
- * Model model: value ble returns the value (model模型:value ble返还数值)
- *
- * @param model Global Bluetooth model data(全局蓝牙模型数据)
- */
- - (void)bleReturnValueModel:(iFreshModel*)model;
-
- /**
- * Proxy method triggered by end switching unit(称端切换单位触发的代理方法)
- * GN_UnitEnum Unit enumeration(单位枚举)
- * unitChang Switched unit(切换后的单位)
- */
-
- - (void)changeUnitWithBle:(GN_UnitEnum)unitChange;
-
- /**
- * Proxy method for changing Bluetooth connection status(蓝牙连接状态改变的代理方法)
- * GN_BleStatus Bluetooth status enumeration(蓝牙状态枚举)
- * bleStatus Current Bluetooth status(当前蓝牙状态)
- */
- - (void)bleStatusupdate:(GN_BleStatus)bleStatus;
- /**
- *Callback Bluetooth device type(回调蓝牙设备类型)
- *deviceType:Bluetooth device type, default AiFrushDeviceTypeUnknown when no device is connected(蓝牙设备类型,未连接设备时,默认AiFrushDeviceTypeUnknown)
- */
- - (void)bleReturnDeviceType:(AiFrushDeviceType)deviceType;
- #pragma mark ============ Coffee scale callback(咖啡秤回调) ==============
- /**
- *Coffee scale support agent callback(咖啡秤支持的代理回调)
- *workType:Coffee scale operation instructions(咖啡秤的操作指令)
- */
- -(void)bluetoothManagerCoffeeTimingWork:(BleCoffeeTimingWorkType)workType;
- /**
- *Coffee scale return time(咖啡秤返回的时间)
- *min:minute(分)
- *sec:second(秒)
- *countdown:Whether it is countdown, YES: countdown, NO: timing(是否是倒计时,YES:倒计时,NO:正计时)
- */
- -(void)bluetoothManagerCoffeeTime:(int )min second:(int)sec isCountdown:(BOOL)countdown;
- /**
- *Coffee scale countdown starts(咖啡秤倒计时开始)
- *min:minute(分)
- *sec:second(秒)
- */
- -(void)bluetoothManagerCoffeeCountdownStartTime:(int )min second:(int)sec;
-
- /**
- Bluetooth pause timing callback(蓝牙暂停计时的回调)
-
- @param type Pause type(暂停类型)
- @param min minute(分钟)
- @param sec second(秒)
- */
- -(void)bluetoothManagerCoffeePauseType:(BleCoffeeTimingWorkType)type minute:(int)min second:(int)sec;
-
- /**
- 设备发送停止报警指令
- */
- -(void)bluetoothManagerCoffeeReceiveStopAlarm;
-
- @end
-
- @interface iFreshSDK : NSObject
-
- /// Whether to link to Bluetooth(是否链接上蓝牙)
- @property (nonatomic, assign) BOOL isBle_Link;
-
-
-
- @property (nonatomic, assign, readonly) GN_UnitEnum unitEnum;
-
-
- @property (nonatomic, assign , readonly) AiFrushDeviceType deviceType;
-
-
- //
- +(void)setAppKey:(NSString *)key appSecret:(NSString *)secret;
- /**
- * shareManager
- */
- + (instancetype)shareManager;
- /*
- * write data to ble(写入数据)
- */
-
- - (void)sendDataToBle:(NSData *)data;
- /**
- * start scaning(开始扫描)
- */
- - (void)bleDoScan;
-
- /**
- * stop connect device(停止连接设备)
- */
- - (void)closeBleAndDisconnect;
-
- /**
- * Follow the protocol call(遵循协议的调用)
- */
- - (void)setbleReturnValueDelegate:(id<BleReturnValueDelegate>)delegate;
-
- /**
- * setting unit(设置单位)
- *
- * @param unit Write units according to GN_UnitEnum enumeration(根据GN_UnitEnum枚举写入单位)
- */
- - (void)insertTheUnit:(GN_UnitEnum)unit;
-
- /**
- * Return to zero(归零)
- */
- - (void)zeroWriteBle;
- /*
- Setting weight(设置重量)
- */
- - (void)setWeight:(NSInteger)weight;
-
- /*
- * Set a single calorie(设置单项卡路里)
- */
- - (void)setCalorie:(NSInteger)calories;
-
- /*
- * Set total calories(设置总卡路里)
- */
- - (void)setTotalCalorie:(NSInteger)toatlCalories;
-
-
- /*
- * Set total fat(设置总脂肪)
- */
- - (void)setTotalFat:(NSInteger)fat;
-
- /*
- * Set total protein(设置总蛋白质)
- */
- - (void)setTotalProtein:(NSInteger)protein;
-
- /*
- * Set total carbohydrates(设置总碳水化合物)
- */
- - (void)setTotalCarbohydrates:(NSInteger)carbohydertes;
- /*
- * Set total fat fiber(设置总脂肪纤维)
- */
- - (void)setTotalFiber:(NSInteger)fiber;
- /*
- * Set total cholesterol(设置总胆固醇)
- */
- - (void)setTotalCholesterd:(NSInteger)cholesterd;
- /*
- * Set total sodium content(设置总钠含量)
- */
- - (void)setTotalSodium:(NSInteger)sodium;
-
- /*
- * Set total sugar content(设置总糖含量)
- */
- - (void)setTotalSugar:(NSInteger)sugar;
-
- /*
- *Setting fat(设置脂肪)
- */
- - (void)setFat:(NSInteger)fat;
-
- /*
- *Set protein(设置蛋白质)
- */
- - (void)setProtein:(NSInteger)protein;
- /*
- *Set carbohydrates(设置碳水化合物)
- */
-
- - (void)setCarbohydrates:(NSInteger)carbohydertes;
- /*
- *Setting dietary fiber(设置膳食纤维)
- */
-
- - (void)setFiber:(NSInteger)fiber;
- /*
- *Set cholesterol(设置胆固醇)
- */
-
- - (void)setCholesterd:(NSInteger)cholesterd;
- /*
- *Set sodium content(设置钠含量)
- */
-
- - (void)setSodium:(NSInteger)sodium;
- /*
- *Setting the sugar content(设置糖含量)
- */
- - (void)setSugar:(NSInteger)sugar;
-
- /*
- * Shutdown command(关机指令)
- *
- */
- - (void)turnOffDevice;
-
-
- #pragma mark ============ Coffee scale(咖啡秤) ==============
- //start the timer(开始计时)
- -(void)bluetoothCoffeeStartTime;
- //pause(暂停)
- -(void)bluetoothCoffeePauseType:(BleCoffeeTimingWorkType)type minute:(int)min second:(int)sec;
- //reset(重置)
- -(void)bluetoothCoffeeResetTime;
- //Countdown starts(倒计时开始)
- -(void)bluetoothCoffeeCountdownStartTime:(int)min second:(int)sec;
-
- //APP reply stop alarm command(APP 回复停止报警指令)
- -(void)bluetoothManagerSendStopAlarm;
- @end
|