@@ -0,0 +1,394 @@ | |||
// !$*UTF8*$! | |||
{ | |||
archiveVersion = 1; | |||
classes = { | |||
}; | |||
objectVersion = 50; | |||
objects = { | |||
/* Begin PBXBuildFile section */ | |||
9598534B2600B7F000B1534A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9598534A2600B7F000B1534A /* AppDelegate.swift */; }; | |||
9598534F2600B7F000B1534A /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9598534E2600B7F000B1534A /* ViewController.swift */; }; | |||
959853522600B7F000B1534A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 959853502600B7F000B1534A /* Main.storyboard */; }; | |||
959853542600B7F200B1534A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 959853532600B7F200B1534A /* Assets.xcassets */; }; | |||
959853572600B7F200B1534A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 959853552600B7F200B1534A /* LaunchScreen.storyboard */; }; | |||
9598536B2600B8E200B1534A /* SetUserViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 959853622600B8E200B1534A /* SetUserViewController.xib */; }; | |||
9598536C2600B8E200B1534A /* SetUserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 959853642600B8E200B1534A /* SetUserViewController.m */; }; | |||
9598536D2600B8E200B1534A /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 959853652600B8E200B1534A /* MainViewController.m */; }; | |||
9598536E2600B8E200B1534A /* AppUser.m in Sources */ = {isa = PBXBuildFile; fileRef = 959853662600B8E200B1534A /* AppUser.m */; }; | |||
9598536F2600B8E200B1534A /* SearchDeviceVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 959853672600B8E200B1534A /* SearchDeviceVC.m */; }; | |||
959853702600B8E200B1534A /* InetBleSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 959853692600B8E200B1534A /* InetBleSDK.framework */; }; | |||
/* End PBXBuildFile section */ | |||
/* Begin PBXFileReference section */ | |||
959853472600B7F000B1534A /* BodyfatScaleDemo_swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BodyfatScaleDemo_swift.app; sourceTree = BUILT_PRODUCTS_DIR; }; | |||
9598534A2600B7F000B1534A /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | |||
9598534E2600B7F000B1534A /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; }; | |||
959853512600B7F000B1534A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; }; | |||
959853532600B7F200B1534A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; | |||
959853562600B7F200B1534A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; }; | |||
959853582600B7F200B1534A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; | |||
959853612600B8E200B1534A /* SearchDeviceVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchDeviceVC.h; sourceTree = "<group>"; }; | |||
959853622600B8E200B1534A /* SetUserViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SetUserViewController.xib; sourceTree = "<group>"; }; | |||
959853632600B8E200B1534A /* AppUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppUser.h; sourceTree = "<group>"; }; | |||
959853642600B8E200B1534A /* SetUserViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SetUserViewController.m; sourceTree = "<group>"; }; | |||
959853652600B8E200B1534A /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; }; | |||
959853662600B8E200B1534A /* AppUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppUser.m; sourceTree = "<group>"; }; | |||
959853672600B8E200B1534A /* SearchDeviceVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchDeviceVC.m; sourceTree = "<group>"; }; | |||
959853682600B8E200B1534A /* SetUserViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SetUserViewController.h; sourceTree = "<group>"; }; | |||
959853692600B8E200B1534A /* InetBleSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = InetBleSDK.framework; sourceTree = "<group>"; }; | |||
9598536A2600B8E200B1534A /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; }; | |||
959853782600B9FB00B1534A /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; }; | |||
/* End PBXFileReference section */ | |||
/* Begin PBXFrameworksBuildPhase section */ | |||
959853442600B7F000B1534A /* Frameworks */ = { | |||
isa = PBXFrameworksBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
959853702600B8E200B1534A /* InetBleSDK.framework in Frameworks */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXFrameworksBuildPhase section */ | |||
/* Begin PBXGroup section */ | |||
9598533E2600B7F000B1534A = { | |||
isa = PBXGroup; | |||
children = ( | |||
959853492600B7F000B1534A /* BodyfatScaleDemo_swift */, | |||
959853482600B7F000B1534A /* Products */, | |||
); | |||
sourceTree = "<group>"; | |||
}; | |||
959853482600B7F000B1534A /* Products */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
959853472600B7F000B1534A /* BodyfatScaleDemo_swift.app */, | |||
); | |||
name = Products; | |||
sourceTree = "<group>"; | |||
}; | |||
959853492600B7F000B1534A /* BodyfatScaleDemo_swift */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
959853602600B8E200B1534A /* BleScale */, | |||
9598534A2600B7F000B1534A /* AppDelegate.swift */, | |||
9598534E2600B7F000B1534A /* ViewController.swift */, | |||
959853782600B9FB00B1534A /* Bridging-Header.h */, | |||
959853502600B7F000B1534A /* Main.storyboard */, | |||
959853532600B7F200B1534A /* Assets.xcassets */, | |||
959853552600B7F200B1534A /* LaunchScreen.storyboard */, | |||
959853582600B7F200B1534A /* Info.plist */, | |||
); | |||
path = BodyfatScaleDemo_swift; | |||
sourceTree = "<group>"; | |||
}; | |||
959853602600B8E200B1534A /* BleScale */ = { | |||
isa = PBXGroup; | |||
children = ( | |||
959853632600B8E200B1534A /* AppUser.h */, | |||
959853662600B8E200B1534A /* AppUser.m */, | |||
959853692600B8E200B1534A /* InetBleSDK.framework */, | |||
9598536A2600B8E200B1534A /* MainViewController.h */, | |||
959853652600B8E200B1534A /* MainViewController.m */, | |||
959853612600B8E200B1534A /* SearchDeviceVC.h */, | |||
959853672600B8E200B1534A /* SearchDeviceVC.m */, | |||
959853682600B8E200B1534A /* SetUserViewController.h */, | |||
959853642600B8E200B1534A /* SetUserViewController.m */, | |||
959853622600B8E200B1534A /* SetUserViewController.xib */, | |||
); | |||
path = BleScale; | |||
sourceTree = "<group>"; | |||
}; | |||
/* End PBXGroup section */ | |||
/* Begin PBXNativeTarget section */ | |||
959853462600B7F000B1534A /* BodyfatScaleDemo_swift */ = { | |||
isa = PBXNativeTarget; | |||
buildConfigurationList = 9598535B2600B7F200B1534A /* Build configuration list for PBXNativeTarget "BodyfatScaleDemo_swift" */; | |||
buildPhases = ( | |||
959853432600B7F000B1534A /* Sources */, | |||
959853442600B7F000B1534A /* Frameworks */, | |||
959853452600B7F000B1534A /* Resources */, | |||
); | |||
buildRules = ( | |||
); | |||
dependencies = ( | |||
); | |||
name = BodyfatScaleDemo_swift; | |||
productName = BodyfatScaleDemo_swift; | |||
productReference = 959853472600B7F000B1534A /* BodyfatScaleDemo_swift.app */; | |||
productType = "com.apple.product-type.application"; | |||
}; | |||
/* End PBXNativeTarget section */ | |||
/* Begin PBXProject section */ | |||
9598533F2600B7F000B1534A /* Project object */ = { | |||
isa = PBXProject; | |||
attributes = { | |||
LastSwiftUpdateCheck = 1230; | |||
LastUpgradeCheck = 1230; | |||
TargetAttributes = { | |||
959853462600B7F000B1534A = { | |||
CreatedOnToolsVersion = 12.3; | |||
}; | |||
}; | |||
}; | |||
buildConfigurationList = 959853422600B7F000B1534A /* Build configuration list for PBXProject "BodyfatScaleDemo_swift" */; | |||
compatibilityVersion = "Xcode 9.3"; | |||
developmentRegion = en; | |||
hasScannedForEncodings = 0; | |||
knownRegions = ( | |||
en, | |||
Base, | |||
); | |||
mainGroup = 9598533E2600B7F000B1534A; | |||
productRefGroup = 959853482600B7F000B1534A /* Products */; | |||
projectDirPath = ""; | |||
projectRoot = ""; | |||
targets = ( | |||
959853462600B7F000B1534A /* BodyfatScaleDemo_swift */, | |||
); | |||
}; | |||
/* End PBXProject section */ | |||
/* Begin PBXResourcesBuildPhase section */ | |||
959853452600B7F000B1534A /* Resources */ = { | |||
isa = PBXResourcesBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
9598536B2600B8E200B1534A /* SetUserViewController.xib in Resources */, | |||
959853572600B7F200B1534A /* LaunchScreen.storyboard in Resources */, | |||
959853542600B7F200B1534A /* Assets.xcassets in Resources */, | |||
959853522600B7F000B1534A /* Main.storyboard in Resources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXResourcesBuildPhase section */ | |||
/* Begin PBXSourcesBuildPhase section */ | |||
959853432600B7F000B1534A /* Sources */ = { | |||
isa = PBXSourcesBuildPhase; | |||
buildActionMask = 2147483647; | |||
files = ( | |||
9598536E2600B8E200B1534A /* AppUser.m in Sources */, | |||
9598536C2600B8E200B1534A /* SetUserViewController.m in Sources */, | |||
9598534F2600B7F000B1534A /* ViewController.swift in Sources */, | |||
9598536F2600B8E200B1534A /* SearchDeviceVC.m in Sources */, | |||
9598534B2600B7F000B1534A /* AppDelegate.swift in Sources */, | |||
9598536D2600B8E200B1534A /* MainViewController.m in Sources */, | |||
); | |||
runOnlyForDeploymentPostprocessing = 0; | |||
}; | |||
/* End PBXSourcesBuildPhase section */ | |||
/* Begin PBXVariantGroup section */ | |||
959853502600B7F000B1534A /* Main.storyboard */ = { | |||
isa = PBXVariantGroup; | |||
children = ( | |||
959853512600B7F000B1534A /* Base */, | |||
); | |||
name = Main.storyboard; | |||
sourceTree = "<group>"; | |||
}; | |||
959853552600B7F200B1534A /* LaunchScreen.storyboard */ = { | |||
isa = PBXVariantGroup; | |||
children = ( | |||
959853562600B7F200B1534A /* Base */, | |||
); | |||
name = LaunchScreen.storyboard; | |||
sourceTree = "<group>"; | |||
}; | |||
/* End PBXVariantGroup section */ | |||
/* Begin XCBuildConfiguration section */ | |||
959853592600B7F200B1534A /* Debug */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ALWAYS_SEARCH_USER_PATHS = NO; | |||
CLANG_ANALYZER_NONNULL = YES; | |||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | |||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | |||
CLANG_CXX_LIBRARY = "libc++"; | |||
CLANG_ENABLE_MODULES = YES; | |||
CLANG_ENABLE_OBJC_ARC = YES; | |||
CLANG_ENABLE_OBJC_WEAK = YES; | |||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
CLANG_WARN_BOOL_CONVERSION = YES; | |||
CLANG_WARN_COMMA = YES; | |||
CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | |||
CLANG_WARN_EMPTY_BODY = YES; | |||
CLANG_WARN_ENUM_CONVERSION = YES; | |||
CLANG_WARN_INFINITE_RECURSION = YES; | |||
CLANG_WARN_INT_CONVERSION = YES; | |||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | |||
CLANG_WARN_UNREACHABLE_CODE = YES; | |||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
COPY_PHASE_STRIP = NO; | |||
DEBUG_INFORMATION_FORMAT = dwarf; | |||
ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
ENABLE_TESTABILITY = YES; | |||
GCC_C_LANGUAGE_STANDARD = gnu11; | |||
GCC_DYNAMIC_NO_PIC = NO; | |||
GCC_NO_COMMON_BLOCKS = YES; | |||
GCC_OPTIMIZATION_LEVEL = 0; | |||
GCC_PREPROCESSOR_DEFINITIONS = ( | |||
"DEBUG=1", | |||
"$(inherited)", | |||
); | |||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
GCC_WARN_UNUSED_FUNCTION = YES; | |||
GCC_WARN_UNUSED_VARIABLE = YES; | |||
IPHONEOS_DEPLOYMENT_TARGET = 9.0; | |||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; | |||
MTL_FAST_MATH = YES; | |||
ONLY_ACTIVE_ARCH = YES; | |||
SDKROOT = iphoneos; | |||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; | |||
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | |||
}; | |||
name = Debug; | |||
}; | |||
9598535A2600B7F200B1534A /* Release */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ALWAYS_SEARCH_USER_PATHS = NO; | |||
CLANG_ANALYZER_NONNULL = YES; | |||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; | |||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; | |||
CLANG_CXX_LIBRARY = "libc++"; | |||
CLANG_ENABLE_MODULES = YES; | |||
CLANG_ENABLE_OBJC_ARC = YES; | |||
CLANG_ENABLE_OBJC_WEAK = YES; | |||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; | |||
CLANG_WARN_BOOL_CONVERSION = YES; | |||
CLANG_WARN_COMMA = YES; | |||
CLANG_WARN_CONSTANT_CONVERSION = YES; | |||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; | |||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; | |||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; | |||
CLANG_WARN_EMPTY_BODY = YES; | |||
CLANG_WARN_ENUM_CONVERSION = YES; | |||
CLANG_WARN_INFINITE_RECURSION = YES; | |||
CLANG_WARN_INT_CONVERSION = YES; | |||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; | |||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; | |||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; | |||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; | |||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; | |||
CLANG_WARN_STRICT_PROTOTYPES = YES; | |||
CLANG_WARN_SUSPICIOUS_MOVE = YES; | |||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; | |||
CLANG_WARN_UNREACHABLE_CODE = YES; | |||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; | |||
COPY_PHASE_STRIP = NO; | |||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; | |||
ENABLE_NS_ASSERTIONS = NO; | |||
ENABLE_STRICT_OBJC_MSGSEND = YES; | |||
GCC_C_LANGUAGE_STANDARD = gnu11; | |||
GCC_NO_COMMON_BLOCKS = YES; | |||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; | |||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; | |||
GCC_WARN_UNDECLARED_SELECTOR = YES; | |||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | |||
GCC_WARN_UNUSED_FUNCTION = YES; | |||
GCC_WARN_UNUSED_VARIABLE = YES; | |||
IPHONEOS_DEPLOYMENT_TARGET = 9.0; | |||
MTL_ENABLE_DEBUG_INFO = NO; | |||
MTL_FAST_MATH = YES; | |||
SDKROOT = iphoneos; | |||
SWIFT_COMPILATION_MODE = wholemodule; | |||
SWIFT_OPTIMIZATION_LEVEL = "-O"; | |||
VALIDATE_PRODUCT = YES; | |||
}; | |||
name = Release; | |||
}; | |||
9598535C2600B7F200B1534A /* Debug */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | |||
CODE_SIGN_STYLE = Automatic; | |||
DEVELOPMENT_TEAM = YEU77XR292; | |||
FRAMEWORK_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(PROJECT_DIR)/BodyfatScaleDemo_swift/BleScale", | |||
); | |||
INFOPLIST_FILE = BodyfatScaleDemo_swift/Info.plist; | |||
LD_RUNPATH_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"@executable_path/Frameworks", | |||
); | |||
PRODUCT_BUNDLE_IDENTIFIER = "com.elinkthings.BodyfatScaleDemo-swift"; | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/BodyfatScaleDemo_swift/Bridging-Header.h"; | |||
SWIFT_VERSION = 5.0; | |||
TARGETED_DEVICE_FAMILY = "1,2"; | |||
}; | |||
name = Debug; | |||
}; | |||
9598535D2600B7F200B1534A /* Release */ = { | |||
isa = XCBuildConfiguration; | |||
buildSettings = { | |||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | |||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; | |||
CODE_SIGN_STYLE = Automatic; | |||
DEVELOPMENT_TEAM = YEU77XR292; | |||
FRAMEWORK_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"$(PROJECT_DIR)/BodyfatScaleDemo_swift/BleScale", | |||
); | |||
INFOPLIST_FILE = BodyfatScaleDemo_swift/Info.plist; | |||
LD_RUNPATH_SEARCH_PATHS = ( | |||
"$(inherited)", | |||
"@executable_path/Frameworks", | |||
); | |||
PRODUCT_BUNDLE_IDENTIFIER = "com.elinkthings.BodyfatScaleDemo-swift"; | |||
PRODUCT_NAME = "$(TARGET_NAME)"; | |||
SWIFT_OBJC_BRIDGING_HEADER = "$(SRCROOT)/BodyfatScaleDemo_swift/Bridging-Header.h"; | |||
SWIFT_VERSION = 5.0; | |||
TARGETED_DEVICE_FAMILY = "1,2"; | |||
}; | |||
name = Release; | |||
}; | |||
/* End XCBuildConfiguration section */ | |||
/* Begin XCConfigurationList section */ | |||
959853422600B7F000B1534A /* Build configuration list for PBXProject "BodyfatScaleDemo_swift" */ = { | |||
isa = XCConfigurationList; | |||
buildConfigurations = ( | |||
959853592600B7F200B1534A /* Debug */, | |||
9598535A2600B7F200B1534A /* Release */, | |||
); | |||
defaultConfigurationIsVisible = 0; | |||
defaultConfigurationName = Release; | |||
}; | |||
9598535B2600B7F200B1534A /* Build configuration list for PBXNativeTarget "BodyfatScaleDemo_swift" */ = { | |||
isa = XCConfigurationList; | |||
buildConfigurations = ( | |||
9598535C2600B7F200B1534A /* Debug */, | |||
9598535D2600B7F200B1534A /* Release */, | |||
); | |||
defaultConfigurationIsVisible = 0; | |||
defaultConfigurationName = Release; | |||
}; | |||
/* End XCConfigurationList section */ | |||
}; | |||
rootObject = 9598533F2600B7F000B1534A /* Project object */; | |||
} |
@@ -0,0 +1,7 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<Workspace | |||
version = "1.0"> | |||
<FileRef | |||
location = "self:"> | |||
</FileRef> | |||
</Workspace> |
@@ -0,0 +1,8 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>IDEDidComputeMac32BitWarning</key> | |||
<true/> | |||
</dict> | |||
</plist> |
@@ -0,0 +1,14 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>SchemeUserState</key> | |||
<dict> | |||
<key>BodyfatScaleDemo_swift.xcscheme_^#shared#^_</key> | |||
<dict> | |||
<key>orderHint</key> | |||
<integer>0</integer> | |||
</dict> | |||
</dict> | |||
</dict> | |||
</plist> |
@@ -0,0 +1,22 @@ | |||
// | |||
// AppDelegate.swift | |||
// BodyfatScaleDemo_swift | |||
// | |||
// Created by steven wu on 2021/3/16. | |||
// | |||
import UIKit | |||
@main | |||
class AppDelegate: UIResponder, UIApplicationDelegate { | |||
var window: UIWindow? | |||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |||
// Override point for customization after application launch. | |||
return true | |||
} | |||
} | |||
@@ -0,0 +1,11 @@ | |||
{ | |||
"colors" : [ | |||
{ | |||
"idiom" : "universal" | |||
} | |||
], | |||
"info" : { | |||
"author" : "xcode", | |||
"version" : 1 | |||
} | |||
} |
@@ -0,0 +1,98 @@ | |||
{ | |||
"images" : [ | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "2x", | |||
"size" : "20x20" | |||
}, | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "3x", | |||
"size" : "20x20" | |||
}, | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "2x", | |||
"size" : "29x29" | |||
}, | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "3x", | |||
"size" : "29x29" | |||
}, | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "2x", | |||
"size" : "40x40" | |||
}, | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "3x", | |||
"size" : "40x40" | |||
}, | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "2x", | |||
"size" : "60x60" | |||
}, | |||
{ | |||
"idiom" : "iphone", | |||
"scale" : "3x", | |||
"size" : "60x60" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "1x", | |||
"size" : "20x20" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "2x", | |||
"size" : "20x20" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "1x", | |||
"size" : "29x29" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "2x", | |||
"size" : "29x29" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "1x", | |||
"size" : "40x40" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "2x", | |||
"size" : "40x40" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "1x", | |||
"size" : "76x76" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "2x", | |||
"size" : "76x76" | |||
}, | |||
{ | |||
"idiom" : "ipad", | |||
"scale" : "2x", | |||
"size" : "83.5x83.5" | |||
}, | |||
{ | |||
"idiom" : "ios-marketing", | |||
"scale" : "1x", | |||
"size" : "1024x1024" | |||
} | |||
], | |||
"info" : { | |||
"author" : "xcode", | |||
"version" : 1 | |||
} | |||
} |
@@ -0,0 +1,6 @@ | |||
{ | |||
"info" : { | |||
"author" : "xcode", | |||
"version" : 1 | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | |||
<device id="retina4_7" orientation="portrait"> | |||
<adaptation id="fullscreen"/> | |||
</device> | |||
<dependencies> | |||
<deployment identifier="iOS"/> | |||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/> | |||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |||
</dependencies> | |||
<scenes> | |||
<!--View Controller--> | |||
<scene sceneID="EHf-IW-A2E"> | |||
<objects> | |||
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> | |||
<layoutGuides> | |||
<viewControllerLayoutGuide type="top" id="Yjt-lG-WWf"/> | |||
<viewControllerLayoutGuide type="bottom" id="0qM-4s-Ocv"/> | |||
</layoutGuides> | |||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | |||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
</view> | |||
</viewController> | |||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | |||
</objects> | |||
<point key="canvasLocation" x="53" y="375"/> | |||
</scene> | |||
</scenes> | |||
</document> |
@@ -0,0 +1,193 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="lGz-vQ-rIV"> | |||
<device id="retina4_7" orientation="portrait" appearance="light"/> | |||
<dependencies> | |||
<deployment identifier="iOS"/> | |||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/> | |||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |||
</dependencies> | |||
<scenes> | |||
<!--Main View Controller--> | |||
<scene sceneID="M5v-mj-yx8"> | |||
<objects> | |||
<viewController id="lGz-vQ-rIV" customClass="MainViewController" sceneMemberID="viewController"> | |||
<layoutGuides> | |||
<viewControllerLayoutGuide type="top" id="lRu-BS-3Ti"/> | |||
<viewControllerLayoutGuide type="bottom" id="MN7-HW-Fpp"/> | |||
</layoutGuides> | |||
<view key="view" contentMode="scaleToFill" id="NkZ-Gv-FdY"> | |||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | |||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |||
<subviews> | |||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5Kt-f7-SXj"> | |||
<rect key="frame" x="10" y="5" width="355" height="35"/> | |||
<color key="backgroundColor" red="0.81568627450980391" green="1" blue="0.88235294117647056" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<constraints> | |||
<constraint firstAttribute="height" constant="35" id="rKn-Ml-Igo"/> | |||
</constraints> | |||
<state key="normal" title="Connect Device"/> | |||
<connections> | |||
<action selector="Click_Ble:" destination="lGz-vQ-rIV" eventType="touchUpInside" id="Ht0-QE-HDi"/> | |||
</connections> | |||
</button> | |||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bzc-dA-DuA" userLabel="隔栏--------"> | |||
<rect key="frame" x="0.0" y="50" width="375" height="5"/> | |||
<color key="backgroundColor" red="0.66666668650000005" green="0.66666668650000005" blue="0.66666668650000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<constraints> | |||
<constraint firstAttribute="height" constant="5" id="Tgt-tF-HS7"/> | |||
</constraints> | |||
</view> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="User Info ->" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="78Y-KE-lWH"> | |||
<rect key="frame" x="10" y="60" width="90" height="30"/> | |||
<constraints> | |||
<constraint firstAttribute="width" constant="90" id="3zK-me-rOk"/> | |||
<constraint firstAttribute="height" constant="30" id="Txo-Ni-992"/> | |||
</constraints> | |||
<fontDescription key="fontDescription" type="system" pointSize="16"/> | |||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Unit:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gVu-AQ-2bu"> | |||
<rect key="frame" x="10" y="170" width="65" height="28"/> | |||
<constraints> | |||
<constraint firstAttribute="width" constant="65" id="B19-2X-DQV"/> | |||
<constraint firstAttribute="height" constant="28" id="sd6-bi-owp"/> | |||
</constraints> | |||
<fontDescription key="fontDescription" type="system" pointSize="15"/> | |||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="Zf3-rF-BZy"> | |||
<rect key="frame" x="83" y="168.5" width="276" height="32"/> | |||
<segments> | |||
<segment title="KG"/> | |||
<segment title="LB"/> | |||
<segment title="ST"/> | |||
<segment title="斤"/> | |||
</segments> | |||
<connections> | |||
<action selector="ChooseUnit:" destination="lGz-vQ-rIV" eventType="valueChanged" id="79T-rr-7H1"/> | |||
</connections> | |||
</segmentedControl> | |||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="MRu-AK-Tza" userLabel="隔栏--------"> | |||
<rect key="frame" x="0.0" y="208" width="375" height="6"/> | |||
<color key="backgroundColor" red="0.66666668650000005" green="0.66666668650000005" blue="0.66666668650000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<constraints> | |||
<constraint firstAttribute="height" constant="6" id="4EE-XR-4yP"/> | |||
</constraints> | |||
</view> | |||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="waM-g5-AjV"> | |||
<rect key="frame" x="0.0" y="220" width="375" height="447"/> | |||
<subviews> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tips" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xbU-hm-1Sk"> | |||
<rect key="frame" x="5" y="0.0" width="365" height="30"/> | |||
<constraints> | |||
<constraint firstAttribute="height" constant="30" id="esF-6v-SVM"/> | |||
</constraints> | |||
<fontDescription key="fontDescription" type="system" pointSize="16"/> | |||
<color key="textColor" red="1" green="0.14913141730000001" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="vMl-1e-9Hx"> | |||
<rect key="frame" x="0.0" y="30" width="375" height="407"/> | |||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |||
</tableView> | |||
</subviews> | |||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | |||
<constraints> | |||
<constraint firstItem="xbU-hm-1Sk" firstAttribute="leading" secondItem="waM-g5-AjV" secondAttribute="leading" constant="5" id="3Qn-be-kyt"/> | |||
<constraint firstAttribute="bottom" secondItem="vMl-1e-9Hx" secondAttribute="bottom" constant="10" id="5QN-18-odJ"/> | |||
<constraint firstItem="vMl-1e-9Hx" firstAttribute="top" secondItem="xbU-hm-1Sk" secondAttribute="bottom" id="83E-Fz-Bra"/> | |||
<constraint firstItem="vMl-1e-9Hx" firstAttribute="leading" secondItem="waM-g5-AjV" secondAttribute="leading" id="9Rx-s5-oHi"/> | |||
<constraint firstItem="xbU-hm-1Sk" firstAttribute="top" secondItem="waM-g5-AjV" secondAttribute="top" id="PYj-lG-nd1"/> | |||
<constraint firstAttribute="trailing" secondItem="vMl-1e-9Hx" secondAttribute="trailing" id="SYO-6O-Shx"/> | |||
<constraint firstAttribute="trailing" secondItem="xbU-hm-1Sk" secondAttribute="trailing" constant="5" id="Sjv-QS-PGB"/> | |||
</constraints> | |||
</view> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6kj-dC-o6z"> | |||
<rect key="frame" x="127.5" y="60" width="120" height="95.5"/> | |||
<constraints> | |||
<constraint firstAttribute="width" constant="120" id="kds-sZ-9g0"/> | |||
</constraints> | |||
<string key="text">sex: 1 | |||
age:25 | |||
height:175 | |||
weight:72.0 | |||
adc:560</string> | |||
<fontDescription key="fontDescription" type="system" pointSize="16"/> | |||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="b8T-HZ-nQw"> | |||
<rect key="frame" x="259" y="60" width="100" height="36"/> | |||
<color key="backgroundColor" red="0.81568627450980391" green="1" blue="0.88235294117647056" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<constraints> | |||
<constraint firstAttribute="width" constant="100" id="7U3-92-1Rg"/> | |||
<constraint firstAttribute="height" constant="36" id="XdX-rU-8wF"/> | |||
</constraints> | |||
<fontDescription key="fontDescription" type="system" pointSize="16"/> | |||
<state key="normal" title="Edit User"/> | |||
<connections> | |||
<action selector="editUser:" destination="lGz-vQ-rIV" eventType="touchUpInside" id="xiI-7j-PIm"/> | |||
</connections> | |||
</button> | |||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="AC6-pg-HuU"> | |||
<rect key="frame" x="259" y="119.5" width="100" height="36"/> | |||
<color key="backgroundColor" red="0.81568627449999997" green="1" blue="0.88235294119999996" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<constraints> | |||
<constraint firstAttribute="height" constant="36" id="TDZ-9A-76t"/> | |||
<constraint firstAttribute="width" constant="100" id="nw2-0K-gzB"/> | |||
</constraints> | |||
<fontDescription key="fontDescription" type="system" pointSize="10"/> | |||
<state key="normal" title="Get Offline History"/> | |||
<connections> | |||
<action selector="getOfflineHistory:" destination="lGz-vQ-rIV" eventType="touchUpInside" id="TGf-qU-nCH"/> | |||
</connections> | |||
</button> | |||
</subviews> | |||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<constraints> | |||
<constraint firstItem="bzc-dA-DuA" firstAttribute="leading" secondItem="NkZ-Gv-FdY" secondAttribute="leading" id="3Lt-dy-cm0"/> | |||
<constraint firstAttribute="trailing" secondItem="b8T-HZ-nQw" secondAttribute="trailing" constant="16" id="3Nz-EU-lFt"/> | |||
<constraint firstAttribute="trailing" secondItem="bzc-dA-DuA" secondAttribute="trailing" id="5lo-tb-HYQ"/> | |||
<constraint firstItem="78Y-KE-lWH" firstAttribute="top" secondItem="bzc-dA-DuA" secondAttribute="bottom" constant="5" id="B0k-kZ-Qh3"/> | |||
<constraint firstItem="AC6-pg-HuU" firstAttribute="bottom" secondItem="6kj-dC-o6z" secondAttribute="bottom" id="EL7-Oj-rr0"/> | |||
<constraint firstItem="gVu-AQ-2bu" firstAttribute="top" secondItem="78Y-KE-lWH" secondAttribute="bottom" constant="80" id="EQV-SW-PC5"/> | |||
<constraint firstItem="6kj-dC-o6z" firstAttribute="top" secondItem="78Y-KE-lWH" secondAttribute="top" id="GwU-eR-QsS"/> | |||
<constraint firstAttribute="trailing" secondItem="5Kt-f7-SXj" secondAttribute="trailing" constant="10" id="KlA-QB-HSu"/> | |||
<constraint firstItem="6kj-dC-o6z" firstAttribute="leading" secondItem="78Y-KE-lWH" secondAttribute="trailing" constant="27.5" id="OjO-jw-djP"/> | |||
<constraint firstItem="78Y-KE-lWH" firstAttribute="leading" secondItem="NkZ-Gv-FdY" secondAttribute="leading" constant="10" id="QB9-im-L5N"/> | |||
<constraint firstAttribute="trailing" secondItem="MRu-AK-Tza" secondAttribute="trailing" id="QeK-C3-Lrf"/> | |||
<constraint firstItem="Zf3-rF-BZy" firstAttribute="leading" secondItem="gVu-AQ-2bu" secondAttribute="trailing" constant="8" id="RCk-og-j5B"/> | |||
<constraint firstItem="5Kt-f7-SXj" firstAttribute="leading" secondItem="NkZ-Gv-FdY" secondAttribute="leading" constant="10" id="Rla-9j-jdj"/> | |||
<constraint firstItem="gVu-AQ-2bu" firstAttribute="leading" secondItem="78Y-KE-lWH" secondAttribute="leading" id="TLW-5V-lLv"/> | |||
<constraint firstAttribute="trailing" secondItem="Zf3-rF-BZy" secondAttribute="trailing" constant="16" id="UZu-dr-qec"/> | |||
<constraint firstItem="Zf3-rF-BZy" firstAttribute="centerY" secondItem="gVu-AQ-2bu" secondAttribute="centerY" id="Z3a-qD-19b"/> | |||
<constraint firstItem="waM-g5-AjV" firstAttribute="top" secondItem="MRu-AK-Tza" secondAttribute="bottom" constant="6" id="cFk-yZ-hTb"/> | |||
<constraint firstItem="MRu-AK-Tza" firstAttribute="top" secondItem="gVu-AQ-2bu" secondAttribute="bottom" constant="10" id="cQ0-3t-WFB"/> | |||
<constraint firstItem="bzc-dA-DuA" firstAttribute="top" secondItem="5Kt-f7-SXj" secondAttribute="bottom" constant="10" id="dZU-C7-vgj"/> | |||
<constraint firstItem="MN7-HW-Fpp" firstAttribute="top" secondItem="waM-g5-AjV" secondAttribute="bottom" id="fVN-gd-61G"/> | |||
<constraint firstItem="MRu-AK-Tza" firstAttribute="leading" secondItem="NkZ-Gv-FdY" secondAttribute="leading" id="jXP-c0-g9T"/> | |||
<constraint firstItem="waM-g5-AjV" firstAttribute="leading" secondItem="NkZ-Gv-FdY" secondAttribute="leading" id="lVq-CY-oPR"/> | |||
<constraint firstAttribute="trailing" secondItem="AC6-pg-HuU" secondAttribute="trailing" constant="16" id="loL-Ht-lA7"/> | |||
<constraint firstItem="b8T-HZ-nQw" firstAttribute="top" secondItem="6kj-dC-o6z" secondAttribute="top" id="pAg-79-qZn"/> | |||
<constraint firstItem="78Y-KE-lWH" firstAttribute="leading" secondItem="5Kt-f7-SXj" secondAttribute="leading" id="rSV-bQ-38y"/> | |||
<constraint firstItem="5Kt-f7-SXj" firstAttribute="top" secondItem="lRu-BS-3Ti" secondAttribute="bottom" constant="5" id="sU1-UF-vn7"/> | |||
<constraint firstAttribute="trailing" secondItem="waM-g5-AjV" secondAttribute="trailing" id="xLI-R1-Qbc"/> | |||
</constraints> | |||
</view> | |||
<navigationItem key="navigationItem" id="kGm-2k-A3l"/> | |||
<connections> | |||
<outlet property="connectedDevicesButton" destination="5Kt-f7-SXj" id="DM6-Vv-YYE"/> | |||
<outlet property="tableView" destination="vMl-1e-9Hx" id="fsv-7u-yZ5"/> | |||
<outlet property="tipLB" destination="xbU-hm-1Sk" id="TZg-UN-EyA"/> | |||
<outlet property="unitSegmentedControl" destination="Zf3-rF-BZy" id="4dh-d2-rI7"/> | |||
<outlet property="userInfoLabel" destination="6kj-dC-o6z" id="Fw2-3H-dxU"/> | |||
</connections> | |||
</viewController> | |||
<placeholder placeholderIdentifier="IBFirstResponder" id="crl-Of-xUZ" sceneMemberID="firstResponder"/> | |||
</objects> | |||
<point key="canvasLocation" x="-738.39999999999998" y="84.107946026986511"/> | |||
</scene> | |||
</scenes> | |||
</document> |
@@ -0,0 +1,27 @@ | |||
// | |||
// AppUser.h | |||
// AIFit-Demo | |||
// | |||
// Created by steven wu on 2019/12/19. | |||
// Copyright © 2019 wujia121. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface AppUser : NSObject | |||
@property (nonatomic, assign) float weightKg; | |||
/**Be Noted: | |||
male: 1 female: 2 | |||
*/ | |||
@property (nonatomic, assign) int sex; | |||
@property (nonatomic, assign) int age; | |||
@property (nonatomic, assign) int height; | |||
@property (nonatomic, assign) int adc; | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,13 @@ | |||
// | |||
// AppUser.m | |||
// AIFit-Demo | |||
// | |||
// Created by steven wu on 2019/12/19. | |||
// Copyright © 2019 wujia121. All rights reserved. | |||
// | |||
#import "AppUser.h" | |||
@implementation AppUser | |||
@end |
@@ -0,0 +1,65 @@ | |||
// | |||
// Algorithm.h | |||
// Created by steven wu on 2019/6/25. | |||
// | |||
#import <Foundation/Foundation.h> | |||
typedef NS_ENUM(NSInteger, AlgUserSex) { | |||
AlgUserSex_Male = 1, | |||
AlgUserSex_Female = 2, | |||
}; | |||
@interface AlgorithmModel : NSObject | |||
///bmi | |||
@property (nonatomic, copy) NSString *bmi; | |||
///体脂率 bodyfatRate | |||
@property (nonatomic, copy) NSString *bfr; | |||
///皮下脂肪率 subcutaneousFat rate | |||
@property (nonatomic, copy) NSString *sfr; | |||
///内脏脂肪率 visceralFat rate | |||
@property (nonatomic, copy) NSString *uvi; | |||
///肌肉率 muscle rate | |||
@property (nonatomic, copy) NSString *rom; | |||
///基础代谢率 BMR | |||
@property (nonatomic, copy) NSString *bmr; | |||
///骨骼质量 boneMass | |||
@property (nonatomic, copy) NSString *bm; | |||
///水含量vwc: moisture | |||
@property (nonatomic, copy) NSString *vwc; | |||
///身体年龄 physicalAge | |||
@property (nonatomic, assign) NSString *physicalAge; | |||
///蛋白率 proteinRate | |||
@property (nonatomic, copy) NSString *pp; | |||
/* For example | |||
bmi : 23.7; | |||
bfr : 22.2; | |||
rom : 51; | |||
vwc : 57; | |||
bm : 2.8; | |||
sfr : 19.9; | |||
bmi : 1549; | |||
pp : 16.6; | |||
uvi : 7; | |||
physicalAge : 26; | |||
*/ | |||
@end | |||
@interface AlgorithmSDK : NSObject | |||
/** | |||
* Inet AlgorithmSDK 品网算法 | |||
* Incoming user information + adc, calculate 10 original body fat data (the connected scale is calculated by the scale end and transmitted to the app via Bluetooth, and the broadcast scale calls this SDK calculation) 传入用户信息+adc,计算出10项原始体脂数据(连接秤由秤端计算并蓝牙传给app,广播秤调用本SDK计算) | |||
* eg: | |||
* kgWeight: 50.6 age: 25 height: 175 | |||
*/ | |||
+ (AlgorithmModel *)getBodyfatWithWeight:(double)kgWeight adc:(int)adc sex:(AlgUserSex)sex age:(int)age height:(int)height; | |||
@end | |||
@@ -0,0 +1,54 @@ | |||
// | |||
// InetBleSDK | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import <UIKit/UIKit.h> | |||
@class UserInfoModel; | |||
/** | |||
Note: | |||
linkScale has all below status, but broadcastScale just has //b1,b2,b3 | |||
*/ | |||
typedef NS_ENUM(NSInteger, BleDataAnalysisStatus) { | |||
BleDataAnalysisStatus_SyncTimeSuccess, | |||
BleDataAnalysisStatus_SyncTimeFailed, //lead to error measureTime | |||
BleDataAnalysisStatus_SyncUserSuccess, | |||
BleDataAnalysisStatus_SyncUserFailed, //lead to no bodydata, just weight | |||
BleDataAnalysisStatus_UnstableWeight, //b1 | |||
BleDataAnalysisStatus_StableWeight, //b2 | |||
BleDataAnalysisStatus_MeasureComplete, //b3 | |||
BleDataAnalysisStatus_AdcError, | |||
BleDataAnalysisStatus_LightOff, | |||
}; | |||
@class AnalysisBLEDataManager; | |||
@protocol AnalysisBLEDataManagerDelegate <NSObject> | |||
@optional | |||
- (void)AnalysisBLEDataManager:(AnalysisBLEDataManager *)analysisManager updateBleDataAnalysisStatus:(BleDataAnalysisStatus)bleDataAnalysisStatus; | |||
- (void)AnalysisBLEDataManager:(AnalysisBLEDataManager *)analysisManager updateMeasureUserInfo:(UserInfoModel *)infoModel; | |||
///If no need offline history function, do not implement this callback | |||
- (void)AnalysisBLEDataManager:(AnalysisBLEDataManager *)analysisManager backOfflineHistorys:(NSMutableArray <UserInfoModel *> *)historysMutableArr; | |||
@end | |||
@interface AnalysisBLEDataManager : NSObject | |||
+ (instancetype)shareManager; | |||
@property (nonatomic, weak) id<AnalysisBLEDataManagerDelegate> infoDelegate; | |||
@end |
@@ -0,0 +1,39 @@ | |||
// | |||
// InetBleSDK | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
@interface BLEUser : NSObject | |||
/** | |||
eg: male:1, femail: 2 | |||
*/ | |||
@property (nonatomic, assign) int userSex; | |||
/** | |||
eg: 26 | |||
*/ | |||
@property (nonatomic, assign) int userAge; | |||
/** | |||
eg: 175 | |||
*/ | |||
@property (nonatomic, assign) int userHeight; | |||
/** | |||
eg: 56.5kg | |||
*/ | |||
@property (nonatomic, assign) float userWeight; | |||
/** | |||
eg: 560 | |||
*/ | |||
@property (nonatomic, assign) int userAdc; | |||
@end |
@@ -0,0 +1,86 @@ | |||
// | |||
// BfsCalculateSDK | |||
// Created by steven wu on 2019/6/25. | |||
// | |||
#import <Foundation/Foundation.h> | |||
typedef NS_ENUM(NSInteger, BfsUserSex) { | |||
BfsUserSex_Male = 1, | |||
BfsUserSex_Female = 2, | |||
}; | |||
@interface BfsCalculateItem : NSObject | |||
/** | |||
* 标准体重 standardWeight | |||
*/ | |||
@property (nonatomic, assign) double standardWeight; | |||
/** | |||
* 体重控制量 weightControl | |||
*/ | |||
@property (nonatomic, assign) double weightControl; | |||
/** | |||
* 脂肪量 fatMass | |||
*/ | |||
@property (nonatomic, assign) double fatMass; | |||
/** | |||
* 去脂体重 weightWithoutFat | |||
*/ | |||
@property (nonatomic, assign) double weightWithoutFat; | |||
/** | |||
* 肌肉量 muscleMass | |||
*/ | |||
@property (nonatomic, assign) double muscleMass; | |||
/** | |||
* 蛋白量 proteinMass | |||
*/ | |||
@property (nonatomic, assign) double proteinMass; | |||
/** | |||
* 肥胖等级 fatlevel | |||
* 1.标准 standard | |||
* 2.偏瘦 thin | |||
* 3.偏重 over weight | |||
* 4.体重不足 insufficient | |||
* 5.超重 Severely overweight | |||
*/ | |||
@property (nonatomic, assign) NSInteger fatlevel; | |||
/** For example | |||
(double) _standardWeight = 66.5 | |||
(double) _weightControl = 6.1999998092651367 | |||
(double) _fatMass = 16.100000381469727 | |||
(double) _weightWithoutFat = 56.599998474121094 | |||
(double) _muscleMass = 37.099998474121094 | |||
(double) _proteinMass = 12.100000381469727 | |||
(NSInteger) _fatlevel = 1 | |||
*/ | |||
@end | |||
@interface BfsCalculateSDK : NSObject | |||
/** | |||
* According to the bfr / rom / pp in the basic parameters returned by the scale, calculate 7 additional items that the App needs to display 根据秤返回的基本参数中的bfr/rom/pp,计算出App需要额外显示的7个项目 | |||
*@param sex | |||
* 性别: 男:1 女 2 | |||
* @param height | |||
* 身高:1~270(CM) | |||
* @param weight | |||
* 体重:1~220(KG) | |||
* @param bfr | |||
* 体脂率 43.6 | |||
* @param rom | |||
* 肌肉率 55.2 | |||
* @param pp | |||
* 蛋白率 25.9 | |||
* @return BfsCalculateItem | |||
*/ | |||
+ (BfsCalculateItem *)getBodyfatItemWithSex:(BfsUserSex)sex height:(NSInteger)height weight:(double)weight bfr:(NSString *)bfr rom:(NSString *)rom pp:(NSString *)pp; | |||
@end |
@@ -0,0 +1,60 @@ | |||
// | |||
// BleTools.h | |||
// GreatBody | |||
// | |||
// Created by steven wu on 2019/6/25. | |||
// | |||
#import <Foundation/Foundation.h> | |||
@interface BleTools : NSObject | |||
/** | |||
得到当前时间,年月日时分秒 | |||
*/ | |||
+ (NSString *)returnCurrentTime; | |||
/** | |||
计算两个时间的差值,单位:秒 | |||
*/ | |||
+ (NSString *)getTimeInterval:(NSString *)startTime end:(NSString *)endTime; | |||
/** | |||
十进制整数byte(0-255)转二进制字符串,如 255 =》@"11111111" | |||
*/ | |||
+ (NSString *)returnBinaryStringWithByte:(Byte)byte; | |||
/** | |||
二进制字符串 =》 十进制整数字符串,如 @"11111111" =》@"255" | |||
*/ | |||
+ (NSString *)toDecimalSystemWithBinarySystem:(NSString *)binary; | |||
/** | |||
蓝牙部分使用判断版本 | |||
*/ | |||
+ (NSInteger)compareDate:(NSString*)aDate withDate:(NSString*)bDate; | |||
///将传入的data转换为16进制字符串格式<xxxx xxxx> | |||
/// IOS13以后苹果修改了NSData的-description实现方式 | |||
/// iOS13之前:<ac02fa02 0000ccc8> | |||
/// iOS13之后:{length = 8, bytes = 0xac02fa020000ccc8} | |||
+ (NSString *)hexStrFromData:(NSData *)data; | |||
#pragma mark ============ 根据给定的原始kg整数(如565)、单位、小数点,转换为要显示的值(如56.5或8:12.6) ============== | |||
///getKg | |||
+ (NSString *)getKg_withKgSum:(NSString *)kgIntStr kgOriginDecimal:(NSInteger)kgOriginDecimal kgShowDecimal:(NSInteger)kgShowDecimal kggraduation:(NSInteger)kg_graduation lbgraduation:(NSInteger)lb_graduation isJin:(BOOL)jin; | |||
///getLb | |||
+ (NSString *)getLb_withKgSum:(NSString *)kgIntStr kgOriginDecimal:(NSInteger)kgOriginDecimal lbShowDecimal:(NSInteger)lbShowDecimal kggraduation:(NSInteger)kg_graduation lbgraduation:(NSInteger)lb_graduation; | |||
///getSt | |||
+ (NSString *)getSt_withKgSum:(NSString *)kgIntStr kgOriginDecimal:(NSInteger)kgOriginDecimal stShowDecimal:(NSInteger)stShowDecimal kggraduation:(NSInteger)kg_graduation lbgraduation:(NSInteger)lb_graduation; | |||
///getJin | |||
+ (NSString *)getJin_withKgSum:(NSString *)kgIntStr kgOriginDecimal:(NSInteger)kgOriginDecimal kgShowDecimal:(NSInteger)kgShowDecimal kggraduation:(NSInteger)kg_graduation lbgraduation:(NSInteger)lb_graduation isJin:(BOOL)jin; | |||
@end | |||
@@ -0,0 +1,53 @@ | |||
// | |||
// InetBleSDK | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import <CoreBluetooth/CoreBluetooth.h> | |||
@interface DeviceModel : NSObject | |||
@property(nonatomic, copy) NSString *deviceUUIDString; | |||
@property(nonatomic, copy) NSString *deviceName; | |||
/** | |||
ble scale type: | |||
0: broadcast | |||
1: broadcast(temperature) | |||
2: linkScale | |||
3: linkScale(temperature) | |||
*/ | |||
@property(nonatomic, strong) NSNumber *acNumber; | |||
@property(nonatomic, copy) NSString *deviceAddress; | |||
@property(nonatomic, assign) BOOL deviceIsLight; | |||
//algorithm(so far only used for BM15) | |||
//@property (nonatomic,assign) NSInteger Algorithm_number; | |||
//DID | |||
@property (nonatomic,assign) NSInteger DID_number; | |||
/** | |||
-centralManager:didDiscoverPeripheral:advertisementData:RSSI | |||
this DeviceModel created base on this peripheral | |||
*/ | |||
@property (strong, nonatomic) CBPeripheral *peripheral; | |||
@end | |||
/* | |||
deviceUUIDString : CA2A7E77-D709-4F29-1552-AE69BC4A3752; | |||
deviceName : SWAN; | |||
acNumber : 2; | |||
deviceAddress : 03:B3:EC:8F:70:76; | |||
deviceIsLight : 0; | |||
Algorithm_number : 0; | |||
DID_number : 0; | |||
*/ |
@@ -0,0 +1,62 @@ | |||
// | |||
// InetBleSDK | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
#import <CoreBluetooth/CoreBluetooth.h> | |||
@class UserInfoModel,DeviceModel; | |||
typedef NS_ENUM(NSInteger,BluetoothManagerState) { | |||
BluetoothManagerState_PowerOn, | |||
BluetoothManagerState_PowerOff, | |||
BluetoothManagerState_UnknowErr, | |||
BluetoothManagerState_StartScan, | |||
BluetoothManagerState_StopScan, | |||
BluetoothManagerState_ConnectSuccess, | |||
BluetoothManagerState_ConnectFailed, | |||
BluetoothManagerState_Disconnect | |||
}; | |||
@class INBluetoothManager; | |||
@protocol INBluetoothManagerDelegate <NSObject> | |||
@optional | |||
- (void)BluetoothManager:(INBluetoothManager *)manager didDiscoverDevice:(DeviceModel *)deviceModel; | |||
@optional | |||
- (void)BluetoothManager:(INBluetoothManager *)manager didConnectDevice:(DeviceModel *)deviceModel; | |||
@optional | |||
- (void)BluetoothManager:(INBluetoothManager *)manager updateCentralManagerState:(BluetoothManagerState)state; | |||
@end | |||
@interface INBluetoothManager : NSObject | |||
+ (instancetype)shareManager; | |||
@property (nonatomic, weak) id <INBluetoothManagerDelegate> delegate; | |||
@property (nonatomic, assign, readonly) CBCentralManagerState bleState; | |||
- (void)startBleScan; | |||
- (void)stopBleScan; | |||
- (void)closeBleAndDisconnect; | |||
- (void)connectToLinkScale:(DeviceModel *)linkScaleDeviceModel; | |||
- (void)handleDataForBroadScale:(DeviceModel *)broadScaleDeviceModel; | |||
//Don’t invoke this, just use WriteToBLEManager to write data to ble | |||
- (void)sendDataToBle:(NSData *)data; | |||
+ (void)enableSDKLogs:(BOOL)enable; | |||
+ (NSString *)sdkVersion; | |||
@end |
@@ -0,0 +1,22 @@ | |||
// | |||
// InetBleSDK | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#ifndef InetBleSDK_h | |||
#define InetBleSDK_h | |||
#import "INBluetoothManager.h" | |||
#import "AnalysisBLEDataManager.h" | |||
#import "WriteToBLEManager.h" | |||
#import "DeviceModel.h" | |||
#import "UserInfoModel.h" | |||
#import "BLEUser.h" | |||
#import "AlgorithmSDK.h" | |||
#import "BfsCalculateSDK.h" | |||
#import "BleTools.h" | |||
#endif /* InetBleSDK_h */ | |||
@@ -0,0 +1,129 @@ | |||
// | |||
// InetBleSDK | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
@class BLEUser; | |||
typedef NS_ENUM(NSInteger, WeightUnitType) { | |||
WeightUnitType_KG = 0, | |||
WeightUnitType_LB, | |||
WeightUnitType_ST, | |||
WeightUnitType_JIN, | |||
}; | |||
typedef NS_ENUM(NSInteger, MeasureStatus) { | |||
MeasureStatus_Unstable = 0, | |||
MeasureStatus_Stable, | |||
MeasureStatus_Complete, | |||
MeasureStatus_OfflineHistory, | |||
}; | |||
@interface UserInfoModel : NSObject<NSCopying> | |||
//@property (nonatomic, assign) double weightTimeStamp; | |||
@property (nonatomic, copy) NSString *date; | |||
@property (nonatomic, copy) NSString *time; | |||
///only used for offline history, other it is empty | |||
@property (nonatomic, strong) BLEUser *bleUser; | |||
/// weight | |||
@property (nonatomic, assign) float weightsum; | |||
/// TEMP | |||
@property (nonatomic, assign) float temperature; | |||
/// BMI | |||
@property (nonatomic, assign) float BMI; | |||
/// bfr | |||
@property (nonatomic, assign) float fatRate; | |||
/// rom | |||
@property (nonatomic, assign) float muscle; | |||
/// vwc | |||
@property (nonatomic, assign) float moisture; | |||
/// bm | |||
@property (nonatomic, assign) float boneMass; | |||
/// sfr | |||
@property (nonatomic, assign) float subcutaneousFat; | |||
/// bmr | |||
@property (nonatomic, assign) float BMR; | |||
/// pp | |||
@property (nonatomic, assign) float proteinRate; | |||
/// uvi | |||
@property (nonatomic, assign) float visceralFat; | |||
/// bodyAge | |||
@property (nonatomic, assign) float physicalAge; | |||
/// adc | |||
@property (nonatomic, assign) float newAdc; | |||
/// kg origin point | |||
@property (nonatomic, assign) int weightOriPoint; | |||
/// kg show point | |||
@property (nonatomic, assign) int weightKgPoint; | |||
/// lb show point | |||
@property (nonatomic, assign) int weightLbPoint; | |||
/// st show point | |||
@property (nonatomic, assign) int weightStPoint; | |||
/// kg show graduation | |||
@property (nonatomic, assign) int KGgraduation; | |||
/// lb show graduation | |||
@property (nonatomic, assign) int LBgradution; | |||
//algorithm(so far only used for BM15) | |||
@property (nonatomic, assign) NSInteger Algorithm_number; | |||
/// bm15 broad scale now showing unit | |||
@property (nonatomic, assign) WeightUnitType bm15ScaleUnit; | |||
@property (nonatomic, assign) MeasureStatus measureStatus; | |||
@end | |||
/* For example | |||
date : 2019-12-23; | |||
time : 17:22:28; | |||
bleUser : <BLEUser: 0x2808e0840>; | |||
weightsum : 727; | |||
temperature : 24.5; | |||
BMI : 23.7; | |||
fatRate : 22.2; | |||
muscle : 51; | |||
moisture : 57; | |||
boneMass : 2.8; | |||
subcutaneousFat : 19.9; | |||
BMR : 1549; | |||
proteinRate : 16.6; | |||
visceralFat : 7; | |||
physicalAge : 26; | |||
newAdc : 580; | |||
weightOriPoint : 1; | |||
weightKgPoint : 1; | |||
weightLbPoint : 1; | |||
weightStPoint : 1; | |||
KGgraduation : 1; | |||
LBgradution : 1; | |||
Algorithm_number : 1; | |||
bm15ScaleUnit : 0; | |||
measureStatus : 2; | |||
*/ |
@@ -0,0 +1,49 @@ | |||
// | |||
// InetBleSDK | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <Foundation/Foundation.h> | |||
@class BLEUser; | |||
@interface WriteToBLEManager : NSObject | |||
+ (instancetype)shareManager; | |||
/** | |||
send user info to connectable scale | |||
@param sex 1:Male 2:Female | |||
@param height @"177" | |||
@param age @"18" | |||
*/ | |||
- (void)synchronousUserWithSex:(NSInteger)sex withHeight:(NSString *)height withAge:(NSString *)age NS_DEPRECATED_IOS(2_0,8_0); | |||
- (void)syncWeighingUser:(BLEUser *)user; | |||
/** | |||
set Unit for connectable scale | |||
@param unitNumber kg:0 lb:1 st:2 斤:3 | |||
*/ | |||
- (void)write_To_Unit:(NSInteger)unitNumber; | |||
/** | |||
send offline user list to Ble | |||
*/ | |||
- (void)sendOfflineUserListToBle:(NSArray <BLEUser *> *)usrsArr; | |||
/** | |||
request historys | |||
*/ | |||
- (void)requestOfflineHistory; | |||
@end | |||
@@ -0,0 +1,6 @@ | |||
framework module InetBleSDK { | |||
umbrella header "InetBleSDK.h" | |||
export * | |||
module * { export * } | |||
} |
@@ -0,0 +1,13 @@ | |||
// | |||
// AIFit-Demo | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <UIKit/UIKit.h> | |||
@interface MainViewController : UIViewController | |||
@end | |||
@@ -0,0 +1,502 @@ | |||
// | |||
// AIFit-Demo | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import "MainViewController.h" | |||
#import "SearchDeviceVC.h" | |||
#import <InetBleSDK/InetBleSDK.h> | |||
#import "AppUser.h" | |||
#import "SetUserViewController.h" | |||
@interface MainViewController () <AnalysisBLEDataManagerDelegate, INBluetoothManagerDelegate,UITableViewDataSource,UITableViewDelegate> | |||
@property (weak, nonatomic) IBOutlet UIButton *connectedDevicesButton; | |||
@property (weak, nonatomic) IBOutlet UILabel *userInfoLabel; | |||
@property (weak, nonatomic) IBOutlet UISegmentedControl *unitSegmentedControl; | |||
@property (weak, nonatomic) IBOutlet UITableView *tableView; | |||
@property (nonatomic, strong) NSArray *itemNameArr; | |||
@property (nonatomic, strong) NSMutableArray *itemValueArr; | |||
@property (weak, nonatomic) IBOutlet UILabel *tipLB; | |||
@property (nonatomic, strong) UserInfoModel *currentInfoModel; | |||
@property (nonatomic, strong) DeviceModel *targetDeviceModel; | |||
@property (nonatomic, strong) AppUser *appUser; | |||
@end | |||
@implementation MainViewController | |||
- (NSArray *)itemNameArr { | |||
if (_itemNameArr == nil) { | |||
_itemNameArr = @[ | |||
@"weight:", | |||
@"BMI:", | |||
@"fatRate:", | |||
@"muscle:", | |||
@"moisture:", | |||
@"boneMass:", | |||
@"BMR:", | |||
@"visceralFat:", | |||
@"subcutaneousFat:", | |||
@"proteinRate:", | |||
@"physicalAge:", | |||
@"ADC:", | |||
@"temperature:", | |||
@"standardWeight:", | |||
@"weightControl:", | |||
@"fatMass:", | |||
@"weightWithoutFat:", | |||
@"muscleMass:", | |||
@"proteinMass:", | |||
@"fatlevel:" | |||
]; | |||
} | |||
return _itemNameArr; | |||
} | |||
- (NSMutableArray *)itemValueArr { | |||
if (_itemValueArr == nil) { | |||
_itemValueArr = [[NSMutableArray alloc] init]; | |||
for (int i = 0; i < self.itemNameArr.count; i++) { | |||
[_itemValueArr addObject:@"--.--"]; | |||
} | |||
} | |||
return _itemValueArr; | |||
} | |||
#pragma mark ============ life circle ============== | |||
- (void)viewDidLoad { | |||
[super viewDidLoad]; | |||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(makeViewEndEditing)]; | |||
[self.view addGestureRecognizer:tap]; | |||
//set default value | |||
_appUser = [[AppUser alloc] init]; | |||
_appUser.sex = 1; | |||
_appUser.age = 25; | |||
_appUser.height = 175; | |||
_appUser.weightKg = 0.0; | |||
_appUser.adc = 0; | |||
_userInfoLabel.text = [NSString stringWithFormat:@" sex:%d\n age:%d\n height:%d\n weight:%.1f\n adc:%d",_appUser.sex,_appUser.age,_appUser.height,_appUser.weightKg,_appUser.adc]; | |||
self.tableView.dataSource = self; | |||
self.tableView.delegate = self; | |||
//reset label | |||
[self resetLBText]; | |||
} | |||
- (void)makeViewEndEditing { | |||
[self.view endEditing:YES]; | |||
} | |||
- (void)viewWillAppear:(BOOL)animated { | |||
[super viewWillAppear:animated]; | |||
//setDelegate | |||
[AnalysisBLEDataManager shareManager].infoDelegate = self; | |||
[INBluetoothManager shareManager].delegate = self; | |||
[INBluetoothManager enableSDKLogs:YES]; //open log switch | |||
} | |||
-(void)resetLBText { | |||
self.itemValueArr = nil; | |||
self.tipLB.text = @"--.--"; | |||
} | |||
#pragma mark ============ click action ============== | |||
- (IBAction)Click_Ble:(id)sender { | |||
if ([INBluetoothManager shareManager].bleState != CBCentralManagerStatePoweredOn) { | |||
[[[UIAlertView alloc] initWithTitle:@"Alert" message:@"BLE closed, pls open!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; | |||
return; | |||
} | |||
SearchDeviceVC *searchVC = [[SearchDeviceVC alloc]init]; | |||
__weak typeof(self) weakSelf = self; | |||
searchVC.didSelectDeviceBlock = ^(DeviceModel *device) { | |||
[weakSelf backFromSearchDeviceVC:device]; | |||
}; | |||
searchVC.gobackBlock = ^{ | |||
[weakSelf.connectedDevicesButton setTitle:@"Connect Device" forState:UIControlStateNormal]; | |||
}; | |||
searchVC.modalPresentationStyle = UIModalPresentationFullScreen; | |||
[self presentViewController:searchVC animated:YES completion:nil]; | |||
} | |||
- (void)backFromSearchDeviceVC:(DeviceModel *)device { | |||
NSLog(@"---device:%@",device); | |||
_targetDeviceModel = device; | |||
[self.connectedDevicesButton setTitle:device.deviceAddress forState:UIControlStateNormal]; | |||
if (device.acNumber.intValue < 2) { //0、1 is broadcast scale | |||
[[INBluetoothManager shareManager] handleDataForBroadScale:device]; | |||
} else { //2、3 is Link scale | |||
[[INBluetoothManager shareManager] connectToLinkScale:device]; | |||
} | |||
} | |||
- (IBAction)editUser:(id)sender { | |||
SetUserViewController *vc = [[SetUserViewController alloc] init]; | |||
vc.user = _appUser; | |||
__weak typeof(self) weakSelf = self; | |||
vc.editUserCallBack = ^{ | |||
weakSelf.userInfoLabel.text = [NSString stringWithFormat:@" sex:%d\n age:%d\n height:%d\n weight:%.1f\n adc:%d",weakSelf.appUser.sex,weakSelf.appUser.age,weakSelf.appUser.height,weakSelf.appUser.weightKg,weakSelf.appUser.adc]; | |||
[weakSelf syncWeighingUserToBle]; | |||
//If no need offline history function, do not call this method | |||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||
[weakSelf syncOfflineUserListToBle]; | |||
}); | |||
}; | |||
[self presentViewController:vc animated:YES completion:nil]; | |||
} | |||
- (IBAction)getOfflineHistory:(id)sender { | |||
//request history (If no need offline history function, do not call this method) | |||
[[WriteToBLEManager shareManager] requestOfflineHistory]; | |||
} | |||
// click sync user button | |||
- (void)syncWeighingUserToBle { | |||
if (_targetDeviceModel.acNumber.intValue < 2) { | |||
//broadcast scale do not need to sync user | |||
} else { | |||
//connect scale must input sex、weight、age | |||
BLEUser *user = [[BLEUser alloc] init]; | |||
user.userSex = _appUser.sex; | |||
user.userAge = _appUser.age; | |||
user.userHeight = _appUser.height; | |||
[[WriteToBLEManager shareManager] syncWeighingUser:user]; | |||
} | |||
} | |||
/// If no need offline history function, do not call this method | |||
- (void)syncOfflineUserListToBle { | |||
if (_targetDeviceModel.acNumber.intValue < 2) { | |||
//broadcast scale can not receive write command | |||
} else { | |||
BLEUser *user = [[BLEUser alloc] init]; | |||
user.userSex = _appUser.sex; | |||
user.userAge = _appUser.age; | |||
user.userHeight = _appUser.height; | |||
user.userWeight = _appUser.weightKg; //note | |||
user.userAdc = _appUser.adc; //note | |||
[[WriteToBLEManager shareManager] sendOfflineUserListToBle:@[user]]; //you can add more than one user to array | |||
} | |||
} | |||
// click change unit segmentedControl | |||
- (IBAction)ChooseUnit:(UISegmentedControl *)Segmented { | |||
if (_targetDeviceModel.acNumber.intValue < 2) { | |||
//broadcast scale can not receive write command | |||
} else { | |||
[[WriteToBLEManager shareManager] write_To_Unit:Segmented.selectedSegmentIndex]; | |||
NSString *weightShow = [self getWeightShowStr:_currentInfoModel unit:_unitSegmentedControl.selectedSegmentIndex]; | |||
[self.itemValueArr replaceObjectAtIndex:0 withObject:weightShow]; | |||
} | |||
} | |||
#pragma mark ============ BluetoothManagerDelegate ============== | |||
- (void)BluetoothManager:(INBluetoothManager *)manager updateCentralManagerState:(BluetoothManagerState)state { | |||
switch (state) { | |||
case BluetoothManagerState_PowerOn: | |||
{ | |||
_tipLB.text = @"BLE open"; | |||
break; | |||
} | |||
case BluetoothManagerState_PowerOff: | |||
{ | |||
_tipLB.text = @"BLE closed"; | |||
break; | |||
} | |||
case BluetoothManagerState_Disconnect: | |||
{ | |||
_tipLB.text = @"BLE Disconnect"; | |||
break; | |||
} | |||
default: | |||
break; | |||
} | |||
} | |||
//only used for link scale | |||
- (void)BluetoothManager:(INBluetoothManager *)manager didConnectDevice:(DeviceModel *)deviceModel { | |||
_targetDeviceModel = deviceModel; | |||
} | |||
#pragma mark - AnalysisBLEDataManagerDelegate | |||
- (void)AnalysisBLEDataManager:(AnalysisBLEDataManager *)analysisManager updateBleDataAnalysisStatus:(BleDataAnalysisStatus)bleDataAnalysisStatus { | |||
switch (bleDataAnalysisStatus) { | |||
case BleDataAnalysisStatus_SyncTimeSuccess: | |||
{ | |||
_tipLB.text = @"sync time success"; | |||
//set unit | |||
[self ChooseUnit:self.unitSegmentedControl]; | |||
//then sync user to be weighing | |||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||
[self syncWeighingUserToBle]; | |||
}); | |||
// //sync offline userlist(If no need offline history function, do not call this method) | |||
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||
// [self syncOfflineUserListToBle]; | |||
// }); | |||
break; | |||
} | |||
case BleDataAnalysisStatus_SyncTimeFailed: | |||
{ | |||
_tipLB.text = @"sync time failed"; | |||
break; | |||
} | |||
case BleDataAnalysisStatus_SyncUserSuccess: | |||
{ | |||
_tipLB.text = @"sync weighing user success"; | |||
break; | |||
} | |||
case BleDataAnalysisStatus_SyncUserFailed: | |||
{ | |||
_tipLB.text = @"sync weighing user failed"; | |||
break; | |||
} | |||
case BleDataAnalysisStatus_UnstableWeight: | |||
{ | |||
_tipLB.text = @"measuring...\nUnstable Weight"; | |||
break; | |||
} | |||
case BleDataAnalysisStatus_StableWeight: | |||
{ | |||
_tipLB.text = @"Stable Weight"; | |||
break; | |||
} | |||
case BleDataAnalysisStatus_MeasureComplete: | |||
{ | |||
_tipLB.text = @"measure complete"; | |||
break; | |||
} | |||
case BleDataAnalysisStatus_AdcError: | |||
{ | |||
_tipLB.text = @"adc measure failed"; | |||
break; | |||
} | |||
case BleDataAnalysisStatus_LightOff: | |||
{ | |||
_tipLB.text = @"your linkScale light off"; | |||
break; | |||
} | |||
default: | |||
break; | |||
} | |||
} | |||
- (void)AnalysisBLEDataManager:(AnalysisBLEDataManager *)analysisManager updateMeasureUserInfo:(UserInfoModel *)infoModel { | |||
NSLog(@"---infoModel:%@",infoModel); | |||
_currentInfoModel = infoModel; | |||
[self refreshTableView]; | |||
if (_currentInfoModel.measureStatus == MeasureStatus_Complete && _currentInfoModel.weightsum > 0 && _currentInfoModel.newAdc > 0) { //Measure Complete | |||
float weight = _currentInfoModel.weightsum/pow(10, _currentInfoModel.weightOriPoint);//6895->68.95 | |||
float adc = _currentInfoModel.newAdc; | |||
_appUser.weightKg = weight; | |||
_appUser.adc = adc; | |||
_userInfoLabel.text = [NSString stringWithFormat:@" sex:%d\n age:%d\n height:%d\n weight:%.1f\n adc:%d",_appUser.sex,_appUser.age,_appUser.height,_appUser.weightKg,_appUser.adc]; | |||
if (_targetDeviceModel.acNumber.intValue < 2) { //BroadScale BM15 mesure complete | |||
AlgorithmModel *algModel = [AlgorithmSDK getBodyfatWithWeight:weight adc:adc sex:_appUser.sex age:_appUser.age height:_appUser.height]; | |||
NSLog(@"---BM15 AlgorithmModel: %@",algModel); | |||
_currentInfoModel.fatRate = algModel.bfr.floatValue; | |||
_currentInfoModel.BMI = algModel.bmi.floatValue; | |||
_currentInfoModel.moisture = algModel.vwc.floatValue; | |||
_currentInfoModel.muscle = algModel.rom.floatValue; | |||
_currentInfoModel.BMR = algModel.bmr.floatValue; | |||
_currentInfoModel.boneMass = algModel.bm.floatValue; | |||
_currentInfoModel.visceralFat = algModel.uvi.floatValue; | |||
_currentInfoModel.proteinRate = algModel.pp.floatValue; | |||
_currentInfoModel.physicalAge = algModel.physicalAge.floatValue; | |||
_currentInfoModel.subcutaneousFat = algModel.sfr.floatValue; | |||
//refresh | |||
[self refreshTableView]; | |||
} else { //connect scale measure complete | |||
[self syncWeighingUserToBle]; | |||
// If no need offline history function, do not call this method | |||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||
[self syncOfflineUserListToBle]; | |||
}); | |||
} | |||
} | |||
} | |||
- (void)refreshTableView { | |||
NSString *weightShow = [self getWeightShowStr:_currentInfoModel unit:_unitSegmentedControl.selectedSegmentIndex]; | |||
[self.itemValueArr replaceObjectAtIndex:0 withObject:weightShow]; | |||
[self.itemValueArr replaceObjectAtIndex:1 withObject:[NSString stringWithFormat:@"%.1f",_currentInfoModel.BMI]]; | |||
[self.itemValueArr replaceObjectAtIndex:2 withObject:[NSString stringWithFormat:@"%.1f",_currentInfoModel.fatRate]]; | |||
[self.itemValueArr replaceObjectAtIndex:3 withObject:[NSString stringWithFormat:@"%.1f%",_currentInfoModel.muscle]]; | |||
[self.itemValueArr replaceObjectAtIndex:4 withObject:[NSString stringWithFormat:@"%.1f%",_currentInfoModel.moisture]]; | |||
[self.itemValueArr replaceObjectAtIndex:5 withObject:[NSString stringWithFormat:@"%.1f",_currentInfoModel.boneMass]]; | |||
[self.itemValueArr replaceObjectAtIndex:6 withObject:[NSString stringWithFormat:@"%.1fkcal",_currentInfoModel.BMR]]; | |||
[self.itemValueArr replaceObjectAtIndex:7 withObject:[NSString stringWithFormat:@"%.0f",_currentInfoModel.visceralFat]]; | |||
[self.itemValueArr replaceObjectAtIndex:8 withObject:[NSString stringWithFormat:@"%.1f%",_currentInfoModel.subcutaneousFat]]; | |||
[self.itemValueArr replaceObjectAtIndex:9 withObject:[NSString stringWithFormat:@"%.1f%",_currentInfoModel.proteinRate]]; | |||
[self.itemValueArr replaceObjectAtIndex:10 withObject:[NSString stringWithFormat:@"%.1f",_currentInfoModel.physicalAge]]; | |||
[self.itemValueArr replaceObjectAtIndex:11 withObject:[NSString stringWithFormat:@"%.0f",_currentInfoModel.newAdc]]; | |||
[self.itemValueArr replaceObjectAtIndex:12 withObject:[NSString stringWithFormat:@"%.1f°C",_currentInfoModel.temperature]]; | |||
float weight = _currentInfoModel.weightsum/pow(10, _currentInfoModel.weightOriPoint);//6895->68.95 | |||
int sex = _appUser.sex; | |||
int height = _appUser.height; | |||
NSString *bfr = [NSString stringWithFormat:@"%.1f",_currentInfoModel.fatRate]; | |||
NSString *rom = [NSString stringWithFormat:@"%.1f%",_currentInfoModel.muscle]; | |||
NSString *pp = [NSString stringWithFormat:@"%.1f%",_currentInfoModel.proteinRate]; | |||
BfsCalculateItem *item = [BfsCalculateSDK getBodyfatItemWithSex:sex height:height weight:weight bfr:bfr rom:rom pp:pp]; | |||
[self.itemValueArr replaceObjectAtIndex:13 withObject:[NSString stringWithFormat:@"%.1fkg",item.standardWeight]]; | |||
[self.itemValueArr replaceObjectAtIndex:14 withObject:[NSString stringWithFormat:@"%.1fkg",item.weightControl]]; | |||
[self.itemValueArr replaceObjectAtIndex:15 withObject:[NSString stringWithFormat:@"%.1fkg",item.fatMass]]; | |||
[self.itemValueArr replaceObjectAtIndex:16 withObject:[NSString stringWithFormat:@"%.1fkg",item.weightWithoutFat]]; | |||
[self.itemValueArr replaceObjectAtIndex:17 withObject:[NSString stringWithFormat:@"%.1fkg",item.muscleMass]]; | |||
[self.itemValueArr replaceObjectAtIndex:18 withObject:[NSString stringWithFormat:@"%.1fkg",item.proteinMass]]; | |||
[self.itemValueArr replaceObjectAtIndex:19 withObject:[NSString stringWithFormat:@"%zd",item.fatlevel]]; | |||
[self.tableView reloadData]; | |||
} | |||
//If no need offline history function, do not implement this callback | |||
- (void)AnalysisBLEDataManager:(AnalysisBLEDataManager *)analysisManager backOfflineHistorys:(NSMutableArray <UserInfoModel *> *)historysMutableArr { | |||
// _tipLB.text = [NSString stringWithFormat:@"Got %zd offline historys! check sdk log.",historysMutableArr.count]; | |||
// | |||
// for (UserInfoModel *info in historysMutableArr) { | |||
// NSLog(@"---get offline history:\n %@",info); | |||
// } | |||
NSString *title = [NSString stringWithFormat:@"Got %zd offline historys!",historysMutableArr.count]; | |||
NSMutableString *strM = [NSMutableString string]; | |||
for (UserInfoModel *info in historysMutableArr) { | |||
NSLog(@"---get offline history:\n %@",info); | |||
[strM appendString:[NSString stringWithFormat:@"%@\n-----------------\n",info]]; | |||
} | |||
[[[UIAlertView alloc] initWithTitle:title message:strM delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil, nil] show]; | |||
} | |||
#pragma mark ============ tableView datasource ============== | |||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |||
return self.itemNameArr.count; | |||
} | |||
static NSString * const CellID = @"CellID"; | |||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID]; | |||
if (cell == nil) { | |||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellID]; | |||
cell.textLabel.textColor = [UIColor blackColor]; | |||
cell.detailTextLabel.textColor = [UIColor blueColor]; | |||
} | |||
//赋值 | |||
cell.textLabel.text = self.itemNameArr[indexPath.row]; | |||
cell.detailTextLabel.text = self.itemValueArr[indexPath.row]; | |||
return cell; | |||
} | |||
#pragma mark ============ handle weight point ============== | |||
// change weight unit | |||
- (NSString *)getWeightShowStr:(UserInfoModel *)infoModel unit:(NSInteger)unit { | |||
float weight = infoModel.weightsum/pow(10, infoModel.weightOriPoint);//6895->68.95 | |||
NSString *formatStr = [NSString stringWithFormat:@"%%.%df",infoModel.weightKgPoint]; //@"%.1f" | |||
NSString *showWeight = @""; | |||
if (unit == 0) { | |||
formatStr = [formatStr stringByAppendingString:@"kg"]; //@"%.1fkg" | |||
showWeight = [NSString stringWithFormat:formatStr,weight]; | |||
} else if (unit == 1) { | |||
formatStr = [formatStr stringByAppendingString:@"lb"]; //@"%.1flb" | |||
showWeight = [NSString stringWithFormat:formatStr,weight*2.2046226f]; | |||
} else if (unit == 2) { | |||
showWeight = [self kg2St:weight]; //st(lb/14): **lb:**st | |||
} else if (unit == 3) { | |||
formatStr = [formatStr stringByAppendingString:@"斤"]; //@"%.1f斤" | |||
showWeight = [NSString stringWithFormat:formatStr,weight*2]; | |||
}else { | |||
formatStr = [formatStr stringByAppendingString:@"kg"]; //@"%.1fkg" | |||
showWeight = [NSString stringWithFormat:formatStr,weight]; | |||
} | |||
return showWeight; | |||
} | |||
- (NSString *)kg2St:(float)kgWeight { | |||
NSString *oneString = [NSString stringWithFormat:@"%d",(int)(kgWeight*2.2046226f)/14]; | |||
NSString *twoString = [NSString stringWithFormat:@"%d",((int)(kgWeight*2.2046226f)%14)]; | |||
return [NSString stringWithFormat:@"%@:%@st",oneString,twoString]; | |||
} | |||
@end | |||
@@ -0,0 +1,17 @@ | |||
// | |||
// AIFit-Demo | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import <UIKit/UIKit.h> | |||
@class DeviceModel; | |||
@interface SearchDeviceVC : UIViewController | |||
@property (nonatomic, copy) void(^didSelectDeviceBlock)(DeviceModel *device); | |||
@property (nonatomic, copy) void(^gobackBlock)(void); | |||
@end |
@@ -0,0 +1,194 @@ | |||
// | |||
// AIFit-Demo | |||
// | |||
// Created by iot_wz on 2018/9/1. | |||
// Copyright © 2018年 iot_wz. All rights reserved. | |||
// | |||
#import "SearchDeviceVC.h" | |||
#import <InetBleSDK/InetBleSDK.h> | |||
#import "MainViewController.h" | |||
@interface SearchDeviceVC () <UITableViewDelegate,UITableViewDataSource,INBluetoothManagerDelegate> | |||
{ | |||
CGFloat topDis; | |||
} | |||
@property (nonatomic, strong)UITableView *BleTableView; | |||
@property (nonatomic, strong) NSMutableArray *peripheralArray; | |||
@property (nonatomic, assign) BOOL isAddPeripheraling; | |||
@end | |||
@implementation SearchDeviceVC | |||
#pragma mark - ================= 视图 ========================== | |||
- (void)viewDidLoad | |||
{ | |||
[super viewDidLoad]; | |||
self.view.backgroundColor = [UIColor colorWithRed:235/255.0 green:250/255.0 blue:250/255.0 alpha:1.0]; | |||
[self setupBackButton]; | |||
[self setupStartScanBtn]; | |||
[self setupStopScanBtn]; | |||
[self setupTableView]; | |||
if ([INBluetoothManager shareManager].bleState == CBCentralManagerStatePoweredOn) { | |||
[[INBluetoothManager shareManager] closeBleAndDisconnect]; //maybe your scale has been connected | |||
[INBluetoothManager shareManager].delegate = self; | |||
[[INBluetoothManager shareManager] startBleScan]; | |||
} else { | |||
NSLog(@"---Error: BLE not avalible, pls check."); | |||
} | |||
} | |||
-(void)setupBackButton | |||
{ | |||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem]; | |||
topDis = (UIScreen.mainScreen.bounds.size.height == 812) ? (34+10) : (20+10); | |||
btn.frame = CGRectMake(25, topDis, 250, 40); | |||
[btn setTitle:@"<< BackAndCloseBLE" forState:UIControlStateNormal]; | |||
[btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal]; | |||
[btn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; | |||
[self.view addSubview:btn]; | |||
[btn addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside]; | |||
} | |||
-(void)goBack | |||
{ | |||
[[INBluetoothManager shareManager] closeBleAndDisconnect]; | |||
__weak typeof(self) weakSelf = self; | |||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |||
weakSelf.gobackBlock(); | |||
[weakSelf dismissViewControllerAnimated:YES completion:nil]; | |||
}); | |||
} | |||
- (void)setupStartScanBtn | |||
{ | |||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem]; | |||
btn.frame = CGRectMake(25, topDis+40+10, 100, 40); | |||
[btn setTitle:@"start scan" forState:UIControlStateNormal]; | |||
[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; | |||
btn.backgroundColor = [UIColor whiteColor]; | |||
[self.view addSubview:btn]; | |||
[btn addTarget:self action:@selector(scanPeripheral) forControlEvents:UIControlEventTouchUpInside]; | |||
} | |||
- (void)setupStopScanBtn | |||
{ | |||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem]; | |||
btn.frame = CGRectMake(self.view.bounds.size.width-25-100, topDis+40+10, 100, 40); | |||
[btn setTitle:@"stop scan" forState:UIControlStateNormal]; | |||
[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; | |||
btn.backgroundColor = [UIColor whiteColor]; | |||
[self.view addSubview:btn]; | |||
[btn addTarget:self action:@selector(stopScan) forControlEvents:UIControlEventTouchUpInside]; | |||
} | |||
- (void)setupTableView { | |||
_BleTableView = [[UITableView alloc]init]; | |||
_BleTableView.frame = CGRectMake(25, topDis+50+50, self.view.bounds.size.width-50, self.view.bounds.size.height-(topDis+50+50)-20); | |||
_BleTableView.dataSource = self; | |||
_BleTableView.delegate = self; | |||
[self.view addSubview:_BleTableView]; | |||
} | |||
- (void)scanPeripheral | |||
{ | |||
[[INBluetoothManager shareManager] startBleScan]; | |||
} | |||
- (void)stopScan | |||
{ | |||
[[INBluetoothManager shareManager] stopBleScan]; | |||
} | |||
#pragma mark - BluetoothManagerDelegate | |||
- (void)BluetoothManager:(INBluetoothManager *)manager didDiscoverDevice:(DeviceModel *)deviceModel | |||
{ | |||
if (self.isAddPeripheraling == YES) return; | |||
self.isAddPeripheraling = YES; | |||
BOOL willAdd = YES; | |||
for (DeviceModel *model in self.peripheralArray) //avoid add the same device | |||
{ | |||
if ([model.deviceAddress isEqualToString:deviceModel.deviceAddress] && [model.deviceName isEqualToString:deviceModel.deviceName]) | |||
{ | |||
willAdd = NO; | |||
} | |||
} | |||
if (willAdd) { | |||
[self.peripheralArray addObject:deviceModel]; | |||
[self.BleTableView reloadData]; | |||
} | |||
self.isAddPeripheraling = NO; | |||
} | |||
#pragma mark - UITableViewDataSource | |||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |||
{ | |||
return self.peripheralArray.count; | |||
} | |||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |||
{ | |||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AIFitCell"]; | |||
if (!cell) { | |||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"AIFitCell"]; | |||
} | |||
DeviceModel *peripheralModel = self.peripheralArray[indexPath.row]; | |||
cell.textLabel.text = peripheralModel.deviceName; | |||
cell.detailTextLabel.text = peripheralModel.deviceAddress; | |||
return cell; | |||
} | |||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |||
{ | |||
DeviceModel *peripheralModel = self.peripheralArray[indexPath.row]; | |||
if (_didSelectDeviceBlock) { | |||
_didSelectDeviceBlock(peripheralModel); | |||
//note: just go back, keep ble scan all the time | |||
[self dismissViewControllerAnimated:YES completion:nil]; | |||
} | |||
} | |||
#pragma mark - Setter and Getter | |||
- (NSMutableArray *)peripheralArray | |||
{ | |||
if (_peripheralArray == nil) { | |||
_peripheralArray = [[NSMutableArray alloc] init]; | |||
} | |||
return _peripheralArray; | |||
} | |||
- (void)dealloc | |||
{ | |||
NSLog(@"---class:%@ instance:%p already dealloc!",self.class,self); | |||
} | |||
@end |
@@ -0,0 +1,21 @@ | |||
// | |||
// SetUserViewController.h | |||
// AIFit-Demo | |||
// | |||
// Created by steven wu on 2019/12/20. | |||
// Copyright © 2019 wujia121. All rights reserved. | |||
// | |||
#import <UIKit/UIKit.h> | |||
@class AppUser; | |||
NS_ASSUME_NONNULL_BEGIN | |||
@interface SetUserViewController : UIViewController | |||
@property (nonatomic, strong) AppUser *user; | |||
@property (nonatomic, copy) void(^editUserCallBack)(void); | |||
@end | |||
NS_ASSUME_NONNULL_END |
@@ -0,0 +1,45 @@ | |||
// | |||
// SetUserViewController.m | |||
// AIFit-Demo | |||
// | |||
// Created by steven wu on 2019/12/20. | |||
// Copyright © 2019 wujia121. All rights reserved. | |||
// | |||
#import "SetUserViewController.h" | |||
#import "AppUser.h" | |||
#import <InetBleSDK/InetBleSDK.h> | |||
@interface SetUserViewController () | |||
@property (weak, nonatomic) IBOutlet UISegmentedControl *sexSegmentedC; | |||
@property (weak, nonatomic) IBOutlet UITextField *ageTextF; | |||
@property (weak, nonatomic) IBOutlet UITextField *heightTextF; | |||
@end | |||
@implementation SetUserViewController | |||
- (void)viewDidLoad { | |||
[super viewDidLoad]; | |||
_sexSegmentedC.selectedSegmentIndex = self.user.sex == 1 ? 0 : 1; | |||
_ageTextF.text = [NSString stringWithFormat:@"%d",self.user.age]; | |||
_heightTextF.text = [NSString stringWithFormat:@"%d",self.user.height]; | |||
} | |||
- (IBAction)saveUserInfo:(id)sender { | |||
_user.sex = _sexSegmentedC.selectedSegmentIndex == 0 ? 1 : 2; //male:1 female:2 | |||
_user.age = _ageTextF.text.intValue; | |||
_user.height = _heightTextF.text.intValue; | |||
if (_editUserCallBack) { | |||
_editUserCallBack(); | |||
} | |||
[self dismissViewControllerAnimated:YES completion:nil]; | |||
} | |||
@end |
@@ -0,0 +1,109 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> | |||
<device id="retina6_1" orientation="portrait"> | |||
<adaptation id="fullscreen"/> | |||
</device> | |||
<dependencies> | |||
<deployment identifier="iOS"/> | |||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/> | |||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | |||
</dependencies> | |||
<objects> | |||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SetUserViewController"> | |||
<connections> | |||
<outlet property="ageTextF" destination="vHr-Ek-MOn" id="PsD-0X-Yz0"/> | |||
<outlet property="heightTextF" destination="gaE-XL-e9v" id="6hD-fd-SIm"/> | |||
<outlet property="sexSegmentedC" destination="zDW-b7-hgQ" id="wmY-vU-6TK"/> | |||
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> | |||
</connections> | |||
</placeholder> | |||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> | |||
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> | |||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/> | |||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | |||
<subviews> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Set User Info" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cCJ-dU-qVg"> | |||
<rect key="frame" x="107" y="60" width="200" height="40"/> | |||
<constraints> | |||
<constraint firstAttribute="width" constant="200" id="L3v-jq-db6"/> | |||
<constraint firstAttribute="height" constant="40" id="aAm-Uo-8Wh"/> | |||
</constraints> | |||
<fontDescription key="fontDescription" type="system" pointSize="18"/> | |||
<nil key="textColor"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="zDW-b7-hgQ"> | |||
<rect key="frame" x="207" y="180" width="153" height="29"/> | |||
<segments> | |||
<segment title="Male(1)"/> | |||
<segment title="Female(2)"/> | |||
</segments> | |||
</segmentedControl> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Age :" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sZN-4s-rmi"> | |||
<rect key="frame" x="128" y="253" width="39" height="20.5"/> | |||
<fontDescription key="fontDescription" type="system" pointSize="17"/> | |||
<nil key="textColor"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Height :" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Smm-hx-0FP"> | |||
<rect key="frame" x="107" y="323" width="60" height="20.5"/> | |||
<fontDescription key="fontDescription" type="system" pointSize="17"/> | |||
<nil key="textColor"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="25" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="vHr-Ek-MOn"> | |||
<rect key="frame" x="207" y="248" width="153" height="30"/> | |||
<nil key="textColor"/> | |||
<fontDescription key="fontDescription" type="system" pointSize="16"/> | |||
<textInputTraits key="textInputTraits"/> | |||
</textField> | |||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="172" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="gaE-XL-e9v"> | |||
<rect key="frame" x="207" y="318" width="153" height="30"/> | |||
<nil key="textColor"/> | |||
<fontDescription key="fontDescription" type="system" pointSize="16"/> | |||
<textInputTraits key="textInputTraits"/> | |||
</textField> | |||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Sex :" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iwH-k3-tJl"> | |||
<rect key="frame" x="129" y="183.5" width="38" height="21"/> | |||
<fontDescription key="fontDescription" type="system" pointSize="17"/> | |||
<nil key="textColor"/> | |||
<nil key="highlightedColor"/> | |||
</label> | |||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iag-qe-5sf"> | |||
<rect key="frame" x="334" y="55" width="60" height="50"/> | |||
<constraints> | |||
<constraint firstAttribute="height" constant="50" id="0Oe-e7-65D"/> | |||
<constraint firstAttribute="width" constant="60" id="YZ8-qE-lCY"/> | |||
</constraints> | |||
<fontDescription key="fontDescription" type="system" pointSize="18"/> | |||
<state key="normal" title="SAVE"/> | |||
<connections> | |||
<action selector="saveUserInfo:" destination="-1" eventType="touchUpInside" id="GNI-Zp-ynI"/> | |||
</connections> | |||
</button> | |||
</subviews> | |||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | |||
<constraints> | |||
<constraint firstItem="gaE-XL-e9v" firstAttribute="width" secondItem="vHr-Ek-MOn" secondAttribute="width" id="8Iv-Mw-cr8"/> | |||
<constraint firstItem="vHr-Ek-MOn" firstAttribute="leading" secondItem="zDW-b7-hgQ" secondAttribute="leading" id="96O-ga-aal"/> | |||
<constraint firstItem="iwH-k3-tJl" firstAttribute="centerY" secondItem="zDW-b7-hgQ" secondAttribute="centerY" id="ABB-er-Ht3"/> | |||
<constraint firstItem="zDW-b7-hgQ" firstAttribute="leading" secondItem="iwH-k3-tJl" secondAttribute="trailing" constant="40" id="AoC-0V-OYP"/> | |||
<constraint firstItem="vHr-Ek-MOn" firstAttribute="width" secondItem="zDW-b7-hgQ" secondAttribute="width" id="KMM-XI-gfe"/> | |||
<constraint firstItem="zDW-b7-hgQ" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="Pht-uG-LBF"/> | |||
<constraint firstAttribute="trailing" secondItem="iag-qe-5sf" secondAttribute="trailing" constant="20" id="W5p-Aj-xhW"/> | |||
<constraint firstItem="gaE-XL-e9v" firstAttribute="leading" secondItem="vHr-Ek-MOn" secondAttribute="leading" id="YMY-14-YT8"/> | |||
<constraint firstItem="iag-qe-5sf" firstAttribute="centerY" secondItem="cCJ-dU-qVg" secondAttribute="centerY" id="ZAV-ME-3YI"/> | |||
<constraint firstItem="zDW-b7-hgQ" firstAttribute="top" secondItem="cCJ-dU-qVg" secondAttribute="bottom" constant="80" id="auh-QW-xIM"/> | |||
<constraint firstItem="gaE-XL-e9v" firstAttribute="top" secondItem="vHr-Ek-MOn" secondAttribute="bottom" constant="40" id="cv9-ZC-Rh7"/> | |||
<constraint firstItem="cCJ-dU-qVg" firstAttribute="centerX" secondItem="i5M-Pr-FkT" secondAttribute="centerX" id="d92-zY-wNc"/> | |||
<constraint firstItem="Smm-hx-0FP" firstAttribute="trailing" secondItem="sZN-4s-rmi" secondAttribute="trailing" id="dGT-7Y-6Bu"/> | |||
<constraint firstItem="Smm-hx-0FP" firstAttribute="centerY" secondItem="gaE-XL-e9v" secondAttribute="centerY" id="fRX-JI-rOy"/> | |||
<constraint firstItem="vHr-Ek-MOn" firstAttribute="top" secondItem="zDW-b7-hgQ" secondAttribute="bottom" constant="40" id="iEf-tC-j8I"/> | |||
<constraint firstItem="sZN-4s-rmi" firstAttribute="trailing" secondItem="iwH-k3-tJl" secondAttribute="trailing" id="nNp-Qb-jqf"/> | |||
<constraint firstItem="cCJ-dU-qVg" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="60" id="qxQ-PV-4FH"/> | |||
<constraint firstItem="sZN-4s-rmi" firstAttribute="centerY" secondItem="vHr-Ek-MOn" secondAttribute="centerY" id="wrr-fg-Jqj"/> | |||
</constraints> | |||
<point key="canvasLocation" x="137.68115942028987" y="152.67857142857142"/> | |||
</view> | |||
</objects> | |||
</document> |
@@ -0,0 +1,17 @@ | |||
// | |||
// Bridging-Header.h | |||
// BodyfatScaleDemo_swift | |||
// | |||
// Created by steven wu on 2021/3/16. | |||
// | |||
#ifndef Bridging_Header_h | |||
#define Bridging_Header_h | |||
#import "MainViewController.h" | |||
#endif | |||
//convert oc to swift website | |||
//https://swiftify.com/converter/code/ |
@@ -0,0 +1,49 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |||
<plist version="1.0"> | |||
<dict> | |||
<key>CFBundleDevelopmentRegion</key> | |||
<string>$(DEVELOPMENT_LANGUAGE)</string> | |||
<key>CFBundleExecutable</key> | |||
<string>$(EXECUTABLE_NAME)</string> | |||
<key>CFBundleIdentifier</key> | |||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | |||
<key>CFBundleInfoDictionaryVersion</key> | |||
<string>6.0</string> | |||
<key>CFBundleName</key> | |||
<string>$(PRODUCT_NAME)</string> | |||
<key>CFBundlePackageType</key> | |||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | |||
<key>CFBundleShortVersionString</key> | |||
<string>1.0</string> | |||
<key>CFBundleVersion</key> | |||
<string>1</string> | |||
<key>LSRequiresIPhoneOS</key> | |||
<true/> | |||
<key>UIApplicationSupportsIndirectInputEvents</key> | |||
<true/> | |||
<key>UILaunchStoryboardName</key> | |||
<string>LaunchScreen</string> | |||
<key>UIMainStoryboardFile</key> | |||
<string>Main</string> | |||
<key>UIRequiredDeviceCapabilities</key> | |||
<array> | |||
<string>armv7</string> | |||
</array> | |||
<key>UISupportedInterfaceOrientations</key> | |||
<array> | |||
<string>UIInterfaceOrientationPortrait</string> | |||
<string>UIInterfaceOrientationLandscapeLeft</string> | |||
<string>UIInterfaceOrientationLandscapeRight</string> | |||
</array> | |||
<key>UISupportedInterfaceOrientations~ipad</key> | |||
<array> | |||
<string>UIInterfaceOrientationPortrait</string> | |||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | |||
<string>UIInterfaceOrientationLandscapeLeft</string> | |||
<string>UIInterfaceOrientationLandscapeRight</string> | |||
</array> | |||
<key>NSBluetoothAlwaysUsageDescription</key> | |||
<string>connect your scale</string> | |||
</dict> | |||
</plist> |
@@ -0,0 +1,19 @@ | |||
// | |||
// ViewController.swift | |||
// BodyfatScaleDemo_swift | |||
// | |||
// Created by steven wu on 2021/3/16. | |||
// | |||
import UIKit | |||
class ViewController: UIViewController { | |||
override func viewDidLoad() { | |||
super.viewDidLoad() | |||
// Do any additional setup after loading the view. | |||
} | |||
} | |||