ソースを参照

上传README说明文档

tags/v1.3.3
iot_user 5年前
コミット
cc6fd5a0cb
2個のファイルの変更568行の追加0行の削除
  1. 282
    0
      README.md
  2. 286
    0
      README_CN.md

+ 282
- 0
README.md ファイルの表示

@@ -0,0 +1,282 @@
#iFreshSDK instructions
[中文版](README_CN.md)
##The conditions of use
> * iOS 8.0 and above.
> * The Bluetooth version used by the device requires 4.0 and above.
> * Need to add iFreshSDK.framework package dependency;
> * Apply for the key and secret of sdk, application address: http://sdk.aicare.net.cn
##The document description
1.iFreshSDK.framework (package name raytao.pingwang.iFreshDemo);
2.Add the following code to AppDelegate:
```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [iFreshSDK setAppKey:@"key" appSecret:@"secret"];
    return YES;
}
```
##The version update information
For details, please see the "Good Nutrition SDK Release Notes.doc" document.

##Start integration
1. Import iFreshSDK.framework
2. Add Bluetooth permissions:
     Add “Privacy - Bluetooth Peripheral Usage Description” to the Info.plist file
5. Discovery equipment
1. Call the scan method
```
[[iFreshSDK shareManager] bleDoScan];
```
2. Compliance with the agreement “BleReturnValueDelegate”
3. Set the proxy
```
[[iFreshSDK shareManager] setbleReturnValueDelegate:self];
```
4. Implementation method:
```
/**
* GlobalBLEmodel model: value ble returns the value;
*
* @param model global Bluetooth model data
*/
- (void)bleReturnValueModel:(iFreshModel*)model;

/**
* Proxy method triggered by the end switch unit
* GN_UnitEnum unit enumeration
* unitChang after switching 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;

/**
 ble Penetrate Data

 @param data Penetrate data
 */
-(void)bluetoothManagerReturePenetrateData:(NSData *)data;
```
## Communication with equipment:
```
/*
* data input
*/

- (void)sendDataToBle:(NSData *)data;
/**
* Start scanning, it is recommended to put in the program entrance
*/
- (void)bleDoScan;

/**
* Stop connecting devices
*/
- (void)closeBleAndDisconnect;

/**
* Follow the protocol call
*/
- (void)setbleReturnValueDelegate:(id<BleReturnValueDelegate>)delegate;

/**
* insertTheUnit insert unit
*
* @param unit Write units based on GN_UnitEnum enumeration
*/
- (void)insertTheUnit:(GN_UnitEnum)unit;

/**
* Return to zero
*/
- (void)zeroWriteBle;
/*
Setting weight
*/
- (void)setWeight:(NSInteger)weight;

/*
* Set the maximum number of calories in a single item up to 4294967295
*/
- (void)setCalorie:(NSInteger)calories;

/*
* Set total calories - up to 4294967295
*/
- (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 the total sodium content
*/
- (void)setTotalSodium:(NSInteger)sodium;

/*
* Set the total sugar content
*/
- (void)setTotalSugar:(NSInteger)sugar;

/*
*Set fat
*/
- (void)setFat:(NSInteger)fat;

/*
*Set protein
*/
- (void)setProtein:(NSInteger)protein;
/*
*Set carbohydrates
*/

- (void)setCarbohydrates:(NSInteger)carbohydertes;
/*
*Set dietary fiber
*/

- (void)setFiber:(NSInteger)fiber;
/*
*Set cholesterol
*/

- (void)setCholesterd:(NSInteger)cholesterd;
/*
*Set the sodium content
*/

- (void)setSodium:(NSInteger)sodium;
/*
*Set the sugar content
*/
- (void)setSugar:(NSInteger)sugar;

/*
* Shutdown command
*
*/
- (void)turnOffDevice;
```
##Tools and fat model "iFreshModel"
The following data is the data returned by the proxy method after the SDK is processed:
```
// Bluetooth callback value:
@property (nonatomic, copy) NSString *value;
/ / Data in "g"
@property (nonatomic, assign) NSInteger gValue;
/ / Record the last used unit (SDK internal call),
@property (nonatomic,copy) NSString *Unit;

To convert data according to the unit, please call the following method:
/**
* g to lb method
* weightvalue: the weight string passed in g
* returned data separated by ":"
*/
+ (NSString *)gTolb:(NSString *)weightValue;
/**
* g to oz method
* weightvalue: the weight string passed in g
*/
+ (NSString *)gTooz:(NSString *)weightVlaue;
/**
* lb to g method
* weightvalue: the weight string passed in lb, please pass the ":" separated data
*/
+ (NSString *)lbTog:(NSString *)weightVlaue;
/**
* oz to g method
* weightvalue: the weight string passed in oz
*/
+ (NSString *)ozTog:(NSString *) weightValue;
/**
* g to kg method
* weightvalue: the weight string passed in g
*/
+ (NSString *)gToKg:(NSString *)weightValue;
/**
* g to kg method
* weightvalue: the weight string passed in g
*/
+ (NSString *)gToJin:(NSString *)weightValue;
/**
* kg to g method
* weightvalue: the weight string passed in kg
*/
+ (NSString *)kgTog:(NSString *)weightValue;
/**
* kg to g method
* weightvalue: the weight string passed in kilograms
*/
+ (NSString *)jinTog:(NSString *)weightValue;

/**
* kg to lb method
* weightvalue: the weight string passed in kg
*/
+ (NSString *)kgTolb:(NSString *)weightValue;
```
##Coffee scale timing function
Send instructions to Bluetooth
```
//start
-(void)bluetoothCoffeeStartTime;
//pause
-(void)bluetoothCoffeePauseTime;
//Reset
-(void)bluetoothCoffeeResetTime;

//Countdown starts
-(void)bluetoothCoffeeCountdownStartTime:(int)min second:(int)sec;

Receive data sent by Bluetooth

/**
*Agent callback supported by coffee scale
*workType: Operation instructions for the coffee scale
*/
-(void)bluetoothManagerCoffeeTimingWork:(BleCoffeeTimingWorkType)workType;
/**
*Time returned by the coffee scale
*min: minute
*sec: seconds
*countdown: Whether it is countdown, YES: countdown, NO: timing
*/
-(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;
//APP reply stop alarm command
-(void)bluetoothManagerSendStopAlarm;
```

+ 286
- 0
README_CN.md ファイルの表示

@@ -0,0 +1,286 @@
#iFreshSDK使用说明
[Englisth](README.md)
##使用条件:
> * iOS 8.0及以上版本。
> * 设备所使用蓝牙版本需要4.0及以上。
> * 需添加iFreshSDK.framework包依赖;
> * 申请sdk的key和secret,申请地址:http://sdk.aicare.net.cn

##文件说明:
1. iFreshSDK.framework(包名raytao.pingwang.iFreshDemo)
2. 在AppDelegate中加入如下代码:
```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    [iFreshSDK setAppKey:@"key" appSecret:@"secret"];
    return YES;
}
```

##版本更新信息
详情请见“好营养SDK发布说明.doc”文档
##开始集成
1.导入iFreshSDK.framework
2.添加蓝牙权限:
Info.plist文件中添加 Privacy - Bluetooth Peripheral Usage Description
##发现设备
1.调用扫描方法
```
[[iFreshSDK shareManager] bleDoScan];
```
2.遵守协议BleReturnValueDelegate
3.设置代理
```
[[iFreshSDK shareManager] setbleReturnValueDelegate:self]
```
4.实现方法:
```
/**
 *  GlobalBLEmodel模型:value ble返还数值;
 *
 *  @param model 全局蓝牙模型数据
 */
- (void)bleReturnValueModel:(iFreshModel*)model;

/**
 * 称端切换单位触发的代理方法
 * GN_UnitEnum 单位枚举
 * unitChang   切换后的单位
 */

- (void)changeUnitWithBle:(GN_UnitEnum) unitChange;

/**
 * 蓝牙连接状态改变的代理方法
 * GN_BleStatus 蓝牙状态枚举
 * bleStatus   当前蓝牙状态
 */

- (void)bleStatusupdate:(GN_BleStatus)bleStatus;

/**
 蓝牙透传数据

 @param data 透传数据
 */
-(void)bluetoothManagerReturePenetrateData:(NSData *)data;
```
##与设备通信
```
/*
 * 写入数据
 */

- (void)sendDataToBle:(NSData *)data;
/**
 *  开始扫描,建议放在程序入口
 */
- (void)bleDoScan;

/**
 *  停止连接设备
 */
- (void)closeBleAndDisconnect;

/**
 * 遵循协议的调用
 */
- (void)setbleReturnValueDelegate:(id<BleReturnValueDelegate>)delegate;

/**
 * insertTheUnit 插入单位
 *
 * @param unit 根据GN_UnitEnum枚举写入单位
 */
- (void)insertTheUnit:(GN_UnitEnum)unit;

/**
 * 归零写入
 */
- (void)zeroWriteBle;
/*
 设置重量
 */
- (void)setWeight:(NSInteger)weight;

/*
 *  设置单项卡路里最大不超过4294967295
 */
- (void)setCalorie:(NSInteger)calories;

/*
 *  设置总卡路里-最大不超过4294967295
 */
- (void)setTotalCalorie:(NSInteger)toatlCalories;


/*
 *  设置总脂肪
 */
- (void)setTotalFat:(NSInteger)fat;

/*
 *  设置总蛋白质
 */
- (void)setTotalProtein:(NSInteger)protein;

/*
 *  设置总碳水化合物
 */
- (void)setTotalCarbohydrates:(NSInteger)carbohydertes;
/*
 *  设置总脂肪纤维
 */
- (void)setTotalFiber:(NSInteger)fiber;
/*
*  设置总胆固醇
*/
- (void)setTotalCholesterd:(NSInteger)cholesterd;
/*
*  设置总钠含量
*/
- (void)setTotalSodium:(NSInteger)sodium;

/*
 *  设置总糖含量
 */
- (void)setTotalSugar:(NSInteger)sugar;

/*
 *设置脂肪
 */
- (void)setFat:(NSInteger)fat;

/*
 *设置蛋白质
 */
- (void)setProtein:(NSInteger)protein;
/*
 *设置碳水化合物
 */

- (void)setCarbohydrates:(NSInteger)carbohydertes;
/*
 *设置膳食纤维
 */

- (void)setFiber:(NSInteger)fiber;
/*
 *设置胆固醇
 */

- (void)setCholesterd:(NSInteger)cholesterd;
/*
 *设置钠含量
 */

- (void)setSodium:(NSInteger)sodium;
/*
 *设置糖含量
 */
- (void)setSugar:(NSInteger)sugar;

/*
 * 关机指令
 *
 */
- (void)turnOffDevice;
```
##工具类及胖模型”iFreshModel”
其中以下数据为SDK处理后代理方法返回的数据:
```
// 蓝牙回调数值:
@property (nonatomic, copy) NSString *value;
//以“g”为单位的数据
@property (nonatomic, assign) NSInteger gValue;
//记录最后使用的单位(SDK内部调用),
@property (nonatomic,copy) NSString *Unit;

如需根据单位转换数据请调用如下方法:
/**
 * g转lb方法
 * weightvalue:传入的以g为单位的重量字符串
 * 返回的是以“:”分隔的数据
 */
+ (NSString *)gTolb:(NSString *)weightValue;
/**
 * g转oz方法
 * weightvalue:传入的以g为单位的重量字符串
 */
+ (NSString *)gTooz:(NSString *)weightVlaue;
/**
 * lb转g方法
 * weightvalue:传入的以lb为单位的重量字符串,请传“:”分隔的数据
 */
+ (NSString *)lbTog:(NSString *)weightVlaue;
/**
 * oz转g方法
 * weightvalue:传入的以oz为单位的重量字符串
 */
+ (NSString *)ozTog:(NSString *) weightValue;
/**
 * g转kg方法
 * weightvalue:传入的以g为单位的重量字符串
 */
+ (NSString *)gToKg:(NSString *)weightValue;
/**
 * g转斤方法
 * weightvalue:传入的以g为单位的重量字符串
 */
+ (NSString *)gToJin:(NSString *)weightValue;
/**
 * kg转g方法
 * weightvalue:传入的以kg为单位的重量字符串
 */
+ (NSString *)kgTog:(NSString *)weightValue;
/**
 * 斤转g方法
 * weightvalue:传入的以斤为单位的重量字符串
 */
+ (NSString *)jinTog:(NSString *)weightValue;

/**
 * kg转lb方法
 * weightvalue:传入的以kg为单位的重量字符串
 */
+ (NSString *)kgTolb:(NSString *)weightValue;
```
##咖啡秤计时功能
发送指令给蓝牙
```
//开始计时
-(void)bluetoothCoffeeStartTime;
//暂停
-(void)bluetoothCoffeePauseTime;
//重置
-(void)bluetoothCoffeeResetTime;

//倒计时开始
-(void)bluetoothCoffeeCountdownStartTime:(int)min second:(int)sec;
接收蓝牙发送的数据
/**
 *咖啡秤支持的代理回调
 *workType:咖啡秤的操作指令
 */
-(void)bluetoothManagerCoffeeTimingWork:(BleCoffeeTimingWorkType)workType;
/**
 *咖啡秤返回的时间
 *min:分
 *sec:秒
 *countdown:是否是倒计时,YES:倒计时,NO:正计时
 */
-(void)bluetoothManagerCoffeeTime:(int )min second:(int)sec isCountdown:(BOOL)countdown;
/**
 *咖啡秤倒计时开始
 *min:分
 *sec:秒
 */
-(void)bluetoothManagerCoffeeCountdownStartTime:(int )min second:(int)sec;
//APP 回复停止报警指令
-(void)bluetoothManagerSendStopAlarm;

```





読み込み中…
キャンセル
保存