@@ -8,40 +8,29 @@ | |||
|---------|------------:| ---------: | ----------------- | | |||
| v1.0 | 2019/07/08 |JosonXiong | Preliminary version | | |||
|v1.1.1 |2023/06/26 |Larry| Document filing | | |||
## Table of Contents | |||
## 一、The conditions of use | |||
## 1st、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; | |||
## 2nd、Use | |||
1. Import TPSMSleSDK.framework into the Xcode project. | |||
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 | |||
3. Import "#import <TPMSBleSDK/ELTPMSBleManager.h>" to the controller you want to use, and follow the "<ELTPMSBleManagerDelegate>" protocol. | |||
4. Set delegate | |||
``` | |||
[ELTPMSBleManager shareManager].delegate = self; | |||
``` | |||
8.Implementing proxy method | |||
5.Implementing proxy method | |||
``` | |||
-(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
-(void)TPMSBleManagerReceiveData:(ELTPMSDataModel *_Nonnull)model; | |||
``` | |||
## 三、Get broadcast data | |||
## 3rd、Get broadcast data | |||
### 1.Determine if the phone Bluetooth is available | |||
Proxy method: | |||
``` | |||
@@ -71,7 +60,7 @@ Get current Bluetooth enabled is available; | |||
-(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 | |||
## 4th、Remarks | |||
ELTPMSDataModel(Broadcast data model) | |||
|Type |Parameter |Description| | |||
|---- |-------: |----------:| |
@@ -6,38 +6,28 @@ | |||
|版本号 |更新时间 |作者 |更新信息| | |||
|-------| ------- | ------ | ------ | | |||
|v1.0 |2019/07/08 |JosonXiong| 初步版本| | |||
|V1.1.0 |2020/04/10 |JosonXiong| 增加key和secret加密验证功能| | |||
|v1.1.1 |2023/06/26 |Larry| 文档整理 | | |||
## 一、使用条件 | |||
> * 最低版本iOS 8.0 | |||
> * 设备所使用的蓝牙版本需要4.0及以上 | |||
## 二、开始使用 | |||
1.申请sdk的key 和secret ,申请地址:http://sdk.aicare.net.cn; | |||
1.将 TPMSBleSDK.framework 导入Xcode工程; | |||
2.在info.plist文件中加入“Privacy - Bluetooth Always Usage Description”; | |||
3.将TPMSBleSDK.framework导入Xcode工程。 | |||
4.在AppDelegate中入如下代码: | |||
``` | |||
#import <TPMSBleSDK/ELTPMSBleManager.h> | |||
3.在需要使用的 控制器.m 中导入 #import <TPMSBleSDK/ELTPMSBleManager.h>,并遵守 < ELTPMSBleManagerDelegate> 协议; | |||
4.设置代理 | |||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | |||
// Override point for customization after application launch. | |||
[ELTPMSBleManager setAppKey:@"key" appSecret:@"secret"]; | |||
return YES; | |||
} | |||
``` | |||
5.设置build setting 的bitcode为NO | |||
6.在需要使用的控制器.m中导入#import <TPMSBleSDK/ELTPMSBleManager.h>,并遵守< ELTPMSBleManagerDelegate>协议, | |||
7.设置代理 | |||
``` | |||
[ELTPMSBleManager shareManager].delegate = self; | |||
``` | |||
8.实现代理方法 | |||
5.实现代理方法 | |||
``` | |||
-(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
-(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
-(void)TPMSBleManagerReceiveData:(ELTPMSDataModel *_Nonnull)model; | |||
``` | |||
## 三、获取广播数据 | |||
### 1.判断手机蓝牙是否可用 | |||
可通过代理方法: | |||
@@ -63,7 +53,8 @@ | |||
-(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
``` | |||
此方法用于获取蓝牙当前状态,其中参数”state”是一个枚举TPMSBluetoothState | |||
枚举的元素包括:TPMSBluetoothStateAvailable(蓝牙打开可TPMSBluetoothStateUnavailable(蓝牙不可用),TPMSBluetoothStateBroadcasting(蓝牙正在广播数据),TPMSBluetoothStateStopBroadcasting(停止广播) | |||
枚举的元素包括:TPMSBluetoothStateAvailable(蓝牙打开可TPMSBluetoothStateUnavailable(蓝牙不可用),TPMSBluetoothStateBroadcasting(蓝牙正在广播数据),TPMSBluetoothStateStopBroadcasting(停止广播) | |||
``` | |||
-(void)TPMSBleManagerReceiveData:(ELTPMSDataModel *_Nonnull)model; | |||
``` |
@@ -0,0 +1,387 @@ | |||
// !$*UTF8*$! | |||
{ | |||
archiveVersion = 1; | |||
classes = { | |||
}; | |||
objectVersion = 56; | |||
objects = { | |||
/* Begin PBXBuildFile section */ | |||
81C5CCC72A4977860042D127 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5CCC62A4977860042D127 /* AppDelegate.swift */; }; | |||
81C5CCC92A4977860042D127 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5CCC82A4977860042D127 /* SceneDelegate.swift */; }; | |||
81C5CCCB2A4977860042D127 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5CCCA2A4977860042D127 /* ViewController.swift */; }; | |||
81C5CCCE2A4977860042D127 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81C5CCCC2A4977860042D127 /* Main.storyboard */; }; | |||
81C5CCD02A4977880042D127 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 81C5CCCF2A4977880042D127 /* Assets.xcassets */; }; | |||
81C5CCD32A4977880042D127 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81C5CCD12A4977880042D127 /* LaunchScreen.storyboard */; }; | |||
81C5CCDB2A4977B70042D127 /* TPMSBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81C5CCDA2A4977B70042D127 /* TPMSBleSDK.framework */; }; | |||
81C5CCDE2A4977C50042D127 /* oc.m in Sources */ = {isa = PBXBuildFile; fileRef = 81C5CCDD2A4977C50042D127 /* oc.m */; }; | |||
/* End PBXBuildFile section */ | |||
/* Begin PBXFileReference section */ | |||
81C5CCC32A4977860042D127 /* TpmsBleSDKDemo_iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TpmsBleSDKDemo_iOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
81C5CCC62A4977860042D127 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | |||
81C5CCC82A4977860042D127 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; | |||
81C5CCCA2A4977860042D127 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; | |||
81C5CCCD2A4977860042D127 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | |||
81C5CCCF2A4977880042D127 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | |||
81C5CCD22A4977880042D127 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | |||
81C5CCD42A4977880042D127 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | |||
81C5CCDA2A4977B70042D127 /* TPMSBleSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = TPMSBleSDK.framework; sourceTree = "<group>"; }; | |||
81C5CCDC2A4977C50042D127 /* TpmsBleSDKDemo_iOS-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TpmsBleSDKDemo_iOS-Bridging-Header.h"; sourceTree = "<group>"; }; | |||
81C5CCDD2A4977C50042D127 /* oc.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = oc.m; sourceTree = "<group>"; }; | |||
/* End PBXFileReference section */ | |||
/* Begin PBXFrameworksBuildPhase section */ | |||
81C5CCC02A4977860042D127 /* Frameworks */ = { | |||
isa = PBXFrameworksBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
81C5CCDB2A4977B70042D127 /* TPMSBleSDK.framework in Frameworks */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXFrameworksBuildPhase section */ | |||
/* Begin PBXGroup section */ | |||
81C5CCBA2A4977860042D127 = { | |||
isa = PBXGroup; | |||
children = ( | |||
81C5CCC52A4977860042D127 /* TpmsBleSDKDemo_iOS */, | |||
81C5CCC42A4977860042D127 /* Products */, | |||
); | |||
sourceTree = "<group>"; | |||
}; | |||
81C5CCC42A4977860042D127 /* Products */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
81C5CCC32A4977860042D127 /* TpmsBleSDKDemo_iOS.app */, | |||
); | |||
name = Products; | |||
sourceTree = "<group>"; | |||
}; | |||
81C5CCC52A4977860042D127 /* TpmsBleSDKDemo_iOS */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
81C5CCDA2A4977B70042D127 /* TPMSBleSDK.framework */, | |||
81C5CCC62A4977860042D127 /* AppDelegate.swift */, | |||
81C5CCC82A4977860042D127 /* SceneDelegate.swift */, | |||
81C5CCCA2A4977860042D127 /* ViewController.swift */, | |||
81C5CCDD2A4977C50042D127 /* oc.m */, | |||
81C5CCCC2A4977860042D127 /* Main.storyboard */, | |||
81C5CCCF2A4977880042D127 /* Assets.xcassets */, | |||
81C5CCD12A4977880042D127 /* LaunchScreen.storyboard */, | |||
81C5CCD42A4977880042D127 /* Info.plist */, | |||
81C5CCDC2A4977C50042D127 /* TpmsBleSDKDemo_iOS-Bridging-Header.h */, | |||
); | |||
path = TpmsBleSDKDemo_iOS; | |||
sourceTree = "<group>"; | |||
}; | |||
/* End PBXGroup section */ | |||
/* Begin PBXNativeTarget section */ | |||
81C5CCC22A4977860042D127 /* TpmsBleSDKDemo_iOS */ = { | |||
isa = PBXNativeTarget; | |||
buildConfigurationList = 81C5CCD72A4977880042D127 /* Build configuration list for PBXNativeTarget "TpmsBleSDKDemo_iOS" */; | |||
buildPhases = ( | |||
81C5CCBF2A4977860042D127 /* Sources */, | |||
81C5CCC02A4977860042D127 /* Frameworks */, | |||
81C5CCC12A4977860042D127 /* Resources */, | |||
); | |||
buildRules = ( | |||
); | |||
dependencies = ( | |||
); | |||
name = TpmsBleSDKDemo_iOS; | |||
productName = TpmsBleSDKDemo_iOS; | |||
productReference = 81C5CCC32A4977860042D127 /* TpmsBleSDKDemo_iOS.app */; | |||
productType = "com.apple.product-type.application"; | |||
}; | |||
/* End PBXNativeTarget section */ | |||
/* Begin PBXProject section */ | |||
81C5CCBB2A4977860042D127 /* Project object */ = { | |||
isa = PBXProject; | |||
attributes = { | |||
BuildIndependentTargetsInParallel = 1; | |||
LastSwiftUpdateCheck = 1420; | |||
LastUpgradeCheck = 1420; | |||
TargetAttributes = { | |||
81C5CCC22A4977860042D127 = { | |||
CreatedOnToolsVersion = 14.2; | |||
LastSwiftMigration = 1420; | |||
}; | |||
}; | |||
}; | |||
buildConfigurationList = 81C5CCBE2A4977860042D127 /* Build configuration list for PBXProject "TpmsBleSDKDemo_iOS" */; | |||
compatibilityVersion = "Xcode 14.0"; | |||
developmentRegion = en; | |||
hasScannedForEncodings = 0; | |||
knownRegions = ( | |||
en, | |||
Base, | |||
); | |||
mainGroup = 81C5CCBA2A4977860042D127; | |||
productRefGroup = 81C5CCC42A4977860042D127 /* Products */; | |||
projectDirPath = ""; | |||
projectRoot = ""; | |||
targets = ( | |||
81C5CCC22A4977860042D127 /* TpmsBleSDKDemo_iOS */, | |||
); | |||
}; | |||
/* End PBXProject section */ | |||
/* Begin PBXResourcesBuildPhase section */ | |||
81C5CCC12A4977860042D127 /* Resources */ = { | |||
isa = PBXResourcesBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
81C5CCD32A4977880042D127 /* LaunchScreen.storyboard in Resources */, | |||
81C5CCD02A4977880042D127 /* Assets.xcassets in Resources */, | |||
81C5CCCE2A4977860042D127 /* Main.storyboard in Resources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXResourcesBuildPhase section */ | |||
/* Begin PBXSourcesBuildPhase section */ | |||
81C5CCBF2A4977860042D127 /* Sources */ = { | |||
isa = PBXSourcesBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
81C5CCCB2A4977860042D127 /* ViewController.swift in Sources */, | |||
81C5CCDE2A4977C50042D127 /* oc.m in Sources */, | |||
81C5CCC72A4977860042D127 /* AppDelegate.swift in Sources */, | |||
81C5CCC92A4977860042D127 /* SceneDelegate.swift in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXSourcesBuildPhase section */ | |||
/* Begin PBXVariantGroup section */ | |||
81C5CCCC2A4977860042D127 /* Main.storyboard */ = { | |||
isa = PBXVariantGroup; | |||
children = ( | |||
81C5CCCD2A4977860042D127 /* Base */, | |||
); | |||
name = Main.storyboard; | |||
sourceTree = "<group>"; | |||
}; | |||
81C5CCD12A4977880042D127 /* LaunchScreen.storyboard */ = { | |||
isa = PBXVariantGroup; | |||
children = ( | |||
81C5CCD22A4977880042D127 /* Base */, | |||
); | |||
name = LaunchScreen.storyboard; | |||
sourceTree = "<group>"; | |||
}; | |||
/* End PBXVariantGroup section */ | |||
/* Begin XCBuildConfiguration section */ | |||
81C5CCD52A4977880042D127 /* Debug */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ALWAYS_SEARCH_USER_PATHS = NO; | |||
CLANG_ANALYZER_NONNULL = YES; | |||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | |||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; | |||
CLANG_ENABLE_MODULES = YES; | |||
CLANG_ENABLE_OBJC_ARC = YES; | |||
CLANG_ENABLE_OBJC_WEAK = YES; | |||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
CLANG_WARN_BOOL_CONVERSION = YES; | |||
CLANG_WARN_COMMA = YES; | |||
CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | |||
CLANG_WARN_EMPTY_BODY = YES; | |||
CLANG_WARN_ENUM_CONVERSION = YES; | |||
CLANG_WARN_INFINITE_RECURSION = YES; | |||
CLANG_WARN_INT_CONVERSION = YES; | |||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | |||
CLANG_WARN_UNREACHABLE_CODE = YES; | |||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
COPY_PHASE_STRIP = NO; | |||
DEBUG_INFORMATION_FORMAT = dwarf; | |||
ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
ENABLE_TESTABILITY = YES; | |||
GCC_C_LANGUAGE_STANDARD = gnu11; | |||
GCC_DYNAMIC_NO_PIC = NO; | |||
GCC_NO_COMMON_BLOCKS = YES; | |||
GCC_OPTIMIZATION_LEVEL = 0; | |||
GCC_PREPROCESSOR_DEFINITIONS = ( | |||
"DEBUG=1", | |||
"$(inherited)", | |||
); | |||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
GCC_WARN_UNUSED_FUNCTION = YES; | |||
GCC_WARN_UNUSED_VARIABLE = YES; | |||
IPHONEOS_DEPLOYMENT_TARGET = 16.2; | |||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | |||
MTL_FAST_MATH = YES; | |||
ONLY_ACTIVE_ARCH = YES; | |||
SDKROOT = iphoneos; | |||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; | |||
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | |||
}; | |||
name = Debug; | |||
}; | |||
81C5CCD62A4977880042D127 /* Release */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ALWAYS_SEARCH_USER_PATHS = NO; | |||
CLANG_ANALYZER_NONNULL = YES; | |||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | |||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; | |||
CLANG_ENABLE_MODULES = YES; | |||
CLANG_ENABLE_OBJC_ARC = YES; | |||
CLANG_ENABLE_OBJC_WEAK = YES; | |||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
CLANG_WARN_BOOL_CONVERSION = YES; | |||
CLANG_WARN_COMMA = YES; | |||
CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | |||
CLANG_WARN_EMPTY_BODY = YES; | |||
CLANG_WARN_ENUM_CONVERSION = YES; | |||
CLANG_WARN_INFINITE_RECURSION = YES; | |||
CLANG_WARN_INT_CONVERSION = YES; | |||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | |||
CLANG_WARN_UNREACHABLE_CODE = YES; | |||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
COPY_PHASE_STRIP = NO; | |||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | |||
ENABLE_NS_ASSERTIONS = NO; | |||
ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
GCC_C_LANGUAGE_STANDARD = gnu11; | |||
GCC_NO_COMMON_BLOCKS = YES; | |||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
GCC_WARN_UNUSED_FUNCTION = YES; | |||
GCC_WARN_UNUSED_VARIABLE = YES; | |||
IPHONEOS_DEPLOYMENT_TARGET = 16.2; | |||
MTL_ENABLE_DEBUG_INFO = NO; | |||
MTL_FAST_MATH = YES; | |||
SDKROOT = iphoneos; | |||
SWIFT_COMPILATION_MODE = wholemodule; | |||
SWIFT_OPTIMIZATION_LEVEL = "-O"; | |||
VALIDATE_PRODUCT = YES; | |||
}; | |||
name = Release; | |||
}; | |||
81C5CCD82A4977880042D127 /* Debug */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | |||
CLANG_ENABLE_MODULES = YES; | |||
CODE_SIGN_STYLE = Automatic; | |||
CURRENT_PROJECT_VERSION = 1; | |||
DEVELOPMENT_TEAM = YEU77XR292; | |||
FRAMEWORK_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(PROJECT_DIR)/TpmsBleSDKDemo_iOS", | |||
); | |||
GENERATE_INFOPLIST_FILE = YES; | |||
INFOPLIST_FILE = TpmsBleSDKDemo_iOS/Info.plist; | |||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | |||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; | |||
INFOPLIST_KEY_UIMainStoryboardFile = Main; | |||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | |||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | |||
LD_RUNPATH_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"@executable_path/Frameworks", | |||
); | |||
MARKETING_VERSION = 1.0; | |||
PRODUCT_BUNDLE_IDENTIFIER = "com.pingwang.TPMSBleSDK.TpmsBleSDKDemo-iOS"; | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
SWIFT_EMIT_LOC_STRINGS = YES; | |||
SWIFT_OBJC_BRIDGING_HEADER = "TpmsBleSDKDemo_iOS/TpmsBleSDKDemo_iOS-Bridging-Header.h"; | |||
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | |||
SWIFT_VERSION = 5.0; | |||
TARGETED_DEVICE_FAMILY = "1,2"; | |||
}; | |||
name = Debug; | |||
}; | |||
81C5CCD92A4977880042D127 /* Release */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | |||
CLANG_ENABLE_MODULES = YES; | |||
CODE_SIGN_STYLE = Automatic; | |||
CURRENT_PROJECT_VERSION = 1; | |||
DEVELOPMENT_TEAM = YEU77XR292; | |||
FRAMEWORK_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(PROJECT_DIR)/TpmsBleSDKDemo_iOS", | |||
); | |||
GENERATE_INFOPLIST_FILE = YES; | |||
INFOPLIST_FILE = TpmsBleSDKDemo_iOS/Info.plist; | |||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; | |||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; | |||
INFOPLIST_KEY_UIMainStoryboardFile = Main; | |||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | |||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; | |||
LD_RUNPATH_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"@executable_path/Frameworks", | |||
); | |||
MARKETING_VERSION = 1.0; | |||
PRODUCT_BUNDLE_IDENTIFIER = "com.pingwang.TPMSBleSDK.TpmsBleSDKDemo-iOS"; | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
SWIFT_EMIT_LOC_STRINGS = YES; | |||
SWIFT_OBJC_BRIDGING_HEADER = "TpmsBleSDKDemo_iOS/TpmsBleSDKDemo_iOS-Bridging-Header.h"; | |||
SWIFT_VERSION = 5.0; | |||
TARGETED_DEVICE_FAMILY = "1,2"; | |||
}; | |||
name = Release; | |||
}; | |||
/* End XCBuildConfiguration section */ | |||
/* Begin XCConfigurationList section */ | |||
81C5CCBE2A4977860042D127 /* Build configuration list for PBXProject "TpmsBleSDKDemo_iOS" */ = { | |||
isa = XCConfigurationList; | |||
buildConfigurations = ( | |||
81C5CCD52A4977880042D127 /* Debug */, | |||
81C5CCD62A4977880042D127 /* Release */, | |||
); | |||
defaultConfigurationIsVisible = 0; | |||
defaultConfigurationName = Release; | |||
}; | |||
81C5CCD72A4977880042D127 /* Build configuration list for PBXNativeTarget "TpmsBleSDKDemo_iOS" */ = { | |||
isa = XCConfigurationList; | |||
buildConfigurations = ( | |||
81C5CCD82A4977880042D127 /* Debug */, | |||
81C5CCD92A4977880042D127 /* Release */, | |||
); | |||
defaultConfigurationIsVisible = 0; | |||
defaultConfigurationName = Release; | |||
}; | |||
/* End XCConfigurationList section */ | |||
}; | |||
rootObject = 81C5CCBB2A4977860042D127 /* Project object */; | |||
} |
@@ -0,0 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<Workspace | |||
version = "1.0"> | |||
<FileRef | |||
location = "self:"> | |||
</FileRef> | |||
</Workspace> |
@@ -0,0 +1,36 @@ | |||
// | |||
// AppDelegate.swift | |||
// TpmsBleSDKDemo_iOS | |||
// | |||
// Created by ZZD on 2023/6/26. | |||
// | |||
import UIKit | |||
@main | |||
class AppDelegate: UIResponder, UIApplicationDelegate { | |||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |||
// Override point for customization after application launch. | |||
return true | |||
} | |||
// MARK: UISceneSession Lifecycle | |||
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { | |||
// Called when a new scene session is being created. | |||
// Use this method to select a configuration to create the new scene with. | |||
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | |||
} | |||
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { | |||
// Called when the user discards a scene session. | |||
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. | |||
// Use this method to release any resources that were specific to the discarded scenes, as they will not return. | |||
} | |||
} | |||
@@ -0,0 +1,11 @@ | |||
{ | |||
"colors" : [ | |||
{ | |||
"idiom" : "universal" | |||
} | |||
], | |||
"info" : { | |||
"author" : "xcode", | |||
"version" : 1 | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
{ | |||
"images" : [ | |||
{ | |||
"idiom" : "universal", | |||
"platform" : "ios", | |||
"size" : "1024x1024" | |||
} | |||
], | |||
"info" : { | |||
"author" : "xcode", | |||
"version" : 1 | |||
} | |||
} |
@@ -0,0 +1,6 @@ | |||
{ | |||
"info" : { | |||
"author" : "xcode", | |||
"version" : 1 | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | |||
<dependencies> | |||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> | |||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | |||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |||
</dependencies> | |||
<scenes> | |||
<!--View Controller--> | |||
<scene sceneID="EHf-IW-A2E"> | |||
<objects> | |||
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> | |||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | |||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> | |||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> | |||
</view> | |||
</viewController> | |||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | |||
</objects> | |||
<point key="canvasLocation" x="53" y="375"/> | |||
</scene> | |||
</scenes> | |||
</document> |
@@ -0,0 +1,24 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r"> | |||
<dependencies> | |||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> | |||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | |||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |||
</dependencies> | |||
<scenes> | |||
<!--View Controller--> | |||
<scene sceneID="tne-QT-ifu"> | |||
<objects> | |||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController"> | |||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC"> | |||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> | |||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> | |||
</view> | |||
</viewController> | |||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/> | |||
</objects> | |||
</scene> | |||
</scenes> | |||
</document> |
@@ -0,0 +1,25 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>UIApplicationSceneManifest</key> | |||
<dict> | |||
<key>UIApplicationSupportsMultipleScenes</key> | |||
<false/> | |||
<key>UISceneConfigurations</key> | |||
<dict> | |||
<key>UIWindowSceneSessionRoleApplication</key> | |||
<array> | |||
<dict> | |||
<key>UISceneConfigurationName</key> | |||
<string>Default Configuration</string> | |||
<key>UISceneDelegateClassName</key> | |||
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> | |||
<key>UISceneStoryboardFile</key> | |||
<string>Main</string> | |||
</dict> | |||
</array> | |||
</dict> | |||
</dict> | |||
</dict> | |||
</plist> |
@@ -0,0 +1,52 @@ | |||
// | |||
// SceneDelegate.swift | |||
// TpmsBleSDKDemo_iOS | |||
// | |||
// Created by ZZD on 2023/6/26. | |||
// | |||
import UIKit | |||
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |||
var window: UIWindow? | |||
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { | |||
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. | |||
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene. | |||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). | |||
guard let _ = (scene as? UIWindowScene) else { return } | |||
} | |||
func sceneDidDisconnect(_ scene: UIScene) { | |||
// Called as the scene is being released by the system. | |||
// This occurs shortly after the scene enters the background, or when its session is discarded. | |||
// Release any resources associated with this scene that can be re-created the next time the scene connects. | |||
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). | |||
} | |||
func sceneDidBecomeActive(_ scene: UIScene) { | |||
// Called when the scene has moved from an inactive state to an active state. | |||
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. | |||
} | |||
func sceneWillResignActive(_ scene: UIScene) { | |||
// Called when the scene will move from an active state to an inactive state. | |||
// This may occur due to temporary interruptions (ex. an incoming phone call). | |||
} | |||
func sceneWillEnterForeground(_ scene: UIScene) { | |||
// Called as the scene transitions from the background to the foreground. | |||
// Use this method to undo the changes made on entering the background. | |||
} | |||
func sceneDidEnterBackground(_ scene: UIScene) { | |||
// Called as the scene transitions from the foreground to the background. | |||
// Use this method to save data, release shared resources, and store enough scene-specific state information | |||
// to restore the scene back to its current state. | |||
} | |||
} | |||
@@ -0,0 +1,80 @@ | |||
// | |||
// ELTPMSBleManager.h | |||
// Elink | |||
// | |||
// Created by iot_user on 2019/5/23. | |||
// Copyright © 2019 iot_iMac. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import "ELTPMSDataModel.h" | |||
typedef NS_ENUM(NSUInteger, TPMSBluetoothState) { | |||
TPMSBluetoothStateAvailable = 0, //Open available(打开可用) | |||
TPMSBluetoothStateUnavailable = 1, //unavailable(不可用) | |||
TPMSBluetoothStateBroadcasting = 2, //Broadcasting(正在广播) | |||
TPMSBluetoothStateStopBroadcasting = 3, //Stop broadcasting(停止广播) | |||
}; | |||
//Bluetooth name prefix(蓝牙名称前缀) | |||
#define TPMSName @"TPMS_" //Such as:TPMS_B9F5BB | |||
@protocol ELTPMSBleManagerDelegate <NSObject> | |||
/** | |||
Return to Bluetooth status(返回蓝牙状态) | |||
@param state Bluetooth status(蓝牙状态) | |||
*/ | |||
-(void)TPMSBleManagerUpdateBleState:(TPMSBluetoothState)state; | |||
/** | |||
Callback tire pressure data(回调胎压数据) | |||
@param model Tire pressure data model(胎压数据模型) | |||
*/ | |||
-(void)TPMSBleManagerReceiveData:(ELTPMSDataModel *_Nonnull)model; | |||
@end | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface ELTPMSBleManager : NSObject | |||
/** | |||
Bluetooth is available to open(蓝牙是否打开可用) | |||
*/ | |||
@property (nonatomic, assign, readonly) BOOL isOn; | |||
/** | |||
Agent callback(代理回调) | |||
*/ | |||
@property (nonatomic, weak) id<ELTPMSBleManagerDelegate> delegate; | |||
+(void)setAppKey:(NSString *)key appSecret:(NSString *)secret NS_UNAVAILABLE; | |||
+(instancetype)shareManager; | |||
/** | |||
Start scanning(开始扫描) | |||
*/ | |||
-(void)startScan; | |||
/** | |||
Stop scanning(停止扫描) | |||
*/ | |||
-(void)stopScan; | |||
/** | |||
Get the SDK version number(获取SDK版本号) | |||
@return version | |||
*/ | |||
-(NSString *)sdkVersion; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,73 @@ | |||
// | |||
// ELTPMSDataModel.h | |||
// Elink | |||
// | |||
// Created by iot_user on 2019/5/23. | |||
// Copyright © 2019 iot_iMac. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
typedef NS_ENUM(NSUInteger, ELTPMSDataType) { | |||
ELTPMSDataType_Mode1_87 = 0, //Mode 1 87(模式一87) | |||
ELTPMSDataType_Mode1_87E = 1, //Mode 1 87E(模式一87E) | |||
ELTPMSDataType_Mode2 = 2, //Mode 2 | |||
}; | |||
typedef NS_ENUM(NSInteger, ELTPMSDeviceState) { | |||
ELTPMSDeviceStateNormal = 0x00, //Normal(正常) | |||
ELTPMSDeviceStateAirLeakage = 0x01, //Air Leakage (漏气) | |||
ELTPMSDeviceStateInflatable = 0x02, //Inflatable(充气) | |||
ELTPMSDeviceStateStart = 0x03, //Start(启动) | |||
ELTPMSDeviceStatePowerOn = 0x04, //Power On(上电) | |||
ELTPMSDeviceStateWakeUp = 0x05, //Wake Up(唤醒) | |||
}; | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface ELTPMSDataModel : NSObject<NSCopying> | |||
@property (nonatomic, assign) ELTPMSDataType type;// | |||
@property (nonatomic, assign) int classID;//Product number(产品型号 CID) | |||
@property (nonatomic, assign) double v;//Voltage coefficient (unit: V)(电压系数(单位:V)) | |||
@property (nonatomic, assign) double p;//Pressure coefficient (unit: kPa)(压力系数(单位:kPa)) | |||
@property (nonatomic, assign) int t;//Temperature coefficient (unit: °C)(温度系数( 单位:°C )) | |||
@property (nonatomic, assign) ELTPMSDeviceState state;//status(状态) | |||
@property (nonatomic, copy) NSString *mcuVersion; // Reserved byte (MCU version number)(保留字节(MCU 版本号)) | |||
@property (nonatomic, assign) int startCount;//The number of starts, when the state is ELTPMSDeviceStateStart, it means the number of times the startup state was sent (maximum of 4)(启动次数,当状态 state 为ELTPMSDeviceStateStart时,代表发送了启动状态的次数(最大为 4 次)) | |||
@property (nonatomic, assign) int stopCount;//When the state state is ELTPMSDeviceStateNormal, value<10 appears, indicating the number of sneak stops (maximum of 6)(当状态 state 为ELTPMSDeviceStateNormal时,出现 value<10,表示潜停次数(最大为 6 次)) | |||
@property (nonatomic, copy) NSString *bleVersion; //BLE version number | |||
@property (nonatomic, copy) NSString *macAddress; // MAC address | |||
@property (nonatomic, copy) NSString *name;//name | |||
@property (nonatomic, assign) NSInteger createTime;//Time when data was received(接收到数据的时间) | |||
/** | |||
analyze data(分析数据) | |||
@param data Bluetooth broadcast raw data(蓝牙广播的原始数据) | |||
@param name Bluetooth name(蓝牙名称) | |||
@param type Bluetooth module type(蓝牙模块类型) | |||
@return Tire pressure data model(胎压数据模型) | |||
*/ | |||
+(ELTPMSDataModel *)analysisData:(NSData *)data peripheralName:(NSString *)name type:(ELTPMSDataType)type; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,64 @@ | |||
// | |||
// ELTPMSHeader.h | |||
// Elink | |||
// | |||
// Created by iot_user on 2019/6/10. | |||
// Copyright © 2019 iot_iMac. All rights reserved. | |||
// | |||
#ifndef ELTPMSHeader_h | |||
#define ELTPMSHeader_h | |||
typedef NS_ENUM(NSUInteger, TPMSTyreUnitType) { | |||
TPMSTyreUnitType_Bar = 0, | |||
TPMSTyreUnitType_Psi = 1, | |||
TPMSTyreUnitType_Kpa = 2, | |||
}; | |||
typedef NS_ENUM(NSUInteger, TPMSTempUnitType) { | |||
TPMSTempUnitType_C = 0, | |||
TPMSTempUnitType_F = 1 | |||
}; | |||
typedef NS_ENUM(NSUInteger, TPMSWheelTyreType) { | |||
TPMSWheelTyreTypeNormal = 0,//normal(正常) | |||
TPMSWheelTyreTypeLow = 1,//Low pressure(胎压过低) | |||
TPMSWheelTyreTypeHigh = 2,//High pressure(胎压过高) | |||
}; | |||
//Air leak, high temperature, high tire pressure, low tire pressure, low battery(漏气、温度过高、胎压过高、胎压过低、电量低) | |||
typedef NS_ENUM(NSUInteger, TPMSWheelExceptionType) { | |||
TPMSWheelExceptionTypeNormal = 0, //normal(正常) | |||
TPMSWheelExceptionTypeAirLeakage = 1, //Air leak(漏气) | |||
TPMSWheelExceptionTypeTempHigh = 2, //high temperature(温度过高) | |||
TPMSWheelExceptionTypeTyreHigh = 3, //high tire pressure(胎压过高) | |||
TPMSWheelExceptionTypeTyreLow = 4, //low tire pressure(胎压过低) | |||
TPMSWheelExceptionTypeLowPower = 5, //low battery(电量低) | |||
TPMSWheelExceptionTypeNoSignal = 6, //no signal(无信号) | |||
}; | |||
#define TPMSTyreUnitDic @{\ | |||
@(TPMSTyreUnitType_Bar):@"Bar",\ | |||
@(TPMSTyreUnitType_Psi):@"Psi",\ | |||
@(TPMSTyreUnitType_Kpa):@"Kpa"\ | |||
}\ | |||
#define TPMSTempUnitDic @{@(TPMSTempUnitType_C):@"℃",@(TPMSTempUnitType_F):@"℉"} | |||
#define TPMSTyreUnit_Bar @"Bar" | |||
#define TPMSTyreUnit_Psi @"Psi" | |||
#define TPMSTyreUnit_Kpa @"Kpa" | |||
#define TPMSTempUnit_C @"℃" | |||
#define TPMSTempUnit_F @"℉" | |||
#define Kpa_To_Bar 0.01 | |||
#define Kpa_To_Psi 0.1450377 | |||
#define Bar_TO_Kpa 100 | |||
#define Bar_TO_Psi 14.5037744 | |||
#define C_TO_F(C) (C*1.8+32) //F = C*1.8 + 32 | |||
#define F_To_C(F) ((F-32)/1.8) | |||
#endif /* ELTPMSHeader_h */ |
@@ -0,0 +1,5 @@ | |||
// | |||
// Use this file to import your target's public headers that you would like to expose to Swift. | |||
// | |||
#import <TPMSBleSDK/ELTPMSBleManager.h> |
@@ -0,0 +1,28 @@ | |||
// | |||
// ViewController.swift | |||
// TpmsBleSDKDemo_iOS | |||
// | |||
// Created by ZZD on 2023/6/26. | |||
// | |||
import UIKit | |||
class ViewController: UIViewController, ELTPMSBleManagerDelegate { | |||
override func viewDidLoad() { | |||
super.viewDidLoad() | |||
ELTPMSBleManager.share().delegate = self | |||
ELTPMSBleManager.share().startScan() | |||
} | |||
// MARK: ELTPMSBleManagerDelegate | |||
func tpmsBleManagerUpdateBleState(_ state: TPMSBluetoothState) { | |||
print("tpmsBleManagerUpdateBleState = \(state)") | |||
} | |||
func tpmsBleManagerReceiveData(_ model: ELTPMSDataModel) { | |||
print("tpmsBleManagerReceiveData = \(model.description)") | |||
} | |||
} | |||
@@ -0,0 +1,8 @@ | |||
// | |||
// oc.m | |||
// TpmsBleSDKDemo_iOS | |||
// | |||
// Created by ZZD on 2023/6/26. | |||
// | |||
#import <Foundation/Foundation.h> |