| @@ -0,0 +1,92 @@ | |||
| | |||
| # TPMSBleSDK instructions | |||
| [中文版](README_CN.md) | |||
| | Version | Update time | Author | Update information | | |||
| |---------|------------:| ---------: | ----------------- | | |||
| | v1.0 | 2019/07/08 |JosonXiong | Preliminary version | | |||
| ## Table of Contents | |||
| ## 一、The conditions of use | |||
| > * Minimum version iOS 8.0 | |||
| > * The Bluetooth version used by the device requires 4.0 and above. | |||
| ## 二、Use | |||
| 1. Apply the key and secret of sdk, application address: http://sdk.aicare.net.cn; | |||
| 2. Add "Privacy-Bluetooth Always Usage Description" to the info.plist file; | |||
| 3.Import TPSMSleSDK.framework into the Xcode project. | |||
| 4. Enter the following code in AppDelegate: | |||
| ``` | |||
| #import <TPMSBleSDK/ELTPMSBleManager.h> | |||
| - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |||
| // Override point for customization after application launch. | |||
| [ELTPMSBleManager setAppKey:@"key" appSecret:@"secret"]; | |||
| return YES; | |||
| } | |||
| ``` | |||
| 5.Set the bitcode of the build setting to NO | |||
| 6.Import "#import <TPMSBleSDK/ELTPMSBleManager.h>" to the controller you want to use, and follow the "<ELTPMSBleManagerDelegate>" protocol. | |||
| 7.Set delegate | |||
| ``` | |||
| [ELTPMSBleManager shareManager].delegate = self; | |||
| ``` | |||
| 8.Implementing proxy method | |||
| ``` | |||
| -(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
| -(void)TPMSBleManagerReceiveData:(ELTPMSDataModel *_Nonnull)model; | |||
| ``` | |||
| ## 三、Get broadcast data | |||
| ### 1.Determine if the phone Bluetooth is available | |||
| Proxy method: | |||
| ```` | |||
| -(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
| ``` | |||
| Get the current Bluetooth status | |||
| Or | |||
| ``` | |||
| [ELTPMSBleManager shareManager].isOn | |||
| ``` | |||
| Get current Bluetooth enabled is available; | |||
| ### 2.Start scanning | |||
| ``` | |||
| [[ELTPMSBleManager shareManager] startScan]; | |||
| ``` | |||
| ### 3.Stop scanning | |||
| ``` | |||
| [[ELTPMSBleManager shareManager] stopScan]; | |||
| ``` | |||
| ### 4.Method description | |||
| ``` | |||
| -(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
| ``` | |||
| This method is used to get the current state of Bluetooth, where the parameter "state" is an enumeration TPMSBluetoothState | |||
| The enumerated elements include: TPMSBluetoothStateAvailable (Bluetooth on TPMSBluetoothStateUnavailable), TPMSBluetoothStateBroadcasting, TPMSBluetoothStateStopBroadcasting | |||
| ``` | |||
| -(void)TPMSBleManagerReceiveData:(ELTPMSDataModel *_Nonnull)model; | |||
| ``` | |||
| This method is used to call back the TPMS Bluetooth module broadcast data. The model is an ELTPMSDataModel data model. For details on the ELTPMSDataModel class, please see "Remarks". | |||
| ## 四、Remarks | |||
| ELTPMSDataModel(Broadcast data model) | |||
| |Type |Parameter |Description| | |||
| |---- |-------: |----------:| | |||
| |ELTPMSDataType|type|Type of data| | |||
| |int|classID|Product number| | |||
| |double|v|Voltage coefficient (unit: V)| | |||
| |double |p|Pressure coefficient (unit: kPa)| | |||
| |int |t|Temperature coefficient (unit: °C)| | |||
| |ELTPMSDeviceState|state|Tire pressure status| | |||
| |int| mcuVersion|MCU version number| | |||
| |int |startCount|Operation counts| | |||
| |int |stopCount| Number of sneak stops| | |||
| |NSString|bleVersion|Bluetooth version number| | |||
| |NSString |macAddress|MAC address| | |||
| |NSString| name|Bluetooth name| | |||
| |NSInteger|createTime|Time when data was received| | |||
| ELTPMSHeader.h(head File) | |||
| Provide tire pressure unit, temperature unit, and the conversion method between units and the name symbol of the corresponding unit. | |||