E622E2FF243F1D4A003C319D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2D8243F1D4A003C319D /* ViewController.m */; }; | E622E2FF243F1D4A003C319D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2D8243F1D4A003C319D /* ViewController.m */; }; | ||||
E622E300243F1D4A003C319D /* ThermometerScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2DA243F1D4A003C319D /* ThermometerScanViewController.m */; }; | E622E300243F1D4A003C319D /* ThermometerScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2DA243F1D4A003C319D /* ThermometerScanViewController.m */; }; | ||||
E622E301243F1D4A003C319D /* ThermometerConnectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2DD243F1D4A003C319D /* ThermometerConnectViewController.m */; }; | E622E301243F1D4A003C319D /* ThermometerConnectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E622E2DD243F1D4A003C319D /* ThermometerConnectViewController.m */; }; | ||||
E680BF1C2510572A005AD827 /* AILinkBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E680BF1B25105729005AD827 /* AILinkBleSDK.framework */; }; | |||||
E680BF252510576D005AD827 /* BroadcastScaleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF1E2510576D005AD827 /* BroadcastScaleViewController.m */; }; | E680BF252510576D005AD827 /* BroadcastScaleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF1E2510576D005AD827 /* BroadcastScaleViewController.m */; }; | ||||
E680BF262510576D005AD827 /* EightScaleScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF212510576D005AD827 /* EightScaleScanViewController.m */; }; | E680BF262510576D005AD827 /* EightScaleScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF212510576D005AD827 /* EightScaleScanViewController.m */; }; | ||||
E680BF272510576D005AD827 /* EightScaleConnectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */; }; | E680BF272510576D005AD827 /* EightScaleConnectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */; }; | ||||
E6FEA2102522E3BA001343A0 /* AILinkBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6FEA20F2522E3BA001343A0 /* AILinkBleSDK.framework */; }; | |||||
E6FEA2222522E3D0001343A0 /* ELInputAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA2132522E3D0001343A0 /* ELInputAlertView.m */; }; | |||||
E6FEA2232522E3D0001343A0 /* ToothbrushScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA2142522E3D0001343A0 /* ToothbrushScanViewController.m */; }; | |||||
E6FEA2242522E3D0001343A0 /* UILabel+WZAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA2152522E3D0001343A0 /* UILabel+WZAdd.m */; }; | |||||
E6FEA2252522E3D0001343A0 /* UIView+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA2172522E3D0001343A0 /* UIView+Category.m */; }; | |||||
E6FEA2262522E3D0001343A0 /* UIButton+WZAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA21A2522E3D0001343A0 /* UIButton+WZAdd.m */; }; | |||||
E6FEA2272522E3D0001343A0 /* ToothbrushConnectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA21F2522E3D0001343A0 /* ToothbrushConnectionViewController.m */; }; | |||||
E6FEA2282522E3D0001343A0 /* CABasicAnimation+ELAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA2202522E3D0001343A0 /* CABasicAnimation+ELAnimation.m */; }; | |||||
E6FEA2292522E3D0001343A0 /* ELSelectView.m in Sources */ = {isa = PBXBuildFile; fileRef = E6FEA2212522E3D0001343A0 /* ELSelectView.m */; }; | |||||
/* End PBXBuildFile section */ | /* End PBXBuildFile section */ | ||||
/* Begin PBXContainerItemProxy section */ | /* Begin PBXContainerItemProxy section */ | ||||
E622E2DB243F1D4A003C319D /* ThermometerConnectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThermometerConnectViewController.h; sourceTree = "<group>"; }; | E622E2DB243F1D4A003C319D /* ThermometerConnectViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThermometerConnectViewController.h; sourceTree = "<group>"; }; | ||||
E622E2DC243F1D4A003C319D /* ThermometerScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThermometerScanViewController.h; sourceTree = "<group>"; }; | E622E2DC243F1D4A003C319D /* ThermometerScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThermometerScanViewController.h; sourceTree = "<group>"; }; | ||||
E622E2DD243F1D4A003C319D /* ThermometerConnectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThermometerConnectViewController.m; sourceTree = "<group>"; }; | E622E2DD243F1D4A003C319D /* ThermometerConnectViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThermometerConnectViewController.m; sourceTree = "<group>"; }; | ||||
E680BF1B25105729005AD827 /* AILinkBleSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AILinkBleSDK.framework; sourceTree = "<group>"; }; | |||||
E680BF1E2510576D005AD827 /* BroadcastScaleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BroadcastScaleViewController.m; sourceTree = "<group>"; }; | E680BF1E2510576D005AD827 /* BroadcastScaleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BroadcastScaleViewController.m; sourceTree = "<group>"; }; | ||||
E680BF1F2510576D005AD827 /* BroadcastScaleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BroadcastScaleViewController.h; sourceTree = "<group>"; }; | E680BF1F2510576D005AD827 /* BroadcastScaleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BroadcastScaleViewController.h; sourceTree = "<group>"; }; | ||||
E680BF212510576D005AD827 /* EightScaleScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EightScaleScanViewController.m; sourceTree = "<group>"; }; | E680BF212510576D005AD827 /* EightScaleScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EightScaleScanViewController.m; sourceTree = "<group>"; }; | ||||
E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EightScaleConnectionViewController.m; sourceTree = "<group>"; }; | E680BF222510576D005AD827 /* EightScaleConnectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EightScaleConnectionViewController.m; sourceTree = "<group>"; }; | ||||
E680BF232510576D005AD827 /* EightScaleScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EightScaleScanViewController.h; sourceTree = "<group>"; }; | E680BF232510576D005AD827 /* EightScaleScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EightScaleScanViewController.h; sourceTree = "<group>"; }; | ||||
E680BF242510576D005AD827 /* EightScaleConnectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EightScaleConnectionViewController.h; sourceTree = "<group>"; }; | E680BF242510576D005AD827 /* EightScaleConnectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EightScaleConnectionViewController.h; sourceTree = "<group>"; }; | ||||
E6FEA20F2522E3BA001343A0 /* AILinkBleSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = AILinkBleSDK.framework; sourceTree = "<group>"; }; | |||||
E6FEA2122522E3D0001343A0 /* UIButton+WZAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+WZAdd.h"; sourceTree = "<group>"; }; | |||||
E6FEA2132522E3D0001343A0 /* ELInputAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELInputAlertView.m; sourceTree = "<group>"; }; | |||||
E6FEA2142522E3D0001343A0 /* ToothbrushScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ToothbrushScanViewController.m; sourceTree = "<group>"; }; | |||||
E6FEA2152522E3D0001343A0 /* UILabel+WZAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+WZAdd.m"; sourceTree = "<group>"; }; | |||||
E6FEA2162522E3D0001343A0 /* ToothbrushConnectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToothbrushConnectionViewController.h; sourceTree = "<group>"; }; | |||||
E6FEA2172522E3D0001343A0 /* UIView+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+Category.m"; sourceTree = "<group>"; }; | |||||
E6FEA2182522E3D0001343A0 /* ELSelectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELSelectView.h; sourceTree = "<group>"; }; | |||||
E6FEA2192522E3D0001343A0 /* CABasicAnimation+ELAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CABasicAnimation+ELAnimation.h"; sourceTree = "<group>"; }; | |||||
E6FEA21A2522E3D0001343A0 /* UIButton+WZAdd.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+WZAdd.m"; sourceTree = "<group>"; }; | |||||
E6FEA21B2522E3D0001343A0 /* UILabel+WZAdd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+WZAdd.h"; sourceTree = "<group>"; }; | |||||
E6FEA21C2522E3D0001343A0 /* ToothbrushScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ToothbrushScanViewController.h; sourceTree = "<group>"; }; | |||||
E6FEA21D2522E3D0001343A0 /* ELInputAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ELInputAlertView.h; sourceTree = "<group>"; }; | |||||
E6FEA21E2522E3D0001343A0 /* UIView+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Category.h"; sourceTree = "<group>"; }; | |||||
E6FEA21F2522E3D0001343A0 /* ToothbrushConnectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ToothbrushConnectionViewController.m; sourceTree = "<group>"; }; | |||||
E6FEA2202522E3D0001343A0 /* CABasicAnimation+ELAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CABasicAnimation+ELAnimation.m"; sourceTree = "<group>"; }; | |||||
E6FEA2212522E3D0001343A0 /* ELSelectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ELSelectView.m; sourceTree = "<group>"; }; | |||||
/* End PBXFileReference section */ | /* End PBXFileReference section */ | ||||
/* Begin PBXFrameworksBuildPhase section */ | /* Begin PBXFrameworksBuildPhase section */ | ||||
isa = PBXFrameworksBuildPhase; | isa = PBXFrameworksBuildPhase; | ||||
buildActionMask = 2147483647; | buildActionMask = 2147483647; | ||||
files = ( | files = ( | ||||
E680BF1C2510572A005AD827 /* AILinkBleSDK.framework in Frameworks */, | |||||
E6FEA2102522E3BA001343A0 /* AILinkBleSDK.framework in Frameworks */, | |||||
); | ); | ||||
runOnlyForDeploymentPostprocessing = 0; | runOnlyForDeploymentPostprocessing = 0; | ||||
}; | }; | ||||
E622E25D243F1CA5003C319D /* AILinkBleSDKDemo */ = { | E622E25D243F1CA5003C319D /* AILinkBleSDKDemo */ = { | ||||
isa = PBXGroup; | isa = PBXGroup; | ||||
children = ( | children = ( | ||||
E680BF1B25105729005AD827 /* AILinkBleSDK.framework */, | |||||
E6FEA2112522E3D0001343A0 /* 蓝牙WiFi牙刷 */, | |||||
E6FEA20F2522E3BA001343A0 /* AILinkBleSDK.framework */, | |||||
E622E2B7243F1D4A003C319D /* AiLinkSuper */, | E622E2B7243F1D4A003C319D /* AiLinkSuper */, | ||||
E622E2CC243F1D4A003C319D /* BabyScale */, | E622E2CC243F1D4A003C319D /* BabyScale */, | ||||
E622E2B1243F1D4A003C319D /* BloodPressure */, | E622E2B1243F1D4A003C319D /* BloodPressure */, | ||||
path = "八电极体脂秤"; | path = "八电极体脂秤"; | ||||
sourceTree = "<group>"; | sourceTree = "<group>"; | ||||
}; | }; | ||||
E6FEA2112522E3D0001343A0 /* 蓝牙WiFi牙刷 */ = { | |||||
isa = PBXGroup; | |||||
children = ( | |||||
E6FEA2122522E3D0001343A0 /* UIButton+WZAdd.h */, | |||||
E6FEA2132522E3D0001343A0 /* ELInputAlertView.m */, | |||||
E6FEA2142522E3D0001343A0 /* ToothbrushScanViewController.m */, | |||||
E6FEA2152522E3D0001343A0 /* UILabel+WZAdd.m */, | |||||
E6FEA2162522E3D0001343A0 /* ToothbrushConnectionViewController.h */, | |||||
E6FEA2172522E3D0001343A0 /* UIView+Category.m */, | |||||
E6FEA2182522E3D0001343A0 /* ELSelectView.h */, | |||||
E6FEA2192522E3D0001343A0 /* CABasicAnimation+ELAnimation.h */, | |||||
E6FEA21A2522E3D0001343A0 /* UIButton+WZAdd.m */, | |||||
E6FEA21B2522E3D0001343A0 /* UILabel+WZAdd.h */, | |||||
E6FEA21C2522E3D0001343A0 /* ToothbrushScanViewController.h */, | |||||
E6FEA21D2522E3D0001343A0 /* ELInputAlertView.h */, | |||||
E6FEA21E2522E3D0001343A0 /* UIView+Category.h */, | |||||
E6FEA21F2522E3D0001343A0 /* ToothbrushConnectionViewController.m */, | |||||
E6FEA2202522E3D0001343A0 /* CABasicAnimation+ELAnimation.m */, | |||||
E6FEA2212522E3D0001343A0 /* ELSelectView.m */, | |||||
); | |||||
path = "蓝牙WiFi牙刷"; | |||||
sourceTree = "<group>"; | |||||
}; | |||||
/* End PBXGroup section */ | /* End PBXGroup section */ | ||||
/* Begin PBXNativeTarget section */ | /* Begin PBXNativeTarget section */ | ||||
files = ( | files = ( | ||||
E680BF262510576D005AD827 /* EightScaleScanViewController.m in Sources */, | E680BF262510576D005AD827 /* EightScaleScanViewController.m in Sources */, | ||||
E622E2FF243F1D4A003C319D /* ViewController.m in Sources */, | E622E2FF243F1D4A003C319D /* ViewController.m in Sources */, | ||||
E6FEA2292522E3D0001343A0 /* ELSelectView.m in Sources */, | |||||
E622E2EF243F1D4A003C319D /* BloodConnectViewController.m in Sources */, | E622E2EF243F1D4A003C319D /* BloodConnectViewController.m in Sources */, | ||||
E622E2F6243F1D4A003C319D /* WheelMonitorConnectViewController.m in Sources */, | E622E2F6243F1D4A003C319D /* WheelMonitorConnectViewController.m in Sources */, | ||||
E622E2EB243F1D4A003C319D /* MASConstraint.m in Sources */, | E622E2EB243F1D4A003C319D /* MASConstraint.m in Sources */, | ||||
E622E2FA243F1D4A003C319D /* BabyScaleViewController.m in Sources */, | E622E2FA243F1D4A003C319D /* BabyScaleViewController.m in Sources */, | ||||
E622E301243F1D4A003C319D /* ThermometerConnectViewController.m in Sources */, | E622E301243F1D4A003C319D /* ThermometerConnectViewController.m in Sources */, | ||||
E622E2F8243F1D4A003C319D /* RemoteControlConnectViewController.m in Sources */, | E622E2F8243F1D4A003C319D /* RemoteControlConnectViewController.m in Sources */, | ||||
E6FEA2222522E3D0001343A0 /* ELInputAlertView.m in Sources */, | |||||
E622E2FE243F1D4A003C319D /* BodyFatScaleConnectViewController.m in Sources */, | E622E2FE243F1D4A003C319D /* BodyFatScaleConnectViewController.m in Sources */, | ||||
E622E2DF243F1D4A003C319D /* HeightGuageConnectViewController.m in Sources */, | E622E2DF243F1D4A003C319D /* HeightGuageConnectViewController.m in Sources */, | ||||
E622E2DE243F1D4A003C319D /* HeightGuageScanViewController.m in Sources */, | E622E2DE243F1D4A003C319D /* HeightGuageScanViewController.m in Sources */, | ||||
E622E2FC243F1D4A003C319D /* BodyFatScaleScanViewController.m in Sources */, | E622E2FC243F1D4A003C319D /* BodyFatScaleScanViewController.m in Sources */, | ||||
E680BF272510576D005AD827 /* EightScaleConnectionViewController.m in Sources */, | E680BF272510576D005AD827 /* EightScaleConnectionViewController.m in Sources */, | ||||
E6FEA2282522E3D0001343A0 /* CABasicAnimation+ELAnimation.m in Sources */, | |||||
E622E2E4243F1D4A003C319D /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, | E622E2E4243F1D4A003C319D /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, | ||||
E6FEA2252522E3D0001343A0 /* UIView+Category.m in Sources */, | |||||
E622E2ED243F1D4A003C319D /* MASViewAttribute.m in Sources */, | E622E2ED243F1D4A003C319D /* MASViewAttribute.m in Sources */, | ||||
E622E2E1243F1D4A003C319D /* InheritConnectViewController.m in Sources */, | E622E2E1243F1D4A003C319D /* InheritConnectViewController.m in Sources */, | ||||
E622E2F4243F1D4A003C319D /* ForeheadConnectViewController.m in Sources */, | E622E2F4243F1D4A003C319D /* ForeheadConnectViewController.m in Sources */, | ||||
E6FEA2272522E3D0001343A0 /* ToothbrushConnectionViewController.m in Sources */, | |||||
E622E2EC243F1D4A003C319D /* MASViewConstraint.m in Sources */, | E622E2EC243F1D4A003C319D /* MASViewConstraint.m in Sources */, | ||||
E6FEA2232522E3D0001343A0 /* ToothbrushScanViewController.m in Sources */, | |||||
E622E2E0243F1D4A003C319D /* SubBleManager.m in Sources */, | E622E2E0243F1D4A003C319D /* SubBleManager.m in Sources */, | ||||
E680BF252510576D005AD827 /* BroadcastScaleViewController.m in Sources */, | E680BF252510576D005AD827 /* BroadcastScaleViewController.m in Sources */, | ||||
E622E2E7243F1D4A003C319D /* MASConstraintMaker.m in Sources */, | E622E2E7243F1D4A003C319D /* MASConstraintMaker.m in Sources */, | ||||
E622E2E8243F1D4A003C319D /* MASLayoutConstraint.m in Sources */, | E622E2E8243F1D4A003C319D /* MASLayoutConstraint.m in Sources */, | ||||
E6FEA2262522E3D0001343A0 /* UIButton+WZAdd.m in Sources */, | |||||
E622E300243F1D4A003C319D /* ThermometerScanViewController.m in Sources */, | E622E300243F1D4A003C319D /* ThermometerScanViewController.m in Sources */, | ||||
E622E2F9243F1D4A003C319D /* RemoteControlScanViewController.m in Sources */, | E622E2F9243F1D4A003C319D /* RemoteControlScanViewController.m in Sources */, | ||||
E622E2F3243F1D4A003C319D /* AiLinkSuperViewController.m in Sources */, | E622E2F3243F1D4A003C319D /* AiLinkSuperViewController.m in Sources */, | ||||
E622E2FD243F1D4A003C319D /* WiFiSetupViewController.m in Sources */, | E622E2FD243F1D4A003C319D /* WiFiSetupViewController.m in Sources */, | ||||
E6FEA2242522E3D0001343A0 /* UILabel+WZAdd.m in Sources */, | |||||
E622E2FB243F1D4A003C319D /* BabyScaleConnectViewController.m in Sources */, | E622E2FB243F1D4A003C319D /* BabyScaleConnectViewController.m in Sources */, | ||||
E622E2EA243F1D4A003C319D /* View+MASAdditions.m in Sources */, | E622E2EA243F1D4A003C319D /* View+MASAdditions.m in Sources */, | ||||
E622E2F2243F1D4A003C319D /* AilinkSuperConnectViewController.m in Sources */, | E622E2F2243F1D4A003C319D /* AilinkSuperConnectViewController.m in Sources */, | ||||
buildSettings = { | buildSettings = { | ||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
CODE_SIGN_STYLE = Automatic; | CODE_SIGN_STYLE = Automatic; | ||||
CURRENT_PROJECT_VERSION = 202009291140; | |||||
DEVELOPMENT_TEAM = YEU77XR292; | DEVELOPMENT_TEAM = YEU77XR292; | ||||
FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
"$(inherited)", | "$(inherited)", | ||||
"$(inherited)", | "$(inherited)", | ||||
"@executable_path/Frameworks", | "@executable_path/Frameworks", | ||||
); | ); | ||||
MARKETING_VERSION = 1.1; | |||||
PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | ||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
TARGETED_DEVICE_FAMILY = "1,2"; | TARGETED_DEVICE_FAMILY = "1,2"; | ||||
buildSettings = { | buildSettings = { | ||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | ||||
CODE_SIGN_STYLE = Automatic; | CODE_SIGN_STYLE = Automatic; | ||||
CURRENT_PROJECT_VERSION = 202009291140; | |||||
DEVELOPMENT_TEAM = YEU77XR292; | DEVELOPMENT_TEAM = YEU77XR292; | ||||
FRAMEWORK_SEARCH_PATHS = ( | FRAMEWORK_SEARCH_PATHS = ( | ||||
"$(inherited)", | "$(inherited)", | ||||
"$(inherited)", | "$(inherited)", | ||||
"@executable_path/Frameworks", | "@executable_path/Frameworks", | ||||
); | ); | ||||
MARKETING_VERSION = 1.1; | |||||
PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | PRODUCT_BUNDLE_IDENTIFIER = com.pingwang.AILinkBleSDKDemo; | ||||
PRODUCT_NAME = "$(TARGET_NAME)"; | PRODUCT_NAME = "$(TARGET_NAME)"; | ||||
TARGETED_DEVICE_FAMILY = "1,2"; | TARGETED_DEVICE_FAMILY = "1,2"; |
/** MCU发送体脂数据给App,发送完毕(一次完整测量结束) */ | /** MCU发送体脂数据给App,发送完毕(一次完整测量结束) */ | ||||
ELBodyFatScaleBleDataType_MCUBackSendUnitResult = 0x82 , | ELBodyFatScaleBleDataType_MCUBackSendUnitResult = 0x82 , | ||||
/** 数据传输结束指令 */ | |||||
ELBodyFatScaleBleDataType_ReceivedDataResult = 0xFE , | |||||
/** 设备上发错误码 */ | /** 设备上发错误码 */ | ||||
ELBodyFatScaleBleDataType_MCUBackErrorCode = 0xFF , | ELBodyFatScaleBleDataType_MCUBackErrorCode = 0xFF , | ||||
}; | }; |
- (void)sendCurrentUserToBle:(ELBodyFatScaleBleUserModel *)usr; | - (void)sendCurrentUserToBle:(ELBodyFatScaleBleUserModel *)usr; | ||||
-(void)sendReceivedDataResult:(BOOL)result; | |||||
#pragma mark ============ 下发A6指令 ============== | #pragma mark ============ 下发A6指令 ============== | ||||
// | |||||
// ELToothbrushBleManager.h | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2020/5/11. | |||||
// Copyright © 2020 iot_iMac. All rights reserved. | |||||
// | |||||
#import "ELBluetoothManager.h" | |||||
#import "ELToothburshHeader.h" | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@protocol ToothbrushDelegate <NSObject> | |||||
@optional | |||||
//Bluetooth status callback(回调蓝牙状态) | |||||
-(void)toothbrushReceiveState:(ELBluetoothState)state; | |||||
//Callback toothbrush device list(回调牙刷设备列表) | |||||
-(void)toothbrushReceiveDevices:(NSArray<ELPeripheralModel *> *)devices; | |||||
/// Callback gear information(回调档位信息) | |||||
/// @param oneGear First gear(一档档位) | |||||
/// @param twoGear Second gear(二档档位) | |||||
-(void)toothbrushReceiveOneGear:(NSArray<NSNumber *> *)oneGear twoGear:(NSArray<NSNumber *> *)twoGear; | |||||
/// Set work gear result(设置工作档位结果) | |||||
/// @param result 结果 | |||||
-(void)toothbrushReceiveSetWorkGearResult:(ELSetBluetoothResponseType)result; | |||||
//Call back current working gear information(回调当前工作档位信息) | |||||
-(void)toothbrushReceiveWorkGear:(ToothbrushWorkGear)workGear; | |||||
/// Call back trial results(回调试用结果) | |||||
/// @param result 结果 | |||||
-(void)toothbrushReceiveTryResult:(ToothbrushSetResult)result; | |||||
/// Report work phase(上报工作阶段) | |||||
/// @param workPhase Work stage information(工作阶段信息) | |||||
-(void)toothbrushReceiveWorkPhase:(ToothBrushWorkPhase)workPhase; | |||||
/// Recall the data of manually set gear(回调手动设置档位的数据) | |||||
/// @param custom data(数据) | |||||
-(void)toothbrushReceiveCustomData:(ToothbrushCustomData)custom; | |||||
/// Callback switch toothbrush result(回调开关牙刷结果) | |||||
/// @param result 结果 | |||||
-(void)toothbrushReceiveSwitchResult:(ToothbrushSetResult)result; | |||||
/// Callback three-axis direction(回调三轴方向) | |||||
/// @param direction 方向 | |||||
-(void)toothbrushReceiveTriaxialDirection:(ToothbrushTriaxialDirection)direction; | |||||
/// Recall three-axis data(回调三轴数据) | |||||
/// @param success 是否成功 | |||||
/// @param x x轴数据 | |||||
/// @param y y轴数据 | |||||
/// @param z z轴数据 | |||||
-(void)toothbrushReceiveTriaxialData:(BOOL)success triaxialX:(int)x triaxialY:(int)y triaxialZ:(int)z; | |||||
/// Default value of second gear(二档档位默认值) | |||||
/// @param gear Second gear(二档档位) | |||||
-(void)toothbrushReceiveTwoGearDefault:(ToothbrushGearType)gear; | |||||
/// Set the second gear default gear result(设置二档默认档位结果) | |||||
/// @param result 结果 | |||||
-(void)toothbrushReceiveSettingTwoGearDefaultResult:(ELSetBluetoothResponseType)result; | |||||
/// Call back brushing data(回调刷牙数据) | |||||
/// @param data 刷牙数据 | |||||
-(void)toothbrushtReceiveToothbrushData:(ToothbrushData)data; | |||||
@end | |||||
@interface ELToothbrushBleManager : ELBluetoothManager | |||||
//Current working mode(当前工作模式) | |||||
@property (nonatomic, assign) ToothbrushGearType currentMode; | |||||
//Current default working hours(当前默认工作时长) | |||||
@property (nonatomic, assign) NSInteger currentWorkTime; | |||||
//Current gear(当前档位) | |||||
@property (nonatomic, assign) ToothSupportGearType currentGear; | |||||
@property (nonatomic, weak) id<ToothbrushDelegate> toothbrushDelegate; | |||||
+(instancetype)shareManager; | |||||
//Get supported gear(获取支持的档位) | |||||
-(void)getGear; | |||||
/// Set brushing mode(设置刷牙模式) | |||||
/// @param gearType Brushing mode(刷牙模式) | |||||
/// @param interval Brushing time (0: do not modify the working time, before keeping)(刷牙时间(0:不修改工作时长,保留之前)) | |||||
/// @param supportType Which gear is it(是哪个档位) | |||||
-(void)setWorkGear:(ToothbrushGearType)gearType interval:(int)interval supportGearType:(ToothSupportGearType)supportType; | |||||
/// Get the current working gear(获取当前工作的档位) | |||||
-(void)getWorkGear; | |||||
/// try out(试用) | |||||
/// @param gear Gear (ToothbrushGearTypeStop means stop trial)(档位(ToothbrushGearTypeStop 表示停止试用)) | |||||
/// @param supportType Which gear(第几档) | |||||
/// @param frequency 频率 | |||||
/// @param duty 占空比 | |||||
-(void)tryGear:(ToothbrushGearType)gear supportType:(ToothSupportGearType)supportType frequency:(int)frequency duty:(int)duty; | |||||
/// Get the current work stage(获取当前工作阶段) | |||||
-(void)getWorkPhase; | |||||
/// Set manual setting gear(设置手动设置档位) | |||||
/// @param frequency 频率 | |||||
/// @param duty 占空比 | |||||
/// @param interval 时间 | |||||
-(void)setCustomGearData:(int)frequency duty:(int)duty interval:(int)interval; | |||||
/// Get manual profile data(获取手动设置档数据) | |||||
-(void)getCustomGear; | |||||
/// Switch toothbrush(开关牙刷) | |||||
-(void)switchToothbrush; | |||||
//Get three axis direction(获取三轴方向) | |||||
-(void)getTriaxialDirection; | |||||
//Get three-axis data(获取三轴数据) | |||||
-(void)getTriaxialData; | |||||
//Set the second gear default gear(设置二档默认档位) | |||||
-(void)setTwoGearDefaultGear:(ToothbrushGearType)gear; | |||||
//Get the second gear default gear(获取二档默认档位) | |||||
-(void)getTwoGearDefualt; | |||||
//Report the results of receiving brushing data(上报刷牙数据接收结果) | |||||
-(void)reportReceiveResultOfToothbrushData:(BOOL)result; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELToothburshHeader.h | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2020/5/11. | |||||
// Copyright © 2020 iot_iMac. All rights reserved. | |||||
// | |||||
#ifndef ELToothburshHeader_h | |||||
#define ELToothburshHeader_h | |||||
#import "ELSDKHeader.h" | |||||
typedef NS_ENUM(NSUInteger, ToothSupportGearType) { | |||||
ToothSupportGearTypeUnknown = 0x00, //Unsupported gear(不支持的档位) | |||||
ToothSupportGearTypeOneGear = 0x01, //First gear(一档) | |||||
ToothSupportGearTypeTwoGear = 0x02, //Second gear(二档) | |||||
}; | |||||
//Working gear(工作档位) | |||||
typedef NS_ENUM(NSUInteger, ToothbrushGearType) { | |||||
ToothbrushGearTypeStop = 0x00, //Stop the motor(停止电机) | |||||
ToothbrushGearTypeClean = 0x01, //clean(清洁) | |||||
ToothbrushGearTypeWhite = 0x02, //Whitening(美白) | |||||
ToothbrushGearTypeMassage = 0x03, //massage(按摩) | |||||
ToothbrushGearTypeSenstitive = 0x04, //sensitive(敏感) | |||||
ToothbrushGearTypePolish = 0x05, //polishing(抛光) | |||||
ToothbrushGearTypeGumCare = 0x06, //Gum care(牙龈护理) | |||||
ToothbrushGearTypeRefresh = 0x07, //gargle(漱口) | |||||
ToothbrushGearTypeMascare = 0x08, //health care(保健) | |||||
ToothbrushGearTypeNewbie = 0x09, //Novice(新手) | |||||
ToothbrushGearTypeSoft = 0x0A, //Shurou(舒柔) | |||||
ToothbrushGearTypeGentle = 0x0B, //gentle(轻柔) | |||||
ToothbrushGearTypePamper = 0x0C, //Care(呵护) | |||||
ToothbrushGearTypeCustom = 0xFF, //manual setting(手动设置) | |||||
}; | |||||
typedef NS_ENUM(NSUInteger, ToothbrushDataType) { | |||||
ToothbrushDataTypeSetGear = 0x02,//Set gear(设置档位) | |||||
ToothbrushDataTypeGetGear = 0x03,//Get the current working gear(获取当前工作的档位) | |||||
ToothbrushDataTypeTry = 0x06,//try out(试用) | |||||
ToothbrushDataTypeWorkPhase = 0x07,//Work Phase(工作阶段) | |||||
ToothbrushDataTypeSetCustomData = 0x09,//Set manual setting mode(设置手动设置模式) | |||||
ToothbrushDataTypeGetCustomGear = 0x0A,//Get manually set data(获取手动设置的数据) | |||||
ToothbrushDataTypeSwitchWork = 0x0B,//Switch toothbrush(开关牙刷) | |||||
ToothbrushDataTypeSetTwoGearDefault = 0x0C,//Set second gear default(设置二档默认) | |||||
ToothbrushDataTypeGetTwoGearDefault = 0x0D,//Get second gear default(获取二档默认) | |||||
ToothbrushDataTypeToothbrushData = 0xFD,//Brushing data(刷牙数据) | |||||
ToothbrushDataTypeReportResult = 0xFE,//Report received data result(上报接收数据结果) | |||||
}; | |||||
typedef NS_ENUM(NSUInteger, ToothbrushA6DataType) { | |||||
ToothbrushA6DataTypeTriaxialDirection = 0x02, //Get the three-axis direction of the toothbrush(获取牙刷三轴方向) | |||||
ToothbrushA6DataTypeTriaxialData = 0x05, //Get toothbrush three-axis data(获取牙刷三轴数据) | |||||
}; | |||||
typedef NS_ENUM(NSUInteger, ToothbrushSetResult) { | |||||
ToothbrushSetResultSuccess,//Set successfully(设置成功) | |||||
ToothbrushSetResultFail,//Setting failed for unknown reason(设置失败,原因未知) | |||||
ToothbrushSetResultUnsupport,//Does not support settings(不支持设置) | |||||
ToothbrushSetResultLowPower,//Setting failed, battery voltage is low(设置失败,电池电压不足) | |||||
ToothbrushSetResultCharging,//Setting failed, charging(设置失败,正在充电) | |||||
ToothbrushSetResultWorking,//Setting failed, working(设置失败,正在工作) | |||||
}; | |||||
//Work Phase(工作阶段) | |||||
typedef NS_ENUM(NSUInteger, ToothbrushWorkPhaseType) { | |||||
ToothbrushWorkPhaseTypeLeftTop, | |||||
ToothbrushWorkPhaseTypeLeftBottom, | |||||
ToothbrushWorkPhaseTypeRightTop, | |||||
ToothbrushWorkPhaseTypeRightBottom | |||||
}; | |||||
//Y axis direction(Y轴方向) | |||||
typedef NS_ENUM(NSUInteger, ToothbrushTriaxialDirection) { | |||||
ToothbrushTriaxialDirectionYTop = 1,//Y axis up(Y轴朝上) | |||||
ToothbrushTriaxialDirectionYBottom = 2,//Y axis down(Y轴朝下) | |||||
ToothbrushTriaxialDirectionYLeft = 3,//Y axis left(Y轴朝左) | |||||
ToothbrushTriaxialDirectionYRight = 4,//Y axis right(Y轴朝右) | |||||
}; | |||||
typedef struct{ | |||||
int interval;//operating hours(工作时间) | |||||
ToothbrushGearType gearType;//Gear(档位) | |||||
ToothSupportGearType supportType;//What Gear(什么档) | |||||
}ToothbrushWorkGear,ToothbrushWorkGear; | |||||
typedef struct{ | |||||
ToothbrushGearType gear; | |||||
ToothSupportGearType supportType;//一档、二档 | |||||
ToothbrushWorkPhaseType workPhase; | |||||
}ToothBrushWorkPhase,ToothBrushWorkPhase; | |||||
// | |||||
typedef struct{ | |||||
int frequency; | |||||
int duty; | |||||
int interval; | |||||
}ToothbrushCustomData,ToothbrushCustomData; | |||||
//Brushing data(刷牙数据) | |||||
typedef struct{ | |||||
ToothbrushGearType gear;//Working gear(工作档位) | |||||
int workTime;//work time(工作时长) | |||||
int leftTime;//Time left(左边时长) | |||||
int rightTime;//Right time(右边时长) | |||||
int battery;//battery(电量) | |||||
}ToothbrushData,ToothbrushData; | |||||
#endif /* ELToothburshHeader_h */ |
</data> | </data> | ||||
<key>Headers/ELBodyFatScaleBleHeader.h</key> | <key>Headers/ELBodyFatScaleBleHeader.h</key> | ||||
<data> | <data> | ||||
0b9mGDuee7WiIQE4CW0ADfbEL1s= | |||||
d9CouBwRoqMKUrT+iiS0UztzPo4= | |||||
</data> | </data> | ||||
<key>Headers/ELBodyFatScaleBleManager.h</key> | <key>Headers/ELBodyFatScaleBleManager.h</key> | ||||
<data> | <data> | ||||
k+OxOANxEznDe5jW76CiJ9hdU7k= | |||||
aOe/Psooxp0TUxRdLYUmY7I7VrA= | |||||
</data> | </data> | ||||
<key>Headers/ELBodyFatScaleBleUserModel.h</key> | <key>Headers/ELBodyFatScaleBleUserModel.h</key> | ||||
<data> | <data> | ||||
<data> | <data> | ||||
Oa8GTYS1hEhJk+BQL1IiR2T3eSw= | Oa8GTYS1hEhJk+BQL1IiR2T3eSw= | ||||
</data> | </data> | ||||
<key>Headers/ELToothbrushBleManager.h</key> | |||||
<data> | |||||
TgXiM9WWYyDwMboD7z+CRuTnCbI= | |||||
</data> | |||||
<key>Headers/ELToothburshHeader.h</key> | |||||
<data> | |||||
QHN/+6s7uaNjGtbsXs91q11T2aM= | |||||
</data> | |||||
<key>Headers/ELUnitConvertTool.h</key> | <key>Headers/ELUnitConvertTool.h</key> | ||||
<data> | <data> | ||||
KUvTJzAj6UgO0TVIag6jroPEZ9g= | KUvTJzAj6UgO0TVIag6jroPEZ9g= | ||||
<dict> | <dict> | ||||
<key>hash</key> | <key>hash</key> | ||||
<data> | <data> | ||||
0b9mGDuee7WiIQE4CW0ADfbEL1s= | |||||
d9CouBwRoqMKUrT+iiS0UztzPo4= | |||||
</data> | </data> | ||||
<key>hash2</key> | <key>hash2</key> | ||||
<data> | <data> | ||||
2py6JfIiYKS46qwDo7/27T0rqmu7YbHa+fqUBdvhth0= | |||||
pKjb8UqI7IWcu3tjnBMSvE5QrbjyydIEe/CiN7dzs+g= | |||||
</data> | </data> | ||||
</dict> | </dict> | ||||
<key>Headers/ELBodyFatScaleBleManager.h</key> | <key>Headers/ELBodyFatScaleBleManager.h</key> | ||||
<dict> | <dict> | ||||
<key>hash</key> | <key>hash</key> | ||||
<data> | <data> | ||||
k+OxOANxEznDe5jW76CiJ9hdU7k= | |||||
aOe/Psooxp0TUxRdLYUmY7I7VrA= | |||||
</data> | </data> | ||||
<key>hash2</key> | <key>hash2</key> | ||||
<data> | <data> | ||||
v1HPAh30uLZy9KqJxyWSvifOrjCBTDPNRYKsM/kDPw4= | |||||
yP0Y2J8Opesx6PnzjJRowY6jVqShxqay2AO3JlakpkY= | |||||
</data> | </data> | ||||
</dict> | </dict> | ||||
<key>Headers/ELBodyFatScaleBleUserModel.h</key> | <key>Headers/ELBodyFatScaleBleUserModel.h</key> | ||||
gSjca3FLXifg5U5v47xNQpOf4dgQ0ib6CwitQPp1Hbs= | gSjca3FLXifg5U5v47xNQpOf4dgQ0ib6CwitQPp1Hbs= | ||||
</data> | </data> | ||||
</dict> | </dict> | ||||
<key>Headers/ELToothbrushBleManager.h</key> | |||||
<dict> | |||||
<key>hash</key> | |||||
<data> | |||||
TgXiM9WWYyDwMboD7z+CRuTnCbI= | |||||
</data> | |||||
<key>hash2</key> | |||||
<data> | |||||
vrkXk3mi2klykCre31uYLq5HA1JeBiyWR5dguDpSOpg= | |||||
</data> | |||||
</dict> | |||||
<key>Headers/ELToothburshHeader.h</key> | |||||
<dict> | |||||
<key>hash</key> | |||||
<data> | |||||
QHN/+6s7uaNjGtbsXs91q11T2aM= | |||||
</data> | |||||
<key>hash2</key> | |||||
<data> | |||||
0ASrA6x/0Oawl6R0Sa+RejPtC7W1JoYM7YxK6cvZdDI= | |||||
</data> | |||||
</dict> | |||||
<key>Headers/ELUnitConvertTool.h</key> | <key>Headers/ELUnitConvertTool.h</key> | ||||
<dict> | <dict> | ||||
<key>hash</key> | <key>hash</key> |
<key>CFBundlePackageType</key> | <key>CFBundlePackageType</key> | ||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||||
<key>CFBundleShortVersionString</key> | <key>CFBundleShortVersionString</key> | ||||
<string>1.0</string> | |||||
<string>$(MARKETING_VERSION)</string> | |||||
<key>CFBundleVersion</key> | <key>CFBundleVersion</key> | ||||
<string>1</string> | |||||
<string>$(CURRENT_PROJECT_VERSION)</string> | |||||
<key>LSRequiresIPhoneOS</key> | <key>LSRequiresIPhoneOS</key> | ||||
<true/> | <true/> | ||||
<key>NSBluetoothAlwaysUsageDescription</key> | |||||
<string></string> | |||||
<key>UIApplicationSceneManifest</key> | <key>UIApplicationSceneManifest</key> | ||||
<dict> | <dict> | ||||
<key>UIApplicationSupportsMultipleScenes</key> | <key>UIApplicationSupportsMultipleScenes</key> | ||||
<string>UIInterfaceOrientationLandscapeLeft</string> | <string>UIInterfaceOrientationLandscapeLeft</string> | ||||
<string>UIInterfaceOrientationLandscapeRight</string> | <string>UIInterfaceOrientationLandscapeRight</string> | ||||
</array> | </array> | ||||
<key>NSBluetoothAlwaysUsageDescription</key> | |||||
<string></string> | |||||
</dict> | </dict> | ||||
</plist> | </plist> |
#import "BodyFatScaleScanViewController.h" | #import "BodyFatScaleScanViewController.h" | ||||
#import "BroadcastScaleViewController.h" | #import "BroadcastScaleViewController.h" | ||||
#import "EightScaleScanViewController.h" | #import "EightScaleScanViewController.h" | ||||
#import "ToothbrushScanViewController.h" | |||||
@interface ViewController ()<UITableViewDelegate,UITableViewDataSource> | @interface ViewController ()<UITableViewDelegate,UITableViewDataSource> | ||||
- (void)viewDidLoad { | - (void)viewDidLoad { | ||||
[super viewDidLoad]; | [super viewDidLoad]; | ||||
self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤",@"集成广播秤",@"八电极体脂秤"]; | |||||
self.datas = @[@"自己写协议走透传",@"有AILink协议自己解析数据",@"集成婴儿秤",@"集成血压计",@"集成身高仪",@"集成遥控器",@"集成额温枪",@"集成温度计",@"集成胎压监测",@"集成体脂秤",@"集成广播秤",@"八电极体脂秤",@"蓝牙WiFi牙刷"]; | |||||
[self.view addSubview:self.tableView]; | [self.view addSubview:self.tableView]; | ||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | ||||
make.top.left.right.bottom.mas_equalTo(0); | make.top.left.right.bottom.mas_equalTo(0); | ||||
EightScaleScanViewController *vc = [[EightScaleScanViewController alloc] init]; | EightScaleScanViewController *vc = [[EightScaleScanViewController alloc] init]; | ||||
vc.title = self.datas[indexPath.row]; | vc.title = self.datas[indexPath.row]; | ||||
[self.navigationController pushViewController:vc animated:YES]; | [self.navigationController pushViewController:vc animated:YES]; | ||||
}else if (indexPath.row == 12){ | |||||
ToothbrushScanViewController *vc = [[ToothbrushScanViewController alloc] init]; | |||||
vc.title = self.datas[indexPath.row]; | |||||
[self.navigationController pushViewController:vc animated:YES]; | |||||
} | } | ||||
} | } |
// | |||||
// CABasicAnimation+ELAnimation.h | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2019/1/23. | |||||
// Copyright © 2019年 iot_iMac. All rights reserved. | |||||
// | |||||
#import <QuartzCore/QuartzCore.h> | |||||
#define ELAnimationDuration 0.2 | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface CABasicAnimation (ELAnimation) | |||||
//缩放动画show | |||||
+(CABasicAnimation *)scaleShowAnimationWithDuration:(CGFloat)duration; | |||||
//缩放动画hide | |||||
+(CABasicAnimation *)scaleHideAnimationWithDuration:(CGFloat)duration; | |||||
//平移动画 | |||||
+(CABasicAnimation *)positionAnimationWithBeginPoint:(CGPoint)beginPoint withEndPoint:(CGPoint)endPoint; | |||||
//旋转旋转动画 | |||||
+(CABasicAnimation *)rotationAnimationWithBeginValue:(CGFloat)beginValue endValue:(CGFloat)endValue; | |||||
+(CABasicAnimation *)alphaAnimation; | |||||
+(CABasicAnimation *)heightAnimation; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// CABasicAnimation+ELAnimation.m | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2019/1/23. | |||||
// Copyright © 2019年 iot_iMac. All rights reserved. | |||||
// | |||||
#import "CABasicAnimation+ELAnimation.h" | |||||
#import <UIKit/UIKit.h> | |||||
@implementation CABasicAnimation (ELAnimation) | |||||
// | |||||
+(CABasicAnimation *)scaleShowAnimationWithDuration:(CGFloat)duration{ | |||||
CABasicAnimation * animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; | |||||
animation.fromValue = [NSNumber numberWithInteger:0.0]; | |||||
animation.toValue = [NSNumber numberWithInteger:1.0]; | |||||
animation.duration = duration; | |||||
animation.removedOnCompletion = NO; | |||||
animation.fillMode = kCAFillModeForwards; | |||||
return animation; | |||||
} | |||||
+(CABasicAnimation *)scaleHideAnimationWithDuration:(CGFloat)duration{ | |||||
CABasicAnimation * animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; | |||||
animation.fromValue = [NSNumber numberWithInteger:1.0]; | |||||
animation.toValue = [NSNumber numberWithInteger:0.0]; | |||||
animation.duration = duration; | |||||
animation.removedOnCompletion = NO; | |||||
animation.fillMode = kCAFillModeForwards; | |||||
return animation; | |||||
} | |||||
+(CABasicAnimation *)positionAnimationWithBeginPoint:(CGPoint)beginPoint withEndPoint:(CGPoint)endPoint{ | |||||
CABasicAnimation * position =[CABasicAnimation animationWithKeyPath:@"position"]; | |||||
position.fromValue = [NSValue valueWithCGPoint:beginPoint]; | |||||
position.toValue = [NSValue valueWithCGPoint:endPoint]; | |||||
position.duration = ELAnimationDuration; | |||||
position.removedOnCompletion = NO; | |||||
position.fillMode = kCAFillModeForwards; | |||||
position.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; | |||||
return position; | |||||
} | |||||
+(CABasicAnimation *)rotationAnimationWithBeginValue:(CGFloat)beginValue endValue:(CGFloat)endValue{ | |||||
CABasicAnimation *aniamtion = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | |||||
aniamtion.fromValue = [NSNumber numberWithFloat:beginValue]; | |||||
aniamtion.toValue = [NSNumber numberWithFloat:endValue]; | |||||
aniamtion.duration = ELAnimationDuration; | |||||
aniamtion.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; | |||||
aniamtion.repeatCount = 1; | |||||
aniamtion.fillMode = kCAFillModeForwards; | |||||
aniamtion.removedOnCompletion = NO; | |||||
return aniamtion; | |||||
} | |||||
+(CABasicAnimation *)alphaAnimation{ | |||||
CABasicAnimation *aniamtion = [CABasicAnimation animationWithKeyPath:@"opacity"]; | |||||
aniamtion.fromValue = @1; | |||||
aniamtion.toValue = @0.3; | |||||
aniamtion.duration = ELAnimationDuration; | |||||
aniamtion.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; | |||||
aniamtion.fillMode = kCAFillModeForwards; | |||||
aniamtion.repeatCount = INFINITY; | |||||
aniamtion.removedOnCompletion = YES; | |||||
return aniamtion; | |||||
} | |||||
+(CABasicAnimation *)heightAnimation{ | |||||
CABasicAnimation *aniamtion = [CABasicAnimation animationWithKeyPath:@"scale.y"]; | |||||
aniamtion.fromValue = @0; | |||||
aniamtion.toValue = @1; | |||||
aniamtion.duration = ELAnimationDuration; | |||||
aniamtion.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; | |||||
aniamtion.fillMode = kCAFillModeForwards; | |||||
aniamtion.removedOnCompletion = NO; | |||||
return aniamtion; | |||||
} | |||||
@end |
// | |||||
// ELInputAlertView.h | |||||
// 自定义tabbar | |||||
// | |||||
// Created by iot_user on 2019/1/19. | |||||
// Copyright © 2019年 IOT. All rights reserved. | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELInputAlertView : UIView | |||||
@property (nonatomic, strong) UIColor *topBtnBackColor; | |||||
//自动隐藏 | |||||
@property (nonatomic, assign) BOOL leftAutoHide;//default:YES | |||||
@property (nonatomic, assign) BOOL rightAutoHide;//default:NO | |||||
@property (nonatomic, assign) BOOL first;// | |||||
// | |||||
@property (nonatomic, copy) void(^leftBlock)(NSString * text); | |||||
@property (nonatomic, copy) void(^rightBlock)(NSString * text); | |||||
@property (nonatomic, copy) BOOL(^leftHideBlock)(NSString * text, UIView *view); | |||||
@property (nonatomic, copy) BOOL(^rightHideBlock)(NSString * text, UIView *view); | |||||
-(instancetype)initWithTittle:(NSString *)title withText:(NSString *)text withMessage:(NSString *)placeholder withLeftButton:(NSString *)leftTitle withRightButton:(NSString *)rightTitle; | |||||
-(void)show; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELInputAlertView.m | |||||
// 自定义tabbar | |||||
// | |||||
// Created by iot_user on 2019/1/19. | |||||
// Copyright © 2019年 IOT. All rights reserved. | |||||
// | |||||
#import "ELInputAlertView.h" | |||||
#import "CABasicAnimation+ELAnimation.h" | |||||
#import "UIView+Category.h" | |||||
#import "Masonry.h" | |||||
//字符串是否为空 | |||||
//#define IsEmptyStr(str) [NSString isEmptyString:str] | |||||
//375x667的屏幕 | |||||
#define ScreenHeight [UIScreen mainScreen].bounds.size.height | |||||
#define ScreenWeight [UIScreen mainScreen].bounds.size.width | |||||
// | |||||
//#define SW(w) ScreenWeight*(w/375.0) | |||||
//#define SH(h) ScreenHeight*(h/667.0) | |||||
#define AlertWidth 285 | |||||
#define AlertHeight 285 | |||||
#define ButtonHeight 45 | |||||
#define ButtonEdge 25 | |||||
@interface ELInputAlertView() | |||||
@property (nonatomic, strong) UIView * alertView; | |||||
@property (nonatomic, strong) UITextField * inputTF; | |||||
@property (nonatomic, strong) UIButton *topBtn; | |||||
@property (nonatomic, strong) UIButton *bottomBtn; | |||||
@end | |||||
@implementation ELInputAlertView | |||||
-(UITextField *)inputTF{ | |||||
if (_inputTF == nil) { | |||||
_inputTF = [[UITextField alloc]init]; | |||||
_inputTF.textColor = [UIColor blackColor]; | |||||
_inputTF.font = [UIFont systemFontOfSize:18]; | |||||
_inputTF.clearButtonMode = UITextFieldViewModeWhileEditing; | |||||
// _inputTF.layer.borderColor = EL242GrayColor.CGColor; | |||||
// _inputTF.layer.borderWidth = 1.0f; | |||||
// | |||||
UIView *leftView = [[UIView alloc]init]; | |||||
leftView.frame = CGRectMake(0, 0, 5, 5); | |||||
_inputTF.leftView = leftView; | |||||
_inputTF.leftViewMode = UITextFieldViewModeAlways; | |||||
} | |||||
return _inputTF; | |||||
} | |||||
-(instancetype)initWithTittle:(NSString *)title withText:(NSString *)text withMessage:(NSString *)placeholder withLeftButton:(NSString *)leftTitle withRightButton:(NSString *)rightTitle{ | |||||
if (self = [super init]) { | |||||
self.frame = [UIScreen mainScreen].bounds; | |||||
self.leftAutoHide = YES; | |||||
self.rightAutoHide = NO; | |||||
// | |||||
UIView * backgrand = [[UIView alloc]init]; | |||||
backgrand.backgroundColor = [UIColor blackColor]; | |||||
backgrand.alpha = 0.5; | |||||
backgrand.frame = self.frame; | |||||
[self addSubview:backgrand]; | |||||
// | |||||
UIView * alertView = [[UIView alloc]init]; | |||||
self.alertView = alertView; | |||||
alertView.frame = CGRectMake((ScreenWeight-AlertWidth)/2, (ScreenHeight - AlertHeight)/2, AlertWidth, AlertHeight); | |||||
alertView.backgroundColor = [UIColor whiteColor]; | |||||
[self addSubview:alertView]; | |||||
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:alertView.bounds byRoundingCorners:(UIRectCornerAllCorners) cornerRadii:CGSizeMake(5, 5)]; | |||||
CAShapeLayer * layer = [CAShapeLayer layer]; | |||||
layer.frame = alertView.bounds; | |||||
layer.path = path.CGPath; | |||||
alertView.layer.mask = layer; | |||||
//标题 | |||||
UILabel * titleLbl = [[UILabel alloc]init]; | |||||
titleLbl.text = title; | |||||
titleLbl.textColor = [UIColor blackColor]; | |||||
titleLbl.font = [UIFont systemFontOfSize:16]; | |||||
titleLbl.textAlignment = NSTextAlignmentCenter; | |||||
titleLbl.frame = CGRectMake(10, 10, alertView.frame.size.width-20, 25); | |||||
[alertView addSubview:titleLbl]; | |||||
//输入框 | |||||
// if (IsEmptyStr(placeholder)) { | |||||
// placeholder = @""; | |||||
// } | |||||
self.inputTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:placeholder attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18],NSForegroundColorAttributeName:[UIColor lightGrayColor]}]; | |||||
self.inputTF.text = text; | |||||
[self.inputTF becomeFirstResponder]; | |||||
self.inputTF.frame = CGRectMake(10, CGRectGetMaxY(titleLbl.frame)+55, alertView.frame.size.width-20, 40); | |||||
[alertView addSubview:self.inputTF]; | |||||
// | |||||
UIView *lineView = [[UIView alloc] init]; | |||||
lineView.backgroundColor = [UIColor blackColor]; | |||||
[alertView addSubview:lineView]; | |||||
[lineView mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.mas_equalTo(15); | |||||
make.right.mas_equalTo(-15); | |||||
make.top.equalTo(self.inputTF.mas_bottom).mas_offset(5); | |||||
make.height.mas_equalTo(1); | |||||
}]; | |||||
//下边按钮 | |||||
UIButton * leftButton = [UIButton buttonWithType:(UIButtonTypeCustom)]; | |||||
self.bottomBtn = leftButton; | |||||
[leftButton setTitle:leftTitle forState:(UIControlStateNormal)]; | |||||
[leftButton setTitleColor:[UIColor redColor] forState:(UIControlStateNormal)]; | |||||
[leftButton setTitleColor:[UIColor grayColor] forState:(UIControlStateHighlighted)]; | |||||
leftButton.titleLabel.font = [UIFont systemFontOfSize:18]; | |||||
leftButton.frame = CGRectMake(ButtonEdge, alertView.frame.size.height-ButtonHeight-5, alertView.frame.size.width-ButtonEdge*2, ButtonHeight); | |||||
[alertView addSubview:leftButton]; | |||||
[leftButton addTarget:self action:@selector(leftAction:) forControlEvents:(UIControlEventTouchUpInside)]; | |||||
//上边按钮 | |||||
UIButton * rightButton = [UIButton buttonWithType:(UIButtonTypeCustom)]; | |||||
self.topBtn = rightButton; | |||||
[rightButton setTitle:rightTitle forState:(UIControlStateNormal)]; | |||||
[rightButton setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; | |||||
[rightButton setTitleColor:[UIColor grayColor] forState:(UIControlStateHighlighted)]; | |||||
rightButton.titleLabel.font = [UIFont systemFontOfSize:18]; | |||||
rightButton.frame = CGRectMake(ButtonEdge, alertView.frame.size.height-ButtonHeight*2-10, alertView.frame.size.width-ButtonEdge*2, ButtonHeight); | |||||
[alertView addSubview:rightButton]; | |||||
rightButton.backgroundColor = [UIColor blueColor]; | |||||
[rightButton addTarget:self action:@selector(rightAction:) forControlEvents:(UIControlEventTouchUpInside)]; | |||||
[rightButton setCornerRadii:CGSizeMake(ButtonHeight/2, ButtonHeight/2) withCorner:(UIRectCornerAllCorners)]; | |||||
// //竖线 | |||||
// UIView *sxLine = [[UIView alloc]init]; | |||||
// sxLine.frame = CGRectMake(alertView.frame.size.width/2, alertView.frame.size.height-ButtonHeight, 1, ButtonHeight); | |||||
// sxLine.backgroundColor = EL242GrayColor; | |||||
// [alertView addSubview:sxLine]; | |||||
// //横线 | |||||
// UIView * hxLine = [[UIView alloc]init]; | |||||
// hxLine.backgroundColor = EL242GrayColor; | |||||
// hxLine.frame = CGRectMake(0, alertView.frame.size.height-ButtonHeight, alertView.frame.size.width, 1); | |||||
// [alertView addSubview:hxLine]; | |||||
// | |||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; | |||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; | |||||
} | |||||
return self; | |||||
} | |||||
-(void)setTopBtnBackColor:(UIColor *)topBtnBackColor{ | |||||
_topBtnBackColor = topBtnBackColor; | |||||
self.topBtn.backgroundColor = topBtnBackColor; | |||||
} | |||||
-(void)keyboardWillShow:(NSNotification *)noti{ | |||||
CGRect frame = [[[noti userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue]; | |||||
CGRect alertFrame = self.alertView.frame; | |||||
alertFrame.origin.y = ScreenHeight - frame.size.height - AlertHeight - 10>0?ScreenHeight - frame.size.height - AlertHeight - 10:0; | |||||
self.alertView.frame = alertFrame; | |||||
} | |||||
-(void)keyboardWillHide:(NSNotification *)noti{ | |||||
CGRect alertFrame = self.alertView.frame; | |||||
alertFrame.origin.y = (ScreenHeight - AlertHeight)/2; | |||||
self.alertView.frame = alertFrame; | |||||
} | |||||
-(void)leftAction:(UIButton *)sender{ | |||||
if (self.leftBlock) { | |||||
self.leftBlock(self.inputTF.text); | |||||
[self hide]; | |||||
[self.inputTF resignFirstResponder]; | |||||
} | |||||
if (self.leftHideBlock) { | |||||
BOOL hide = self.leftHideBlock(self.inputTF.text, self); | |||||
if (hide == YES) { | |||||
[self hide]; | |||||
[self.inputTF resignFirstResponder]; | |||||
} | |||||
} | |||||
if (self.leftAutoHide) { | |||||
[self hide]; | |||||
[self.inputTF resignFirstResponder]; | |||||
} | |||||
} | |||||
-(void)rightAction:(UIButton *)sender{ | |||||
if (self.rightBlock) { | |||||
self.rightBlock(self.inputTF.text); | |||||
[self hide]; | |||||
[self.inputTF resignFirstResponder]; | |||||
} | |||||
if (self.rightHideBlock) { | |||||
BOOL hide = self.rightHideBlock(self.inputTF.text, self); | |||||
if (hide == YES) { | |||||
[self.inputTF resignFirstResponder]; | |||||
[self hide]; | |||||
} | |||||
} | |||||
if (self.rightAutoHide) { | |||||
[self.inputTF resignFirstResponder]; | |||||
[self hide]; | |||||
} | |||||
} | |||||
-(void)show{ | |||||
UIWindow * window = [UIApplication sharedApplication].windows.firstObject; | |||||
[window addSubview:self]; | |||||
[self.alertView.layer addAnimation:[CABasicAnimation scaleShowAnimationWithDuration:ELAnimationDuration] forKey:@"ELInputAlertViewShowAnimation"]; | |||||
} | |||||
-(void)hide{ | |||||
[self.alertView.layer addAnimation:[CABasicAnimation scaleHideAnimationWithDuration:ELAnimationDuration] forKey:@"ELInputAlertViewHideAnimation"]; | |||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(ELAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||||
[self removeFromSuperview]; | |||||
}); | |||||
} | |||||
@end |
// | |||||
// ELSelectView.h | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2019/1/23. | |||||
// Copyright © 2019年 iot_iMac. All rights reserved. | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ELSelectViewCell : UITableViewCell | |||||
@property (nonatomic, strong) UILabel *titleLbl; | |||||
@end | |||||
@interface ELSelectView : UIView | |||||
@property (nonatomic, copy) void (^selectRowBlock)(NSInteger row); | |||||
-(instancetype)initWithTitle:(NSString *)title withSelectArray:(NSArray<NSString *> *)array; | |||||
-(void)show; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ELSelectView.m | |||||
// Elink | |||||
// | |||||
// Created by iot_user on 2019/1/23. | |||||
// Copyright © 2019年 iot_iMac. All rights reserved. | |||||
// | |||||
#import "ELSelectView.h" | |||||
#import "CABasicAnimation+ELAnimation.h" | |||||
#import "UILabel+WZAdd.h" | |||||
#import "Masonry.h" | |||||
#import "UIButton+WZAdd.h" | |||||
#import "AppDelegate.h" | |||||
//375x667的屏幕 | |||||
#define ScreenH [UIScreen mainScreen].bounds.size.height | |||||
#define ScreenW [UIScreen mainScreen].bounds.size.width | |||||
#define MaxHeight ScreenH/2 | |||||
#define MaxWeight 250 | |||||
#define CellHeight 45 | |||||
@implementation ELSelectViewCell | |||||
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ | |||||
if (self = [super initWithStyle:style | |||||
reuseIdentifier:reuseIdentifier]) { | |||||
self.titleLbl = [UILabel createWithFrame:CGRectZero bgColor:[UIColor whiteColor] text:nil textColor:[UIColor grayColor] font:[UIFont systemFontOfSize:18] align:NSTextAlignmentCenter]; | |||||
self.titleLbl.numberOfLines=0; | |||||
self.titleLbl.adjustsFontSizeToFitWidth = YES; | |||||
[self.contentView addSubview:self.titleLbl]; | |||||
[self.titleLbl mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.top.left.right.bottom.mas_equalTo(0); | |||||
}]; | |||||
self.selectionStyle = UITableViewCellSelectionStyleNone; | |||||
} | |||||
return self; | |||||
} | |||||
@end | |||||
static NSString * ELSelectViewCellid = @"ELSelectViewCellid"; | |||||
@interface ELSelectView()<UITableViewDelegate, UITableViewDataSource> | |||||
@property (nonatomic, strong) UITableView * tableView; | |||||
@property (nonatomic, strong) UIView *alertView; | |||||
@property (nonatomic, copy) NSArray * datas; | |||||
@end | |||||
@implementation ELSelectView | |||||
-(UITableView *)tableView{ | |||||
if (_tableView == nil) { | |||||
_tableView = [[UITableView alloc]init]; | |||||
_tableView.delegate = self; | |||||
_tableView.dataSource = self; | |||||
_tableView.tableFooterView = [UIView new]; | |||||
_tableView.separatorColor = [UIColor clearColor]; | |||||
} | |||||
return _tableView; | |||||
} | |||||
-(instancetype)initWithTitle:(NSString *)title withSelectArray:(NSArray<NSString *> *)array{ | |||||
if (self = [super init]) { | |||||
self.frame = [UIScreen mainScreen].bounds; | |||||
self.datas = [array copy]; | |||||
// | |||||
UIView * backgrand = [[UIView alloc]init]; | |||||
backgrand.backgroundColor = [UIColor blackColor]; | |||||
backgrand.alpha = 0.5; | |||||
backgrand.frame = self.frame; | |||||
[self addSubview:backgrand]; | |||||
// | |||||
CGFloat height = (array.count+1)*CellHeight; | |||||
height = (height > MaxHeight?MaxHeight:height)+33; | |||||
//TopMargin | |||||
UIView * alertView = [[UIView alloc]init]; | |||||
self.alertView = alertView; | |||||
alertView.frame = CGRectMake((ScreenW-MaxWeight)/2,(ScreenH-height)/2, MaxWeight, height); | |||||
alertView.backgroundColor = [UIColor whiteColor]; | |||||
// alertView.layer.cornerRadius = 5; | |||||
[self addSubview:alertView]; | |||||
// | |||||
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:alertView.bounds byRoundingCorners:(UIRectCornerAllCorners) cornerRadii:CGSizeMake(5, 5)]; | |||||
CAShapeLayer * layer = [CAShapeLayer layer]; | |||||
layer.frame = alertView.bounds; | |||||
layer.path = path.CGPath; | |||||
alertView.layer.mask = layer; | |||||
// | |||||
UILabel * titleLbl = [UILabel createWithFrame:CGRectZero bgColor:[UIColor whiteColor] text:title textColor:[UIColor lightGrayColor] font:[UIFont systemFontOfSize:15] align:NSTextAlignmentCenter]; | |||||
[alertView addSubview:titleLbl]; | |||||
[titleLbl mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.top.left.right.mas_equalTo(0); | |||||
make.height.mas_equalTo(33); | |||||
}]; | |||||
// | |||||
UIButton * cancelBtn = [UIButton createWithFrame:CGRectZero bgColor:[UIColor whiteColor] font:[UIFont systemFontOfSize:16] norTitle:@"取消" norTitleColor:[UIColor lightGrayColor] norImage:nil borderColor:nil needRoundCorner:NO target:self action:@selector(cancelAction:)]; | |||||
[cancelBtn setTitleColor:[UIColor redColor] forState:(UIControlStateHighlighted)]; | |||||
[alertView addSubview:cancelBtn]; | |||||
[cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.bottom.left.right.mas_equalTo(0); | |||||
make.height.mas_equalTo(CellHeight); | |||||
}]; | |||||
// | |||||
[alertView addSubview:self.tableView]; | |||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.right.mas_equalTo(0); | |||||
make.top.equalTo(titleLbl.mas_bottom).mas_offset(0); | |||||
make.bottom.equalTo(cancelBtn.mas_top).mas_equalTo(0); | |||||
}]; | |||||
} | |||||
return self; | |||||
} | |||||
-(void)cancelAction:(UIButton *)sender{ | |||||
[self hide]; | |||||
} | |||||
-(void)show{ | |||||
UIWindow * window = [UIApplication sharedApplication].windows.firstObject;; | |||||
[window addSubview:self]; | |||||
[self.alertView.layer addAnimation:[CABasicAnimation scaleShowAnimationWithDuration:ELAnimationDuration] forKey:@"ELSelectViewShowAnimation"]; | |||||
} | |||||
-(void)hide{ | |||||
[self.alertView.layer addAnimation:[CABasicAnimation scaleHideAnimationWithDuration:ELAnimationDuration] forKey:@"ELSelectViewHideAnimation"]; | |||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(ELAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||||
[self removeFromSuperview]; | |||||
}); | |||||
} | |||||
#pragma mark ============ UITableView数据源方法 ============== | |||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |||||
return 1; | |||||
} | |||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |||||
return self.datas.count; | |||||
} | |||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |||||
ELSelectViewCell * cell = [tableView dequeueReusableCellWithIdentifier:ELSelectViewCellid]; | |||||
if (cell == nil) { | |||||
cell = [[ELSelectViewCell alloc]initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:ELSelectViewCellid]; | |||||
} | |||||
cell.titleLbl.text = self.datas[indexPath.row]; | |||||
return cell; | |||||
} | |||||
#pragma mark ============ UITableView代理 ============== | |||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |||||
ELSelectViewCell * cell = [tableView cellForRowAtIndexPath:indexPath]; | |||||
cell.titleLbl.textColor = [UIColor blueColor]; | |||||
cell.titleLbl.font = [UIFont systemFontOfSize:20]; | |||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(ELAnimationDuration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||||
if (self.selectRowBlock) { | |||||
self.selectRowBlock(indexPath.row); | |||||
} | |||||
[self hide]; | |||||
}); | |||||
} | |||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |||||
return CellHeight; | |||||
} | |||||
@end |
// | |||||
// ToothbrushConnectionViewController.h | |||||
// AILinkBleSDKSourceCode | |||||
// | |||||
// Created by iot_user on 2020/9/29. | |||||
// Copyright © 2020 IOT. All rights reserved. | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
@class ELPeripheralModel; | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ToothbrushConnectionViewController : UIViewController | |||||
@property (nonatomic, strong) ELPeripheralModel *p; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ToothbrushConnectionViewController.m | |||||
// AILinkBleSDKSourceCode | |||||
// | |||||
// Created by iot_user on 2020/9/29. | |||||
// Copyright © 2020 IOT. All rights reserved. | |||||
// | |||||
#import "ToothbrushConnectionViewController.h" | |||||
#import <AILinkBleSDK/ELToothbrushBleManager.h> | |||||
#import "Masonry.h" | |||||
#import "ELInputAlertView.h" | |||||
#import "ELSelectView.h" | |||||
static NSString * const authorizeIntervalKey = @"authorizeIntervalKey"; | |||||
@interface ToothbrushConnectionViewController ()<ToothbrushDelegate,ELBluetoothManagerDelegate,ElBleWifiDelegate> | |||||
@property (nonatomic, strong) UITextView *textView; | |||||
//附近wifi | |||||
@property (nonatomic, strong) NSMutableArray<ELBleWifiDetailModel *> *wifiArr; | |||||
@property (nonatomic, copy) NSString *wifiPwd; | |||||
@end | |||||
@implementation ToothbrushConnectionViewController | |||||
-(NSMutableArray<ELBleWifiDetailModel *> *)wifiArr{ | |||||
if (_wifiArr==nil) { | |||||
_wifiArr = [[NSMutableArray alloc] init]; | |||||
} | |||||
return _wifiArr; | |||||
} | |||||
- (void)viewDidLoad { | |||||
[super viewDidLoad]; | |||||
[self setupUI]; | |||||
[[ELToothbrushBleManager shareManager] startScan]; | |||||
[ELToothbrushBleManager shareManager].toothbrushDelegate = self; | |||||
[ELToothbrushBleManager shareManager].delegate = self; | |||||
[ELToothbrushBleManager shareManager].bleWifiDelegate = self; | |||||
} | |||||
-(void)addLog:(NSString *)log{ | |||||
self.textView.text = [NSString stringWithFormat:@"%@\n%@",log,self.textView.text]; | |||||
} | |||||
-(void)buttonAction:(UIButton *)sender{ | |||||
NSInteger tag = sender.tag; | |||||
if (tag == 1) { | |||||
//MARK:配网 | |||||
if ([ELToothbrushBleManager shareManager].state == ELBluetoothStateDidValidationPass) { | |||||
[self.wifiArr removeAllObjects]; | |||||
[self addLog:@"正在搜索附近的WiFi..."]; | |||||
//搜索附近网络 | |||||
[[ELToothbrushBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetNearbyWifi]; | |||||
}else{ | |||||
[self addLog:@"未连接设备"]; | |||||
[self.navigationController popViewControllerAnimated:YES]; | |||||
} | |||||
}else if (tag == 2){ | |||||
//MARK:配对 | |||||
long long interval = [[NSUserDefaults standardUserDefaults] integerForKey:authorizeIntervalKey]; | |||||
if (interval == 0) { | |||||
interval = [[NSDate date] timeIntervalSince1970]; | |||||
[[NSUserDefaults standardUserDefaults] setInteger:interval forKey:authorizeIntervalKey]; | |||||
[[NSUserDefaults standardUserDefaults] synchronize]; | |||||
} | |||||
[self addLog:@"发起配对"]; | |||||
[[ELToothbrushBleManager shareManager] requestDeviceAuthorization:interval]; | |||||
} | |||||
else if (tag == 3){ | |||||
//MARK:获取设备ID | |||||
[self addLog:@"请求设备ID"]; | |||||
[[ELToothbrushBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeBleWifiGetSNNumber]; | |||||
} | |||||
else if (tag == 4){ | |||||
//MARK:获取档位 | |||||
[self addLog:@"请求支持的档位"]; | |||||
[[ELToothbrushBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:ELInetGetCmdTypeGetBasicInfoData]; | |||||
}else if (tag == 5){ | |||||
//MARK:获取三轴方向 | |||||
[self addLog:@"获取三轴方向"]; | |||||
[[ELToothbrushBleManager shareManager] getTriaxialDirection]; | |||||
}else if (tag == 6){ | |||||
//MARK:获取三轴数据 | |||||
[self addLog:@"获取三轴数据"]; | |||||
[[ELToothbrushBleManager shareManager] getTriaxialData]; | |||||
}else if (tag == 7){ | |||||
//MARK:查询默认刷牙时长和工作档位 | |||||
[self addLog:@"查询默认刷牙时长和工作档位"]; | |||||
[[ELToothbrushBleManager shareManager] getWorkGear]; | |||||
} | |||||
else if (tag == 8){ | |||||
//MARK:查询手动设置信息 | |||||
[self addLog:@"查询手动设置信息"]; | |||||
[[ELToothbrushBleManager shareManager] getCustomGear]; | |||||
} | |||||
else if (tag == 9){ | |||||
//MARK:查询二级档位默认值 | |||||
[self addLog:@"查询二级档位默认值"]; | |||||
[[ELToothbrushBleManager shareManager] getTwoGearDefualt]; | |||||
}else if (tag == 10){ | |||||
//MARK:上报工作阶段 | |||||
[self addLog:@"上报工作阶段"]; | |||||
[[ELToothbrushBleManager shareManager] getWorkPhase]; | |||||
} | |||||
else if (tag == 11){ | |||||
//MARK:设置刷牙模式 | |||||
[self addLog:@"设置刷牙模式:舒柔"]; | |||||
[[ELToothbrushBleManager shareManager] setWorkGear:(ToothbrushGearTypeSoft) interval:120 supportGearType:(ToothSupportGearTypeOneGear)]; | |||||
}else if (tag == 12){ | |||||
//MARK:开关 | |||||
[self addLog:@"开关"]; | |||||
[[ELToothbrushBleManager shareManager] switchToothbrush]; | |||||
}else if (tag == 13){ | |||||
//MARK:设置二档默认 | |||||
[self addLog:@"设置二档默认(清洁)"]; | |||||
[[ELToothbrushBleManager shareManager] setTwoGearDefaultGear:(ToothbrushGearTypeClean)]; | |||||
}else if (tag == 14){ | |||||
//MARK:试用 | |||||
[self addLog:@"试用,手动设置,二档,frequency:67 duty:50"]; | |||||
[[ELToothbrushBleManager shareManager] tryGear:(ToothbrushGearTypeCustom) supportType:(ToothSupportGearTypeTwoGear) frequency:67 duty:50]; | |||||
}else if (tag == 15){ | |||||
//MARK:设置手动档 | |||||
[self addLog:@"设置手动档:frequency:67 duty:50 interval:120"]; | |||||
[[ELToothbrushBleManager shareManager] setCustomGearData:67 duty:50 interval:120]; | |||||
}else if (tag == 16){ | |||||
//MARK:上报接收数据结果 | |||||
[self addLog:@"上报接收数据结果"]; | |||||
[[ELToothbrushBleManager shareManager] reportReceiveResultOfToothbrushData:YES]; | |||||
} | |||||
else{ | |||||
} | |||||
} | |||||
-(void)setupUI{ | |||||
self.view.backgroundColor = [UIColor whiteColor]; | |||||
UIButton *button1 = [self getButtonWithTitle:@"配网" withTag:1]; | |||||
[self.view addSubview:button1]; | |||||
[button1 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.mas_equalTo(10); | |||||
make.top.mas_equalTo(70); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button2 = [self getButtonWithTitle:@"配对" withTag:2]; | |||||
[self.view addSubview:button2]; | |||||
[button2 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button1.mas_right).mas_offset(5); | |||||
make.top.equalTo(button1); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button3 = [self getButtonWithTitle:@"获取设备ID" withTag:3]; | |||||
[self.view addSubview:button3]; | |||||
[button3 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button2.mas_right).mas_offset(5); | |||||
make.top.equalTo(button2); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button4 = [self getButtonWithTitle:@"获取档位" withTag:4]; | |||||
[self.view addSubview:button4]; | |||||
[button4 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button3.mas_right).mas_offset(5); | |||||
make.top.equalTo(button3); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button5 = [self getButtonWithTitle:@"获取三轴方向" withTag:5]; | |||||
[self.view addSubview:button5]; | |||||
[button5 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.mas_equalTo(10); | |||||
make.top.equalTo(button4.mas_bottom).mas_offset(10); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button6 = [self getButtonWithTitle:@"获取三轴数据" withTag:6]; | |||||
[self.view addSubview:button6]; | |||||
[button6 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button5.mas_right).mas_offset(5); | |||||
make.top.equalTo(button5); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button7 = [self getButtonWithTitle:@"查询默认模式和时长" withTag:7]; | |||||
[self.view addSubview:button7]; | |||||
[button7 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button6.mas_right).mas_offset(5); | |||||
make.top.equalTo(button6); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button8 = [self getButtonWithTitle:@"查询手动设置" withTag:8]; | |||||
[self.view addSubview:button8]; | |||||
[button8 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button7.mas_right).mas_offset(5); | |||||
make.top.equalTo(button7); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button9 = [self getButtonWithTitle:@"查询二级档位默认" withTag:9]; | |||||
[self.view addSubview:button9]; | |||||
[button9 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button5); | |||||
make.top.equalTo(button5.mas_bottom).mas_offset(10); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button10 = [self getButtonWithTitle:@"上报工作阶段" withTag:10]; | |||||
[self.view addSubview:button10]; | |||||
[button10 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button9.mas_right).mas_offset(5); | |||||
make.top.equalTo(button9); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button11 = [self getButtonWithTitle:@"设置刷牙模式(0A)" withTag:11]; | |||||
[self.view addSubview:button11]; | |||||
[button11 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button10.mas_right).mas_offset(5); | |||||
make.top.equalTo(button9); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button12 = [self getButtonWithTitle:@"开关" withTag:12]; | |||||
[self.view addSubview:button12]; | |||||
[button12 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button11.mas_right).mas_offset(5); | |||||
make.top.equalTo(button9); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button13 = [self getButtonWithTitle:@"设置二档默认" withTag:13]; | |||||
[self.view addSubview:button13]; | |||||
[button13 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button9); | |||||
make.top.equalTo(button9.mas_bottom).mas_offset(10); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button14 = [self getButtonWithTitle:@"试用" withTag:14]; | |||||
[self.view addSubview:button14]; | |||||
[button14 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button13.mas_right).mas_offset(5); | |||||
make.top.equalTo(button13); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button15 = [self getButtonWithTitle:@"设置手动档" withTag:15]; | |||||
[self.view addSubview:button15]; | |||||
[button15 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button14.mas_right).mas_offset(5); | |||||
make.top.equalTo(button13); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
UIButton *button16 = [self getButtonWithTitle:@"上报接收数据结果" withTag:16]; | |||||
[self.view addSubview:button16]; | |||||
[button16 mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.equalTo(button15.mas_right).mas_offset(5); | |||||
make.top.equalTo(button13); | |||||
make.width.mas_equalTo(70); | |||||
make.height.mas_equalTo(30); | |||||
}]; | |||||
// | |||||
self.textView = [[UITextView alloc] init]; | |||||
self.textView.backgroundColor = [UIColor blackColor]; | |||||
self.textView.text = @"Log"; | |||||
self.textView.textColor = [UIColor redColor]; | |||||
self.textView.font = [UIFont systemFontOfSize:16]; | |||||
self.textView.editable = NO; | |||||
[self.view addSubview:self.textView]; | |||||
[self.textView mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.left.mas_equalTo(10); | |||||
make.right.bottom.mas_equalTo(-10); | |||||
make.height.mas_equalTo(200); | |||||
}]; | |||||
} | |||||
-(UIButton *)getButtonWithTitle:(NSString *)title withTag:(NSInteger)tag{ | |||||
UIButton *button1 = [UIButton buttonWithType:(UIButtonTypeCustom)]; | |||||
[button1 setTitle:title forState:(UIControlStateNormal)]; | |||||
button1.tag = tag; | |||||
button1.titleLabel.adjustsFontSizeToFitWidth = YES; | |||||
button1.titleLabel.numberOfLines = 2; | |||||
button1.titleLabel.font = [UIFont systemFontOfSize:15]; | |||||
[button1 setTitleColor:[UIColor redColor] forState:(UIControlStateNormal)]; | |||||
button1.backgroundColor = [UIColor blackColor]; | |||||
button1.titleLabel.textAlignment = NSTextAlignmentCenter; | |||||
button1.titleLabel.adjustsFontSizeToFitWidth = YES; | |||||
[button1 addTarget:self action:@selector(buttonAction:) forControlEvents:(UIControlEventTouchUpInside)]; | |||||
return button1; | |||||
} | |||||
-(void)connectWiFiWithPwd:(NSString *)pwd wifi:(ELBleWifiDetailModel *)wifi{ | |||||
[self addLog:@"正在配置WiFi名称"]; | |||||
self.wifiPwd = pwd; | |||||
[[ELToothbrushBleManager shareManager] bleWifiSetConnectWifiMac:wifi.macData]; | |||||
} | |||||
-(void)connectWiFi:(ELBleWifiDetailModel *)wifi{ | |||||
if (wifi.secureType ==ELBleWifiSecureTypeOpen) { | |||||
[self connectWiFiWithPwd:@"" wifi:wifi]; | |||||
}else{ | |||||
ELInputAlertView *input = [[ELInputAlertView alloc] initWithTittle:@"配置WiFi" withText:@"" withMessage:@"请输入WiFi密码" withLeftButton:@"取消" withRightButton:@"确定"]; | |||||
[input show]; | |||||
__weak typeof(self) weakSelf = self; | |||||
input.rightHideBlock = ^BOOL(NSString * _Nonnull text, UIView * _Nonnull view) { | |||||
if ([ELBlePublicTool legalBleWifiPassword:text]) { | |||||
[weakSelf connectWiFiWithPwd:text wifi:wifi]; | |||||
return YES; | |||||
}else{ | |||||
[self addLog:@"请输入8~56位的密码"]; | |||||
return NO; | |||||
} | |||||
}; | |||||
} | |||||
} | |||||
#pragma mark ============ ElBleWifiDelegate ============== | |||||
//获取设备ID | |||||
-(void)bleWifiReceiveWifiSNCode:(int)code{ | |||||
if (code == 0) { | |||||
[self addLog:@"设备ID不存在,请先配网再获取"]; | |||||
}else{ | |||||
[self addLog:[NSString stringWithFormat:@"设备ID = %d",code]]; | |||||
} | |||||
} | |||||
//设置wifi过程结果 | |||||
-(void)bleWifiReceiceResponseType:(ELInetSetCmdType)type result:(ELSetBluetoothResponseType)result{ | |||||
if (result == ELSetBluetoothResponseTypeSuccess) { | |||||
//设置WiFi结果 | |||||
if (type == ELInetSetCmdTypeBleWifiSetWifiMac) { | |||||
[self addLog:@"正在配置WiFi密码"]; | |||||
[[ELToothbrushBleManager shareManager] bleWifiSetWifiPwd:self.wifiPwd]; | |||||
}else if (type == ELInetSetCmdTypeBleWifiSetWifiPwd){ | |||||
[self addLog:@"设置WiFi连接"]; | |||||
[[ELToothbrushBleManager shareManager] bleWifiSetupWifiConnect:YES]; | |||||
}else if (type == ELInetSetCmdTypeBleWifiSetConnectWifi){ | |||||
//获取连接状态 | |||||
} | |||||
} | |||||
else{ | |||||
[self addLog:@"WiFi配置失败"]; | |||||
} | |||||
} | |||||
//附近wifi | |||||
-(void)bleWifiReceiveWifiDetailModel:(ELBleWifiDetailModel *)model{ | |||||
[self addLog:[NSString stringWithFormat:@"搜索到wifi类型---%lu 名称---%@",(unsigned long)model.wifiState,model.wifiName]]; | |||||
if (model.wifiState == ELBleWifiUseStateConnected) { | |||||
} | |||||
[self.wifiArr addObject:model]; | |||||
} | |||||
//附近wifi搜索结果 | |||||
-(void)bleWifiReceiveScanedWifiCount:(int)count { | |||||
[self addLog:@"搜索完成"]; | |||||
//扫描结束 | |||||
NSMutableArray *array = [[NSMutableArray alloc] init]; | |||||
for (int i=0; i<self.wifiArr.count; i++) { | |||||
ELBleWifiDetailModel *model = self.wifiArr[i]; | |||||
NSString *wifiTypeStr = [NSString stringWithFormat:@"wifi类型:%lu 名称:%@",(unsigned long)model.secureType,model.wifiName]; | |||||
if (model.secureType == ELBleWifiSecureTypeOpen) { | |||||
wifiTypeStr = [NSString stringWithFormat:@"wifi类型:%@ 名称:%@",@"Open",model.wifiName]; | |||||
}else if (model.secureType == ELBleWifiSecureTypeWEP){ | |||||
wifiTypeStr = [NSString stringWithFormat:@"wifi类型:%@ 名称:%@",@"WEP",model.wifiName]; | |||||
}else if (model.secureType == ELBleWifiSecureTypeWPA_PSK){ | |||||
wifiTypeStr = [NSString stringWithFormat:@"wifi类型:%@ 名称:%@",@"WPA_PSK",model.wifiName]; | |||||
}else if (model.secureType == ELBleWifiSecureTypeWPA2_PSK){ | |||||
wifiTypeStr = [NSString stringWithFormat:@"wifi类型:%@ 名称:%@",@"WPA2_PSK",model.wifiName]; | |||||
}else if (model.secureType == ELBleWifiSecureTypeWPA_WPA_2_PSK){ | |||||
wifiTypeStr = [NSString stringWithFormat:@"wifi类型:%@ 名称:%@",@"WPA_WPA_2_PSK",model.wifiName]; | |||||
}else if (model.secureType == ELBleWifiSecureTypeWPA2_ENTERPRISE){ | |||||
wifiTypeStr = [NSString stringWithFormat:@"wifi类型:%@ 名称:%@",@"WPA2_ENTERPRISE",model.wifiName]; | |||||
} | |||||
[array addObject:wifiTypeStr]; | |||||
} | |||||
ELSelectView *selectView = [[ELSelectView alloc] initWithTitle:@"附近WiFi" withSelectArray:array]; | |||||
[selectView show]; | |||||
__weak typeof(self) weakSelf = self; | |||||
selectView.selectRowBlock = ^(NSInteger row) { | |||||
[weakSelf connectWiFi:weakSelf.wifiArr[row]]; | |||||
}; | |||||
} | |||||
//连接状态 | |||||
-(void)toothbrushReceiveState:(ELBluetoothState)state{ | |||||
if (state == ELBluetoothStateUnavailable) { | |||||
self.title = @"请打开蓝牙"; | |||||
}else if (state == ELBluetoothStateScaning || state == ELBluetoothStateWillConnect || state == ELBluetoothStateDidConnect){ | |||||
self.title = @"正在连接..."; | |||||
}else if (state == ELBluetoothStateConnectFail || state == ELBluetoothStateDidDisconnect || state == ELBluetoothStateFailedValidation){ | |||||
self.title = @"连接断开"; | |||||
}else if (state == ELBluetoothStateDidValidationPass){ | |||||
self.title = @"连接成功"; | |||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||||
self.title = self.p.macAddress; | |||||
}); | |||||
//获取版本号 | |||||
[[ELToothbrushBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetBMVersion)]; | |||||
//获取电量 | |||||
[[ELToothbrushBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetBatteryState)]; | |||||
//获取蓝牙和wifi连接状态 | |||||
[[ELToothbrushBleManager shareManager] getBluetoothInfoWithELInetGetCmdType:(ELInetGetCmdTypeGetConnectState)]; | |||||
} | |||||
} | |||||
#pragma mark ============ ELBluetoothManagerDelegate ============== | |||||
// | |||||
-(void)bluetoothManagerReceiveDeviceAuthorizeResult:(ELBluetoothDeviceAuthorizeResult)result{ | |||||
if (result == ELBluetoothDeviceAuthorizeResultNoAuth) { | |||||
[self addLog:@"没有授权,请授权"]; | |||||
}else if (result == ELBluetoothDeviceAuthorizeResultAuthorized){ | |||||
[self addLog:@"已经授权"]; | |||||
}else if (result == ELBluetoothDeviceAuthorizeResultNoNeed){ | |||||
[self addLog:@"不需要授权"]; | |||||
}else if (result == ELBluetoothDeviceAuthorizeResultSuccess){ | |||||
[self addLog:@"授权成功"]; | |||||
} | |||||
} | |||||
//蓝牙和wifi连接状态 | |||||
-(void)bluetoothManagerReceiveMCUConnectedState:(struct ELMCUStateStruct)stateStrct{ | |||||
[self addLog:[NSString stringWithFormat:@"wifi连接状态:%lu \n0:没有连接\n1:尝试连接热点,但是失败\n2:连接热点,热点无网络\n3:连接热点,热点有网络\n4:有热点信息,未连接",(unsigned long)stateStrct.wifiState]]; | |||||
} | |||||
//电量 | |||||
-(void)bluetoothManagerReceiveBattery:(struct ELBatteryStruct)battery{ | |||||
[self addLog:[NSString stringWithFormat:@"设备电量为:%d",battery.power]]; | |||||
} | |||||
//版本号 | |||||
-(void)bluetoothManagerReceiveBMVersion:(NSString *)bmVersion{ | |||||
[self addLog:[NSString stringWithFormat:@"BM版本号为:%@",bmVersion]]; | |||||
} | |||||
#pragma mark ============ ToothbrushDelegate ============== | |||||
//试用 | |||||
-(void)toothbrushReceiveTryResult:(ToothbrushSetResult)result{ | |||||
[self addLog:[NSString stringWithFormat:@"试用结果:%lu",result]]; | |||||
} | |||||
//设置二档默认 | |||||
-(void)toothbrushReceiveSettingTwoGearDefaultResult:(ELSetBluetoothResponseType)result{ | |||||
[self addLog:[NSString stringWithFormat:@"设置二档默认结果:%lu",result]]; | |||||
} | |||||
//开关 | |||||
-(void)toothbrushReceiveSwitchResult:(ToothbrushSetResult)result{ | |||||
[self addLog:[NSString stringWithFormat:@"开关结果:%lu",result]]; | |||||
} | |||||
//设置刷牙模式结果 | |||||
-(void)toothbrushReceiveSetWorkGearResult:(ELSetBluetoothResponseType)result{ | |||||
[self addLog:[NSString stringWithFormat:@"设置刷牙模式结果:%lu",(unsigned long)result]]; | |||||
} | |||||
//刷牙数据 | |||||
-(void)toothbrushtReceiveToothbrushData:(ToothbrushData)data{ | |||||
[self addLog:[NSString stringWithFormat:@"刷牙数据:档位=%lu,工作时长=%d,左时长=%d,右时长=%d,电量=%d",(unsigned long)data.gear,data.workTime,data.leftTime,data.rightTime,data.battery]]; | |||||
} | |||||
//上报工作阶段 | |||||
-(void)toothbrushReceiveWorkPhase:(ToothBrushWorkPhase)workPhase{ | |||||
[self addLog:[NSString stringWithFormat:@"当前工作阶段:%lu,档位:%lu, 第%lu档",workPhase.workPhase,workPhase.gear,workPhase.supportType]]; | |||||
} | |||||
//获取二档档位信息 | |||||
-(void)toothbrushReceiveTwoGearDefault:(ToothbrushGearType)gear{ | |||||
[self addLog:[NSString stringWithFormat:@"二档默认档:%lu",gear]]; | |||||
} | |||||
//手动设置信息 | |||||
-(void)toothbrushReceiveCustomData:(ToothbrushCustomData)custom{ | |||||
[self addLog:[NSString stringWithFormat:@"频率:%d 占空比:%d 时长:%d",custom.frequency,custom.duty,custom.interval]]; | |||||
} | |||||
//默认档位和时长 | |||||
-(void)toothbrushReceiveWorkGear:(ToothbrushWorkGear)workGear{ | |||||
[self addLog:[NSString stringWithFormat:@"档位:%lu 时长:%d",workGear.gearType,workGear.interval]]; | |||||
} | |||||
//三轴数据 | |||||
-(void)toothbrushReceiveTriaxialData:(BOOL)success triaxialX:(int)x triaxialY:(int)y triaxialZ:(int)z{ | |||||
if (success) { | |||||
[self addLog:[NSString stringWithFormat:@"三轴数据:x = %d , y = %d , = %d",x,y,z]]; | |||||
}else{ | |||||
[self addLog:@"三轴数据获取失败"]; | |||||
} | |||||
} | |||||
//三轴方向 | |||||
-(void)toothbrushReceiveTriaxialDirection:(ToothbrushTriaxialDirection)direction{ | |||||
if (direction == ToothbrushTriaxialDirectionYTop) { | |||||
[self addLog:@"Y轴朝上"]; | |||||
}else if (direction == ToothbrushTriaxialDirectionYBottom){ | |||||
[self addLog:@"Y轴朝下"]; | |||||
}else if (direction == ToothbrushTriaxialDirectionYLeft){ | |||||
[self addLog:@"Y轴朝左"]; | |||||
}else if (direction == ToothbrushTriaxialDirectionYRight){ | |||||
[self addLog:@"Y轴朝右"]; | |||||
} | |||||
} | |||||
-(void)toothbrushReceiveOneGear:(NSArray<NSNumber *> *)oneGear twoGear:(NSArray<NSNumber *> *)twoGear{ | |||||
NSString *onegearStr = @"一档:"; | |||||
for (NSNumber *one in oneGear) { | |||||
onegearStr = [NSString stringWithFormat:@"%@,%@",onegearStr,one]; | |||||
} | |||||
NSString *twogearStr = @"二档:"; | |||||
for (NSNumber *two in twoGear) { | |||||
twogearStr = [NSString stringWithFormat:@"%@,%@",twogearStr,two]; | |||||
} | |||||
[self addLog:[NSString stringWithFormat:@"%@\n%@",onegearStr,twogearStr]]; | |||||
} | |||||
-(void)toothbrushReceiveDevices:(NSArray<ELPeripheralModel *> *)devices{ | |||||
ELPeripheralModel * connectModel; | |||||
for (ELPeripheralModel *deviceModel in devices) { | |||||
if ([deviceModel.macAddress isEqualToString:self.p.macAddress]) { | |||||
connectModel = deviceModel; | |||||
break; | |||||
} | |||||
} | |||||
if (connectModel) { | |||||
[[ELToothbrushBleManager shareManager] connectPeripheral:connectModel]; | |||||
} | |||||
} | |||||
-(void)dealloc{ | |||||
[[ELToothbrushBleManager shareManager] disconnectPeripheral]; | |||||
} | |||||
@end |
// | |||||
// ToothbrushScanViewController.h | |||||
// AILinkBleSDKSourceCode | |||||
// | |||||
// Created by iot_user on 2020/9/29. | |||||
// Copyright © 2020 IOT. All rights reserved. | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface ToothbrushScanViewController : UIViewController | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// ToothbrushScanViewController.m | |||||
// AILinkBleSDKSourceCode | |||||
// | |||||
// Created by iot_user on 2020/9/29. | |||||
// Copyright © 2020 IOT. All rights reserved. | |||||
// | |||||
#import "ToothbrushScanViewController.h" | |||||
#import "Masonry.h" | |||||
#import "ToothbrushConnectionViewController.h" | |||||
#import <AILinkBleSDK/ELToothbrushBleManager.h> | |||||
#import "ToothbrushScanViewController.h" | |||||
@interface ToothbrushScanViewController ()<UITableViewDelegate,UITableViewDataSource,ToothbrushDelegate> | |||||
@property (nonatomic, strong) UITableView *tableView; | |||||
@property (nonatomic, strong) NSArray<ELPeripheralModel *> *devices; | |||||
@end | |||||
@implementation ToothbrushScanViewController | |||||
- (void)viewDidLoad { | |||||
[super viewDidLoad]; | |||||
// self.title = @"Devices"; | |||||
[self.view addSubview:self.tableView]; | |||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { | |||||
make.top.left.right.bottom.mas_equalTo(0); | |||||
}]; | |||||
} | |||||
-(void)viewWillAppear:(BOOL)animated{ | |||||
[super viewWillAppear:animated]; | |||||
[[ELToothbrushBleManager shareManager] startScan]; | |||||
[ELToothbrushBleManager shareManager].toothbrushDelegate = self; | |||||
} | |||||
-(void)viewDidDisappear:(BOOL)animated{ | |||||
[super viewDidDisappear:animated]; | |||||
[[ELToothbrushBleManager shareManager] stopScan]; | |||||
} | |||||
#pragma mark ============ ELBluetoothManagerDelegate ============== | |||||
-(void)toothbrushReceiveState:(ELBluetoothState)state{ | |||||
NSLog(@"bluetoothManagerUpdateBleState = %ld",state); | |||||
} | |||||
-(void)toothbrushReceiveDevices:(NSArray<ELPeripheralModel *> *)devices{ | |||||
self.devices = devices; | |||||
[self.tableView reloadData]; | |||||
} | |||||
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ | |||||
return self.devices.count; | |||||
} | |||||
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |||||
return 60; | |||||
} | |||||
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ | |||||
static NSString *cellId = @"cellid"; | |||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; | |||||
if (!cell) { | |||||
cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:cellId]; | |||||
} | |||||
ELPeripheralModel *p = self.devices[indexPath.row]; | |||||
cell.textLabel.text = [NSString stringWithFormat:@"Name:%@---Mac:%@\nCID:%ld---VID:%ld---PID:%ld",p.deviceName,p.macAddress,p.deviceType,p.vendorID,p.productID]; | |||||
cell.textLabel.numberOfLines = 2; | |||||
cell.textLabel.textColor = [UIColor blackColor]; | |||||
return cell; | |||||
} | |||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ | |||||
ELPeripheralModel *p = self.devices[indexPath.row]; | |||||
ToothbrushConnectionViewController *vc = [[ToothbrushConnectionViewController alloc] init]; | |||||
vc.p = p; | |||||
[self.navigationController pushViewController:vc animated:YES]; | |||||
} | |||||
-(UITableView *)tableView{ | |||||
if (_tableView == nil) { | |||||
_tableView = [[UITableView alloc] init]; | |||||
_tableView.delegate = self; | |||||
_tableView.dataSource = self; | |||||
} | |||||
return _tableView; | |||||
} | |||||
@end |
// | |||||
// UIButton+WZAdd.h | |||||
// 常用UI控件封装 | |||||
// | |||||
// Created by iot_iMac on 2018/6/21. | |||||
// Copyright © 2018年 iot_iMac. All rights reserved. | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
@interface UIButton (WZAdd) | |||||
/* | |||||
* 注意:如果needRoundCorner=YES,则必须设置frame的height值,否则无法实现圆角 | |||||
*/ | |||||
+ (UIButton *)createWithFrame:(CGRect)frame bgColor:(UIColor *)bgColor font:(UIFont *)font norTitle:(NSString *)norTitle norTitleColor:(UIColor *)norTitleColor norImage:(UIImage *)norImage borderColor:(UIColor *)borderColor needRoundCorner:(BOOL)needRoundCorner target:(id)target action:(SEL)action; | |||||
@end |
// | |||||
// UIButton+WZAdd.m | |||||
// 常用UI控件封装 | |||||
// | |||||
// Created by iot_iMac on 2018/6/21. | |||||
// Copyright © 2018年 iot_iMac. All rights reserved. | |||||
// | |||||
#import "UIButton+WZAdd.h" | |||||
@implementation UIButton (WZAdd) | |||||
/* | |||||
* 注意:如果needRoundCorner=YES,则必须设置frame的height值,否则无法实现圆角 | |||||
*/ | |||||
+ (UIButton *)createWithFrame:(CGRect)frame bgColor:(UIColor *)bgColor font:(UIFont *)font norTitle:(NSString *)norTitle norTitleColor:(UIColor *)norTitleColor norImage:(UIImage *)norImage borderColor:(UIColor *)borderColor needRoundCorner:(BOOL)needRoundCorner target:(id)target action:(SEL)action { | |||||
//这3项必须有值 | |||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | |||||
btn.frame = frame; | |||||
btn.titleLabel.textAlignment = NSTextAlignmentCenter; | |||||
btn.titleLabel.numberOfLines = 0; | |||||
btn.titleLabel.adjustsFontSizeToFitWidth = YES; | |||||
//以下各项均可为nil | |||||
if (font) { | |||||
btn.titleLabel.font = font; | |||||
} | |||||
if (bgColor) { | |||||
[btn setBackgroundColor:bgColor]; | |||||
} | |||||
if (norTitle) { | |||||
[btn setTitle:norTitle forState:UIControlStateNormal]; | |||||
} | |||||
if (norTitleColor) { | |||||
[btn setTitleColor:norTitleColor forState:(UIControlStateNormal)]; | |||||
} | |||||
if (norImage) { | |||||
[btn setImage:norImage forState:UIControlStateNormal]; | |||||
} | |||||
if (borderColor) { | |||||
btn.layer.borderColor = borderColor.CGColor; | |||||
btn.layer.borderWidth = 1; | |||||
} | |||||
if (needRoundCorner) { | |||||
btn.layer.cornerRadius = btn.bounds.size.height/2; | |||||
btn.layer.masksToBounds = YES; //防止设置了图片,不能显示圆角问题 | |||||
} | |||||
if (action) { //target可为nil,action不可为nil | |||||
[btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; | |||||
} | |||||
return btn; | |||||
} | |||||
@end |
// | |||||
// UILabel+WZAdd.h | |||||
// 常用UI控件封装 | |||||
// | |||||
// Created by iot_iMac on 2018/6/21. | |||||
// Copyright © 2018年 iot_iMac. All rights reserved. | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
@interface UILabel (WZAdd) | |||||
+ (UILabel *)createWithFrame:(CGRect)frame bgColor:(UIColor *)bgColor text:(NSString *)text textColor:(UIColor *)textColor font:(UIFont *)font align:(NSTextAlignment)align; | |||||
@end |
// | |||||
// UILabel+WZAdd.m | |||||
// 常用UI控件封装 | |||||
// | |||||
// Created by iot_iMac on 2018/6/21. | |||||
// Copyright © 2018年 iot_iMac. All rights reserved. | |||||
// | |||||
#import "UILabel+WZAdd.h" | |||||
@implementation UILabel (WZAdd) | |||||
+ (UILabel *)createWithFrame:(CGRect)frame bgColor:(UIColor *)bgColor text:(NSString *)text textColor:(UIColor *)textColor font:(UIFont *)font align:(NSTextAlignment)align { | |||||
UILabel *lbl = [[UILabel alloc] initWithFrame:frame]; | |||||
lbl.textAlignment = align; | |||||
if (text) { | |||||
lbl.text = text; | |||||
} | |||||
if (textColor) { | |||||
lbl.textColor = textColor; | |||||
} | |||||
if (bgColor) { | |||||
lbl.backgroundColor = bgColor; | |||||
} | |||||
if (font) { | |||||
lbl.font = font; | |||||
} | |||||
return lbl; | |||||
} | |||||
@end |
// | |||||
// UIView+Category.h | |||||
// GoodNutrition | |||||
// | |||||
// Created by iot_user on 2018/10/23. | |||||
// Copyright © 2018年 Percyyang. All rights reserved. | |||||
// | |||||
#import <UIKit/UIKit.h> | |||||
NS_ASSUME_NONNULL_BEGIN | |||||
@interface UIView (Category) | |||||
@property (nonatomic, assign) CGFloat x; | |||||
@property (nonatomic, assign) CGFloat y; | |||||
@property (nonatomic, assign) CGFloat width; | |||||
@property (nonatomic, assign) CGFloat height; | |||||
@property (nonatomic, assign) CGSize size; | |||||
/** | |||||
给View 添加圆角 | |||||
@param cornerRadii cornerRadii | |||||
@param corner cornerRadii | |||||
*/ | |||||
-(void)setCornerRadii:(CGSize)cornerRadii withCorner:(UIRectCorner)corner; | |||||
// | |||||
- (void)setViewLayerCornerRadius:(CGFloat)cornerRadius shadowOffset:(CGSize)shadowOffset shadowOpacity:(CGFloat)shadowOpacity shadowRadius:(CGFloat)shadowRadius shadowColor:(UIColor *)shadowColor; | |||||
@end | |||||
NS_ASSUME_NONNULL_END |
// | |||||
// UIView+Category.m | |||||
// GoodNutrition | |||||
// | |||||
// Created by iot_user on 2018/10/23. | |||||
// Copyright © 2018年 Percyyang. All rights reserved. | |||||
// | |||||
#import "UIView+Category.h" | |||||
@implementation UIView (Category) | |||||
-(void)setX:(CGFloat)x{ | |||||
CGRect frame = self.frame; | |||||
frame.origin.x = x; | |||||
self.frame=frame; | |||||
} | |||||
-(CGFloat)x{ | |||||
return self.frame.origin.x; | |||||
} | |||||
-(void)setY:(CGFloat)y{ | |||||
CGRect frame = self.frame; | |||||
frame.origin.y = y; | |||||
self.frame = frame; | |||||
} | |||||
-(CGFloat)y{ | |||||
return self.frame.origin.y; | |||||
} | |||||
-(void)setWidth:(CGFloat)width{ | |||||
CGRect frame = self.frame; | |||||
frame.size.width = width; | |||||
self.frame = frame; | |||||
} | |||||
-(CGFloat)width{ | |||||
return self.frame.size.width; | |||||
} | |||||
-(void)setHeight:(CGFloat)height{ | |||||
CGRect frame = self.frame; | |||||
frame.size.height = height; | |||||
self.frame = frame; | |||||
} | |||||
-(CGFloat)height{ | |||||
return self.frame.size.height; | |||||
} | |||||
-(void)setSize:(CGSize)size{ | |||||
CGRect frame = self.frame; | |||||
frame.size = size; | |||||
self.frame = frame; | |||||
} | |||||
-(CGSize)size{ | |||||
return self.frame.size; | |||||
} | |||||
- (void)setViewLayerCornerRadius:(CGFloat)cornerRadius shadowOffset:(CGSize)shadowOffset shadowOpacity:(CGFloat)shadowOpacity shadowRadius:(CGFloat)shadowRadius shadowColor:(UIColor *)shadowColor{ | |||||
self.layer.cornerRadius = cornerRadius; | |||||
self.layer.masksToBounds = NO; | |||||
self.layer.shadowColor = shadowColor.CGColor; | |||||
self.layer.shadowOffset = shadowOffset; | |||||
self.layer.shadowOpacity = shadowOpacity; | |||||
self.layer.shadowRadius = shadowRadius; | |||||
} | |||||
-(void)setCornerRadii:(CGSize)cornerRadii withCorner:(UIRectCorner)corner{ | |||||
UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corner cornerRadii:cornerRadii]; | |||||
CAShapeLayer *layer = [CAShapeLayer layer]; | |||||
layer.frame = self.bounds; | |||||
layer.path = path.CGPath; | |||||
self.layer.mask = layer; | |||||
} | |||||
@end |