diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.pbxproj b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.pbxproj new file mode 100644 index 0000000..dd2e6aa --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.pbxproj @@ -0,0 +1,480 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + C625DCFE28BF1106008F267F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DCFD28BF1106008F267F /* AppDelegate.m */; }; + C625DD0128BF1106008F267F /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD0028BF1106008F267F /* SceneDelegate.m */; }; + C625DD0428BF1106008F267F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD0328BF1106008F267F /* ViewController.m */; }; + C625DD0728BF1106008F267F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C625DD0528BF1106008F267F /* Main.storyboard */; }; + C625DD0928BF1108008F267F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C625DD0828BF1108008F267F /* Assets.xcassets */; }; + C625DD0C28BF1108008F267F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C625DD0A28BF1108008F267F /* LaunchScreen.storyboard */; }; + C625DD0F28BF1108008F267F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD0E28BF1108008F267F /* main.m */; }; + C625DD1828BF2BDF008F267F /* CIMService.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD1728BF2BDF008F267F /* CIMService.m */; }; + C66CFB5528BF9000002506AD /* CIMMessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB5428BF9000002506AD /* CIMMessageModel.m */; }; + C66CFB6928C07ED5002506AD /* ReplyBody.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6428C07ED5002506AD /* ReplyBody.pbobjc.m */; }; + C66CFB6A28C07ED5002506AD /* Message.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6528C07ED5002506AD /* Message.pbobjc.m */; }; + C66CFB6B28C07ED5002506AD /* SentBody.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6728C07ED5002506AD /* SentBody.pbobjc.m */; }; + C66CFB6E28C1B19C002506AD /* CIMSignalService.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6D28C1B19C002506AD /* CIMSignalService.m */; }; + C66CFB7828C3548F002506AD /* CIMSignalServiceBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB7728C3548F002506AD /* CIMSignalServiceBuffer.m */; }; + C66CFB7B28C38D8E002506AD /* CIMSignalPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB7A28C38D8E002506AD /* CIMSignalPacket.m */; }; + C68DFB5528D210790088E639 /* KCLDataWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = C68DFB4E28D210790088E639 /* KCLDataWriter.m */; }; + C68DFB5628D210790088E639 /* KCLDataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = C68DFB5128D210790088E639 /* KCLDataReader.m */; }; + C68DFB5728D210790088E639 /* CIMWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C68DFB5328D210790088E639 /* CIMWeakProxy.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + C625DCF928BF1106008F267F /* CIMKit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CIMKit.app; sourceTree = BUILT_PRODUCTS_DIR; }; + C625DCFC28BF1106008F267F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + C625DCFD28BF1106008F267F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + C625DCFF28BF1106008F267F /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = ""; }; + C625DD0028BF1106008F267F /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = ""; }; + C625DD0228BF1106008F267F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + C625DD0328BF1106008F267F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + C625DD0628BF1106008F267F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + C625DD0828BF1108008F267F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + C625DD0B28BF1108008F267F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + C625DD0D28BF1108008F267F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + C625DD0E28BF1108008F267F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + C625DD1628BF2BDE008F267F /* CIMService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMService.h; sourceTree = ""; }; + C625DD1728BF2BDF008F267F /* CIMService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMService.m; sourceTree = ""; }; + C66CFB5328BF9000002506AD /* CIMMessageModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMMessageModel.h; sourceTree = ""; }; + C66CFB5428BF9000002506AD /* CIMMessageModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMMessageModel.m; sourceTree = ""; }; + C66CFB6328C07ED5002506AD /* SentBody.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentBody.pbobjc.h; sourceTree = ""; }; + C66CFB6428C07ED5002506AD /* ReplyBody.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReplyBody.pbobjc.m; sourceTree = ""; }; + C66CFB6528C07ED5002506AD /* Message.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Message.pbobjc.m; sourceTree = ""; }; + C66CFB6628C07ED5002506AD /* ReplyBody.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplyBody.pbobjc.h; sourceTree = ""; }; + C66CFB6728C07ED5002506AD /* SentBody.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentBody.pbobjc.m; sourceTree = ""; }; + C66CFB6828C07ED5002506AD /* Message.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Message.pbobjc.h; sourceTree = ""; }; + C66CFB6C28C1B19C002506AD /* CIMSignalService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMSignalService.h; sourceTree = ""; }; + C66CFB6D28C1B19C002506AD /* CIMSignalService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMSignalService.m; sourceTree = ""; }; + C66CFB7628C3548F002506AD /* CIMSignalServiceBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMSignalServiceBuffer.h; sourceTree = ""; }; + C66CFB7728C3548F002506AD /* CIMSignalServiceBuffer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMSignalServiceBuffer.m; sourceTree = ""; }; + C66CFB7928C38D8E002506AD /* CIMSignalPacket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMSignalPacket.h; sourceTree = ""; }; + C66CFB7A28C38D8E002506AD /* CIMSignalPacket.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMSignalPacket.m; sourceTree = ""; }; + C68DFB4E28D210790088E639 /* KCLDataWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCLDataWriter.m; sourceTree = ""; }; + C68DFB4F28D210790088E639 /* KCLDataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCLDataReader.h; sourceTree = ""; }; + C68DFB5028D210790088E639 /* KCLDataWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCLDataWriter.h; sourceTree = ""; }; + C68DFB5128D210790088E639 /* KCLDataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCLDataReader.m; sourceTree = ""; }; + C68DFB5328D210790088E639 /* CIMWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CIMWeakProxy.m; sourceTree = ""; }; + C68DFB5428D210790088E639 /* CIMWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIMWeakProxy.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C625DCF628BF1106008F267F /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + B17C5FA540C326B8C638FB9C /* Pods */ = { + isa = PBXGroup; + children = ( + ); + path = Pods; + sourceTree = ""; + }; + C625DCF028BF1105008F267F = { + isa = PBXGroup; + children = ( + C625DCFB28BF1106008F267F /* CIMKit */, + C625DCFA28BF1106008F267F /* Products */, + B17C5FA540C326B8C638FB9C /* Pods */, + ); + sourceTree = ""; + }; + C625DCFA28BF1106008F267F /* Products */ = { + isa = PBXGroup; + children = ( + C625DCF928BF1106008F267F /* CIMKit.app */, + ); + name = Products; + sourceTree = ""; + }; + C625DCFB28BF1106008F267F /* CIMKit */ = { + isa = PBXGroup; + children = ( + C625DD1528BF2BA0008F267F /* CIMKit */, + C625DCFC28BF1106008F267F /* AppDelegate.h */, + C625DCFD28BF1106008F267F /* AppDelegate.m */, + C625DCFF28BF1106008F267F /* SceneDelegate.h */, + C625DD0028BF1106008F267F /* SceneDelegate.m */, + C625DD0228BF1106008F267F /* ViewController.h */, + C625DD0328BF1106008F267F /* ViewController.m */, + C625DD0528BF1106008F267F /* Main.storyboard */, + C625DD0828BF1108008F267F /* Assets.xcassets */, + C625DD0A28BF1108008F267F /* LaunchScreen.storyboard */, + C625DD0D28BF1108008F267F /* Info.plist */, + C625DD0E28BF1108008F267F /* main.m */, + ); + path = CIMKit; + sourceTree = ""; + }; + C625DD1528BF2BA0008F267F /* CIMKit */ = { + isa = PBXGroup; + children = ( + C68DFB4C28D210790088E639 /* Tool */, + C66CFB6228C07ED5002506AD /* Proto */, + C625DD1628BF2BDE008F267F /* CIMService.h */, + C625DD1728BF2BDF008F267F /* CIMService.m */, + C66CFB6C28C1B19C002506AD /* CIMSignalService.h */, + C66CFB6D28C1B19C002506AD /* CIMSignalService.m */, + C66CFB7628C3548F002506AD /* CIMSignalServiceBuffer.h */, + C66CFB7728C3548F002506AD /* CIMSignalServiceBuffer.m */, + C66CFB7928C38D8E002506AD /* CIMSignalPacket.h */, + C66CFB7A28C38D8E002506AD /* CIMSignalPacket.m */, + C66CFB5328BF9000002506AD /* CIMMessageModel.h */, + C66CFB5428BF9000002506AD /* CIMMessageModel.m */, + ); + path = CIMKit; + sourceTree = ""; + }; + C66CFB6228C07ED5002506AD /* Proto */ = { + isa = PBXGroup; + children = ( + C66CFB6328C07ED5002506AD /* SentBody.pbobjc.h */, + C66CFB6728C07ED5002506AD /* SentBody.pbobjc.m */, + C66CFB6628C07ED5002506AD /* ReplyBody.pbobjc.h */, + C66CFB6428C07ED5002506AD /* ReplyBody.pbobjc.m */, + C66CFB6828C07ED5002506AD /* Message.pbobjc.h */, + C66CFB6528C07ED5002506AD /* Message.pbobjc.m */, + ); + path = Proto; + sourceTree = ""; + }; + C68DFB4C28D210790088E639 /* Tool */ = { + isa = PBXGroup; + children = ( + C68DFB4D28D210790088E639 /* KCLDataReaderWriter */, + C68DFB5228D210790088E639 /* CIMWeakProxy */, + ); + path = Tool; + sourceTree = ""; + }; + C68DFB4D28D210790088E639 /* KCLDataReaderWriter */ = { + isa = PBXGroup; + children = ( + C68DFB4E28D210790088E639 /* KCLDataWriter.m */, + C68DFB4F28D210790088E639 /* KCLDataReader.h */, + C68DFB5028D210790088E639 /* KCLDataWriter.h */, + C68DFB5128D210790088E639 /* KCLDataReader.m */, + ); + path = KCLDataReaderWriter; + sourceTree = ""; + }; + C68DFB5228D210790088E639 /* CIMWeakProxy */ = { + isa = PBXGroup; + children = ( + C68DFB5328D210790088E639 /* CIMWeakProxy.m */, + C68DFB5428D210790088E639 /* CIMWeakProxy.h */, + ); + path = CIMWeakProxy; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C625DCF828BF1106008F267F /* CIMKit */ = { + isa = PBXNativeTarget; + buildConfigurationList = C625DD1228BF1108008F267F /* Build configuration list for PBXNativeTarget "CIMKit" */; + buildPhases = ( + C625DCF528BF1106008F267F /* Sources */, + C625DCF628BF1106008F267F /* Frameworks */, + C625DCF728BF1106008F267F /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CIMKit; + productName = CIMKit; + productReference = C625DCF928BF1106008F267F /* CIMKit.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + C625DCF128BF1105008F267F /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastUpgradeCheck = 1340; + TargetAttributes = { + C625DCF828BF1106008F267F = { + CreatedOnToolsVersion = 13.4; + }; + }; + }; + buildConfigurationList = C625DCF428BF1105008F267F /* Build configuration list for PBXProject "CIMKit" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = C625DCF028BF1105008F267F; + productRefGroup = C625DCFA28BF1106008F267F /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + C625DCF828BF1106008F267F /* CIMKit */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + C625DCF728BF1106008F267F /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C625DD0C28BF1108008F267F /* LaunchScreen.storyboard in Resources */, + C625DD0928BF1108008F267F /* Assets.xcassets in Resources */, + C625DD0728BF1106008F267F /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C625DCF528BF1106008F267F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C66CFB7828C3548F002506AD /* CIMSignalServiceBuffer.m in Sources */, + C68DFB5728D210790088E639 /* CIMWeakProxy.m in Sources */, + C625DD0428BF1106008F267F /* ViewController.m in Sources */, + C66CFB5528BF9000002506AD /* CIMMessageModel.m in Sources */, + C66CFB6B28C07ED5002506AD /* SentBody.pbobjc.m in Sources */, + C66CFB7B28C38D8E002506AD /* CIMSignalPacket.m in Sources */, + C68DFB5528D210790088E639 /* KCLDataWriter.m in Sources */, + C625DCFE28BF1106008F267F /* AppDelegate.m in Sources */, + C625DD0F28BF1108008F267F /* main.m in Sources */, + C625DD1828BF2BDF008F267F /* CIMService.m in Sources */, + C68DFB5628D210790088E639 /* KCLDataReader.m in Sources */, + C66CFB6928C07ED5002506AD /* ReplyBody.pbobjc.m in Sources */, + C66CFB6E28C1B19C002506AD /* CIMSignalService.m in Sources */, + C66CFB6A28C07ED5002506AD /* Message.pbobjc.m in Sources */, + C625DD0128BF1106008F267F /* SceneDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + C625DD0528BF1106008F267F /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C625DD0628BF1106008F267F /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + C625DD0A28BF1108008F267F /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C625DD0B28BF1108008F267F /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C625DD1028BF1108008F267F /* 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++17"; + 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; + }; + name = Debug; + }; + C625DD1128BF1108008F267F /* 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++17"; + 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; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C625DD1328BF1108008F267F /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = H6UN23L6E6; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = CIMKit/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.chen.CIMKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + C625DD1428BF1108008F267F /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = H6UN23L6E6; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = CIMKit/Info.plist; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen; + INFOPLIST_KEY_UIMainStoryboardFile = Main; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.chen.CIMKit; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_EMIT_LOC_STRINGS = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C625DCF428BF1105008F267F /* Build configuration list for PBXProject "CIMKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C625DD1028BF1108008F267F /* Debug */, + C625DD1128BF1108008F267F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C625DD1228BF1108008F267F /* Build configuration list for PBXNativeTarget "CIMKit" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C625DD1328BF1108008F267F /* Debug */, + C625DD1428BF1108008F267F /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = C625DCF128BF1105008F267F /* Project object */; +} diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/xcuserdata/chentao.xcuserdatad/UserInterfaceState.xcuserstate b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/xcuserdata/chentao.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..f09c664 Binary files /dev/null and b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/project.xcworkspace/xcuserdata/chentao.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/xcuserdata/chentao.xcuserdatad/xcschemes/xcschememanagement.plist b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/xcuserdata/chentao.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..6a36bac --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcodeproj/xcuserdata/chentao.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + CIMKit.xcscheme_^#shared#^_ + + orderHint + 3 + + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/contents.xcworkspacedata b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..223cbd2 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcuserdata/chentao.xcuserdatad/UserInterfaceState.xcuserstate b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcuserdata/chentao.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..edd84d8 Binary files /dev/null and b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcuserdata/chentao.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcuserdata/chentao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcuserdata/chentao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..d843b94 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit.xcworkspace/xcuserdata/chentao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/AppDelegate.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/AppDelegate.h new file mode 100644 index 0000000..99fe37e --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/AppDelegate.h @@ -0,0 +1,14 @@ +// +// AppDelegate.h +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import + +@interface AppDelegate : UIResponder + + +@end + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/AppDelegate.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/AppDelegate.m new file mode 100644 index 0000000..08c6226 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/AppDelegate.m @@ -0,0 +1,43 @@ +// +// AppDelegate.m +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + + + + return YES; +} + + +#pragma mark - UISceneSession lifecycle + + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { + // Called when a new scene session is being created. + // Use this method to select a configuration to create the new scene with. + return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role]; +} + + +- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet *)sceneSessions { + // Called when the user discards a scene session. + // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. + // Use this method to release any resources that were specific to the discarded scenes, as they will not return. +} + + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/AccentColor.colorset/Contents.json b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/AppIcon.appiconset/Contents.json b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..5a3257a --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,93 @@ +{ + "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" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/Contents.json b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Base.lproj/LaunchScreen.storyboard b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Base.lproj/Main.storyboard b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Base.lproj/Main.storyboard new file mode 100644 index 0000000..808a21c --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Base.lproj/Main.storyboard @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMMessageModel.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMMessageModel.h new file mode 100644 index 0000000..3d09083 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMMessageModel.h @@ -0,0 +1,34 @@ +// +// CIMMessageModel.h +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CIMMessageModel : NSObject + +@property (nonatomic, readwrite) int64_t id_p; + +@property (nonatomic, readwrite, copy) NSString *action; + +@property (nonatomic, readwrite, copy) NSString *content; + +@property (nonatomic, readwrite, copy) NSString *sender; + +@property (nonatomic, readwrite, copy) NSString *receiver; + +@property (nonatomic, readwrite, copy) NSString *extra; + +@property (nonatomic, readwrite, copy) NSString *title; + +@property (nonatomic, readwrite, copy) NSString *format; + +@property (nonatomic, readwrite) int64_t timestamp; + +@end + +NS_ASSUME_NONNULL_END diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMMessageModel.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMMessageModel.m new file mode 100644 index 0000000..0ec068f --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMMessageModel.m @@ -0,0 +1,12 @@ +// +// CIMMessageModel.m +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import "CIMMessageModel.h" + +@implementation CIMMessageModel + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMService.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMService.h new file mode 100644 index 0000000..9fa5f17 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMService.h @@ -0,0 +1,148 @@ +// +// CIMService.h +// CIMKit +// +// Created by Chentao on 2022/9/4. +// +// + +#import +#import "CIMMessageModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@class CIMService; + +/** + 消息回调 + */ +@protocol CIMPeerMessageObserver + +/** + 接受到消息 + */ +- (void)cimHandleMessage:(CIMMessageModel *_Nonnull)msg; + +/** + 消息解析失败 + */ +- (void)cimHandleMessageError:(NSData *_Nonnull)data; + +@end + +/** + 服务器连接回调 + */ +@protocol CIMConnectionObserver +@optional + +/** + 用户绑定成功 + */ +- (void)cimDidBindUserSuccess:(BOOL)bindSuccess; + +/** + 连接成功 + */ +- (void)cimDidConnectSuccess; + +/** + 重连回调 + */ +- (void)cimDidReconnection:(NSInteger)reconnectionCount; + +/** + 断开连接 + */ +- (void)cimDidConnectClose; + +/** + 连接失败 + */ +- (void)cimDidConnectError:(NSError *_Nullable)error; + +@end + +@interface CIMService : NSObject + ++ (CIMService *)instance; + +@property (nonatomic, readonly) BOOL isConnected; + +/** + 指示由于网络原因导致连接断开是否自动重连,reconnection = YES 自动重连,reconnection = NO 不自动重连; + 默认reconnection = YES; + 重连逻辑受reconnectionTimeInterval和reconnectionMaxCount影响; + */ +@property (nonatomic, assign) BOOL reconnection; + +/** + 当reconnection = YES时自动重连的时间间隔,默认reconnectionTimeInterval=1.0 单位:秒; + */ +@property (nonatomic, assign) NSTimeInterval reconnectionTimeInterval; + +/** + 当reconnection = YES时自动重连的最大次数,默认reconnectionMaxCount=3; + */ +@property (nonatomic, assign) NSInteger reconnectionMaxCount; + +/** + 配置IM服务器 + */ +- (void)configHost:(NSString *)host onPort:(NSInteger)port; + +/** + 连接到host:port对应的服务器 + */ +- (void)connection; + +/** + 绑定userId,需要更具isConnected判断当前连接的状态; + 如果isConnected=NO需要先调用[[CIMService instance] connection],等到连接成功后再调用[[CIMService instance] bindUserId:]; + 如果isConnected=YES,可直接调用[[CIMService instance] bindUserId:]; + */ +- (void)bindUserId:(NSString *)userId; + +/** + 添加消息监听回调,(可添加多个)不同时记得Remove + */ +- (void)addMessageObserver:(id)observer; + +/** + 移除监听 + */ +- (void)removeMessageObserver:(id)observer; + +/** + 添加连接状态监听回调,(可添加多个)不同时记得Remove + */ +- (void)addConnectionObserver:(id)observer; + +/** + 移除监听 + */ +- (void)removeConnectionObserver:(id)observer; + +/** + 退出后台 断开连接 + */ +- (void)enterBackground; + +/** + 进入前台重新连接 + */ +- (void)enterForeground; + +/** + 重新连接 + */ +- (void)reconnect; + +/** + 断开连接 + */ +- (void)disconnect; + +@end + +NS_ASSUME_NONNULL_END diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMService.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMService.m new file mode 100644 index 0000000..c9592b6 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMService.m @@ -0,0 +1,417 @@ +// +// CIMService.m +// CIMKit +// +// Created by Chentao on 2022/9/4. +// +// + +#import "CIMService.h" +#import "CIMSignalService.h" +#import "SentBody.pbobjc.h" +#import "ReplyBody.pbobjc.h" +#import "Message.pbobjc.h" +#import +#import "CIMWeakProxy.h" + +@interface CIMService () + +@property (nonatomic, strong) CIMSignalService *signalService; + +@property (nonatomic, strong) NSMutableArray *connectionObservers; +@property (nonatomic, strong) NSMutableArray *messageObservers; + +@property (nonatomic, assign) BOOL manualDisconnect; + +@property (nonatomic, assign) NSInteger reconnectionCount; + +@property (nonatomic, strong) NSTimer *reconnectionTimer; + +@end + +@implementation CIMService + +static CIMService *SINGLETON = nil; + +static bool isFirstAccess = YES; + +#pragma mark - Public Method + ++ (id)instance { + static dispatch_once_t onceToken; + + dispatch_once(&onceToken, ^{ + isFirstAccess = NO; + SINGLETON = [[super allocWithZone:NULL] init]; + }); + return SINGLETON; +} + +#pragma mark - Life Cycle + ++ (id)allocWithZone:(NSZone *)zone { + return [self instance]; +} + +- (id)copy { + return [[CIMService alloc] init]; +} + +- (id)mutableCopy { + return [[CIMService alloc] init]; +} + +- (id)init { + if (SINGLETON) { + return SINGLETON; + } + + if (isFirstAccess) { + [self doesNotRecognizeSelector:_cmd]; + } + + self = [super init]; + + self.reconnection = YES; + self.reconnectionTimeInterval = 1.0; + self.reconnectionMaxCount = 3; + self.reconnectionCount = 0; + return self; +} + +#pragma mark - connectionObservers +- (NSMutableArray *)connectionObservers { + if (!_connectionObservers) { + _connectionObservers = [[NSMutableArray alloc] init]; + } + + return _connectionObservers; +} + +- (void)addConnectionObserver:(id)observer { + NSValue *value = [NSValue valueWithNonretainedObject:observer]; + + if (![self.connectionObservers containsObject:value]) { + [self.connectionObservers addObject:value]; + } +} + +- (void)removeConnectionObserver:(id)observer { + NSValue *value = [NSValue valueWithNonretainedObject:observer]; + + if ([self.connectionObservers containsObject:value]) { + [self.connectionObservers removeObject:value]; + } +} + +#pragma mark - messageObservers +- (NSMutableArray *)messageObservers { + if (!_messageObservers) { + _messageObservers = [[NSMutableArray alloc] init]; + } + + return _messageObservers; +} + +- (void)addMessageObserver:(id)observer { + NSValue *value = [NSValue valueWithNonretainedObject:observer]; + + if (![self.messageObservers containsObject:value]) { + [self.messageObservers addObject:value]; + } +} + +- (void)removeMessageObserver:(id)observer { + NSValue *value = [NSValue valueWithNonretainedObject:observer]; + + if ([self.messageObservers containsObject:value]) { + [self.messageObservers removeObject:value]; + } +} + +#pragma mark - signalService + +- (CIMSignalService *)signalService { + if (!_signalService) { + _signalService = [[CIMSignalService alloc] init]; + _signalService.delegate = self; + } + + return _signalService; +} + +#pragma mark - CIMSignalServiceDelegate + +/** + * 将要开始连接 + **/ +- (void)signalServiceWillConnect:(CIMSignalService *)signalService { +} + +/** + * 开始连接时出错 + **/ +- (void)signalServiceWillConnect:(CIMSignalService *)signalService error:(NSError *)error { + [self handlerConnectError:error]; +} + +/** + * 连接成功 + **/ +- (void)signalServiceConnectSuccess:(CIMSignalService *)signalService { + self.manualDisconnect = NO; + self.reconnectionCount = 0; + [self handlerConnectSuccess]; +} + +/** + * 连接断开 + **/ +- (void)signalServiceDidDisconnect:(CIMSignalService *)signalService error:(NSError *)error { + if (!self.manualDisconnect && self.reconnection && self.reconnectionCount < self.reconnectionMaxCount) { + //如果非手动断开连接 并且 需要自动重连 并且 reconnectionCount < reconnectionMaxCount + [self startReconnectionTimer]; + } else { + [self handlerConnectClose]; + } +} + +/** + * 收到新包 + **/ +- (void)signalService:(CIMSignalService *)signalService receivePacket:(CIMSignalPacket *)packet { + switch (packet.tag) { + case CIMSignalPacketTypePing:{ + NSLog(@"receive Ping"); + CIMSignalPacket *pongSignalPacket = [self createPongPacket]; + [self.signalService sendSignalPacket:pongSignalPacket]; + break; + } + + case CIMSignalPacketTypeMessage:{ + NSLog(@"receive Message"); + NSError *error; + + MessageModel *messgae = [[MessageModel alloc] initWithData:packet.packetBody error:&error]; + + if (!error) { + //返回消息 + CIMMessageModel *messageModel = [[CIMMessageModel alloc] init]; + messageModel.id_p = messgae.id_p; + messageModel.title = messgae.title; + messageModel.action = messgae.action; + messageModel.timestamp = messgae.timestamp; + messageModel.extra = messgae.extra; + messageModel.format = messgae.format; + messageModel.sender = messgae.sender; + messageModel.content = messgae.content; + messageModel.receiver = messgae.receiver; + [self handlerMessage:messageModel]; + } else { + [self handlerMessageError:packet.packetBody]; + } + + break; + } + + case CIMSignalPacketTypeReplyBody:{ + NSLog(@"receive ReplyBody"); + NSError *error; + ReplyBodyModel *replyBodyModel = [[ReplyBodyModel alloc] initWithData:packet.packetBody error:&error]; + + if (!error) { + [self handlerBindUser:[@"200" isEqualToString:replyBodyModel.code]]; + } else { + [self handlerBindUser:NO]; + } + + break; + } + + default:{ + break; + } + } +} + +#pragma mark - + +- (void)startReconnectionTimer { + [self stopReconnectionTimer]; + self.reconnectionTimer = [NSTimer timerWithTimeInterval:self.reconnectionTimeInterval target:[CIMWeakProxy proxyWithTarget:self] selector:@selector(reconnectionTimerHandler) userInfo:nil repeats:NO]; + [NSRunLoop.mainRunLoop addTimer:self.reconnectionTimer forMode:NSRunLoopCommonModes]; +} + +- (void)stopReconnectionTimer { + if (self.reconnectionTimer) { + [self.reconnectionTimer invalidate]; + self.reconnectionTimer = nil; + } +} + +- (void)reconnectionTimerHandler { + self.reconnectionCount += 1; + [self handlerDidReconnection:self.reconnectionCount]; + [self connection]; +} + +#pragma mark - public + +- (void)configHost:(NSString *)host onPort:(NSInteger)port { + CIMSignalServiceConfig *config = [[CIMSignalServiceConfig alloc] init]; + + config.host = host; + config.port = port; + self.signalService.serviceConfig = config; +} + +- (void)connection { + if (self.signalService.isConnected) { + return; + } + + [self.signalService connect]; +} + +- (void)bindUserId:(NSString *)userId { + if (self.signalService.isConnected) { + CIMSignalPacket *clientBindPacket = [self createClientBindPacketWithUserId:userId]; + [self.signalService sendSignalPacket:clientBindPacket]; + } +} + +- (void)enterBackground { + [self disconnect]; +} + +- (void)enterForeground { + [self reconnect]; +} + +- (void)reconnect { + [self connection]; +} + +- (void)disconnect { + if (self.signalService.isConnected) { + self.manualDisconnect = YES; + [self stopReconnectionTimer]; + [self.signalService close]; + } +} + +#pragma mark - +- (void)handlerConnectSuccess { + for (NSValue *value in self.messageObservers) { + id ob = [value nonretainedObjectValue]; + + if ([ob respondsToSelector:@selector(cimDidConnectSuccess)]) { + [ob cimDidConnectSuccess]; + } + } +} + +- (void)handlerDidReconnection:(NSInteger)count { + for (NSValue *value in self.connectionObservers) { + id ob = [value nonretainedObjectValue]; + + if ([ob respondsToSelector:@selector(cimDidReconnection:)]) { + [ob cimDidReconnection:count]; + } + } +} + +- (void)handlerConnectClose { + for (NSValue *value in self.connectionObservers) { + id ob = [value nonretainedObjectValue]; + + if ([ob respondsToSelector:@selector(cimDidConnectClose)]) { + [ob cimDidConnectClose]; + } + } +} + +- (void)handlerConnectError:(NSError *)error { + for (NSValue *value in self.messageObservers) { + id ob = [value nonretainedObjectValue]; + + if ([ob respondsToSelector:@selector(cimDidConnectError:)]) { + [ob cimDidConnectError:error]; + } + } +} + +- (void)handlerMessageError:(NSData *)data { + for (NSValue *value in self.messageObservers) { + id ob = [value nonretainedObjectValue]; + + if ([ob respondsToSelector:@selector(cimHandleMessageError:)]) { + [ob cimHandleMessageError:data]; + } + } +} + +- (void)handlerMessage:(CIMMessageModel *)message { + for (NSValue *value in self.messageObservers) { + id ob = [value nonretainedObjectValue]; + + if ([ob respondsToSelector:@selector(cimHandleMessage:)]) { + [ob cimHandleMessage:message]; + } + } +} + +- (void)handlerBindUser:(BOOL)bindSuccess { + for (NSValue *value in self.connectionObservers) { + id ob = [value nonretainedObjectValue]; + + if ([ob respondsToSelector:@selector(cimDidBindUserSuccess:)]) { + [ob cimDidBindUserSuccess:bindSuccess]; + } + } +} + +- (CIMSignalPacket *)createClientBindPacketWithUserId:(NSString *)userId { + SentBodyModel *clientBindBody = [SentBodyModel new]; + + clientBindBody.key = @"client_bind"; + clientBindBody.timestamp = (int64_t)[NSDate timeIntervalSinceReferenceDate] * 1000; + clientBindBody.data_p[@"uid"] = userId; + clientBindBody.data_p[@"deviceId"] = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; + clientBindBody.data_p[@"channel"] = @"ios"; + + clientBindBody.data_p[@"deviceName"] = [[UIDevice currentDevice] name]; + + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; + clientBindBody.data_p[@"appVersion"] = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; + + clientBindBody.data_p[@"osVersion"] = [[UIDevice currentDevice] systemVersion]; + + NSArray *languages = [NSLocale preferredLanguages]; + clientBindBody.data_p[@"language"] = [languages firstObject]; + NSData *bodyData = clientBindBody.data; + + CIMSignalPacket *clientBindPacket = [[CIMSignalPacket alloc] init]; + clientBindPacket.tag = CIMSignalPacketTypeSentBody; + clientBindPacket.bodyLength = bodyData.length; + clientBindPacket.packetBody = bodyData; + + return clientBindPacket; +} + +- (CIMSignalPacket *)createPongPacket { + CIMSignalPacket *pongPacket = [[CIMSignalPacket alloc] init]; + + pongPacket.tag = CIMSignalPacketTypePong; + + NSString *pong = @"PONG"; + const char *pongChar = [pong cStringUsingEncoding:NSASCIIStringEncoding]; + UInt16 lenght = pong.length; + NSData *bodyData = [NSData dataWithBytes:pongChar length:lenght]; + + pongPacket.bodyLength = bodyData.length; + pongPacket.packetBody = bodyData; + return pongPacket; +} + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalPacket.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalPacket.h new file mode 100644 index 0000000..3e90458 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalPacket.h @@ -0,0 +1,30 @@ +// +// CIMSignalPacket.h +// CIMKit +// +// Created by Chentao on 2022/9/3. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +extern UInt8 const CIMSIGNAL_PACKET_HEAD_SIZE; + +typedef NS_ENUM(UInt8, CIMSignalPacketType) { + CIMSignalPacketTypePong = 0, //PONG + CIMSignalPacketTypePing = 1, //PING + CIMSignalPacketTypeMessage = 2, //Message + CIMSignalPacketTypeSentBody = 3, //SentBody + CIMSignalPacketTypeReplyBody = 4, //ReplyBody +}; + +@interface CIMSignalPacket : NSObject + +@property (nonatomic, assign) CIMSignalPacketType tag; +@property (nonatomic, assign) UInt16 bodyLength; +@property (nonatomic, strong) NSData *packetBody; + +@end + +NS_ASSUME_NONNULL_END diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalPacket.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalPacket.m new file mode 100644 index 0000000..01d8f40 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalPacket.m @@ -0,0 +1,14 @@ +// +// CIMSignalPacket.m +// CIMKit +// +// Created by Chentao on 2022/9/3. +// + +#import "CIMSignalPacket.h" + +UInt8 const CIMSIGNAL_PACKET_HEAD_SIZE = 3; + +@implementation CIMSignalPacket + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalService.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalService.h new file mode 100644 index 0000000..1a02e68 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalService.h @@ -0,0 +1,65 @@ +// +// CIMSignalService.h +// CIMKit +// +// Created by Chentao on 2022/9/2. +// + +#import +#import "CIMSignalPacket.h" +NS_ASSUME_NONNULL_BEGIN + +@interface CIMSignalServiceConfig : NSObject + +@property (nonatomic, copy) NSString *host; +@property (nonatomic, assign) NSInteger port; + +@end + +@class CIMSignalService; +@protocol CIMSignalServiceDelegate + +/** + * 将要开始连接 + **/ +- (void)signalServiceWillConnect:(CIMSignalService *)signalService; + +/** + * 开始连接时出错 + **/ +- (void)signalServiceWillConnect:(CIMSignalService *)signalService error:(NSError *)error; + +/** + * 连接成功 + **/ +- (void)signalServiceConnectSuccess:(CIMSignalService *)signalService; + +/** + * 连接断开 + **/ +- (void)signalServiceDidDisconnect:(CIMSignalService *)signalService error:(NSError *)error; + +/** + * 收到新包 + **/ +- (void)signalService:(CIMSignalService *)signalService receivePacket:(CIMSignalPacket *)packet; + +@end + +@interface CIMSignalService : NSObject + +@property (nonatomic, weak) id delegate; + +@property (nonatomic, strong) CIMSignalServiceConfig *serviceConfig; + +@property (nonatomic, readonly) BOOL isConnected; + +- (void)connect; + +- (void)close; + +- (void)sendSignalPacket:(CIMSignalPacket *)signalPacket; + +@end + +NS_ASSUME_NONNULL_END diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalService.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalService.m new file mode 100644 index 0000000..10af984 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalService.m @@ -0,0 +1,129 @@ +// +// CIMSignalService.m +// CIMKit +// +// Created by Chentao on 2022/9/2. +// + +#import "CIMSignalService.h" +#import "GCDAsyncSocket.h" +#import "CIMSignalServiceBuffer.h" +#import "KCLDataWriter.h" + +@implementation CIMSignalServiceConfig + +@end + +@interface CIMSignalService () + +@property (nonatomic, strong) NSLock *signalBufferLock; + +@property (nonatomic, strong) CIMSignalServiceBuffer *signalBuffer; + +@property (nonatomic, strong) GCDAsyncSocket *socket; + +@end + +@implementation CIMSignalService + +- (instancetype)init { + self = [super init]; + + if (self) { + self.socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_queue_create("SignalServiceQueue", NULL)]; + + self.signalBufferLock = [[NSLock alloc]init]; + + self.signalBuffer = [[CIMSignalServiceBuffer alloc] init]; + self.signalBuffer.delegate = self; + } + + return self; +} + +- (BOOL)isConnected { + return self.socket.isConnected; +} + +- (void)connect { + if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceWillConnect:)]) { + [self.delegate signalServiceWillConnect:self]; + } + + NSError *error; + [self.socket connectToHost:self.serviceConfig.host onPort:self.serviceConfig.port withTimeout:15 error:&error]; + + if (error) { + //NSLog(@"connect error:%@", error); + + if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceWillConnect:error:)]) { + [self.delegate signalServiceWillConnect:self error:error]; + } + } +} + +- (void)close { + [self.socket disconnect]; +} + +- (void)sendSignalPacket:(CIMSignalPacket *)signalPacket { + KCLDataWriter *dataWriter = [KCLDataWriter writerWithData:[[NSMutableData alloc] init]]; + + [dataWriter writeByte:signalPacket.tag]; + [dataWriter writeUInt16:signalPacket.bodyLength]; + + if (signalPacket) { + [dataWriter writeBytes:signalPacket.packetBody]; + } + + [self.socket writeData:dataWriter.data withTimeout:30 tag:0]; +} + +#pragma mark - GCDAsyncSocketDelegate +- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port { + //NSLog(@"%s", __FUNCTION__); + [self.signalBufferLock lock]; + [self.signalBuffer clear]; + [self.signalBufferLock unlock]; + [sock readDataWithTimeout:-1 tag:0]; + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceConnectSuccess:)]) { + [self.delegate signalServiceConnectSuccess:self]; + } + }); +} + +- (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)error { + //NSLog(@"%s", __FUNCTION__); + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceDidDisconnect:error:)]) { + [self.delegate signalServiceDidDisconnect:self error:error]; + } + }); +} + +- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag { + //NSLog(@"%s", __FUNCTION__); + [sock readDataWithTimeout:-1 tag:0]; +} + +- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag { + //NSLog(@"%s", __FUNCTION__); + [self.signalBufferLock lock]; + [self.signalBuffer appendData:data]; + [self.signalBufferLock unlock]; + + [sock readDataWithTimeout:-1 tag:0]; +} + +#pragma mark - CIMSignalServiceBufferDelegate + +- (void)signalServiceBuffer:(CIMSignalServiceBuffer *)signalServiceBuffer receiveSignalPacket:(CIMSignalPacket *)signalPacket { + dispatch_async(dispatch_get_main_queue(), ^{ + if (self.delegate && [self.delegate respondsToSelector:@selector(signalService:receivePacket:)]) { + [self.delegate signalService:self receivePacket:signalPacket]; + } + }); +} + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalServiceBuffer.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalServiceBuffer.h new file mode 100644 index 0000000..0897470 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalServiceBuffer.h @@ -0,0 +1,29 @@ +// +// CIMSignalServiceBuffer.h +// CIMKit +// +// Created by Chentao on 2022/9/3. +// + +#import +#import "CIMSignalPacket.h" +NS_ASSUME_NONNULL_BEGIN + +@class CIMSignalServiceBuffer; +@protocol CIMSignalServiceBufferDelegate + +- (void)signalServiceBuffer:(CIMSignalServiceBuffer *)signalServiceBuffer receiveSignalPacket:(CIMSignalPacket *)signalPacket; + +@end + +@interface CIMSignalServiceBuffer : NSObject + +@property (nonatomic, weak) id delegate; + +- (void)appendData:(NSData *)data; + +- (void)clear; + +@end + +NS_ASSUME_NONNULL_END diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalServiceBuffer.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalServiceBuffer.m new file mode 100644 index 0000000..68f729e --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/CIMSignalServiceBuffer.m @@ -0,0 +1,86 @@ +// +// CIMSignalServiceBuffer.m +// CIMKit +// +// Created by Chentao on 2022/9/3. +// + +#import "CIMSignalServiceBuffer.h" + +@interface CIMSignalServiceBuffer () + +@property (nonatomic, strong) NSMutableData *byteDatas; + +@end + +@implementation CIMSignalServiceBuffer + +- (instancetype)init { + self = [super init]; + + if (self) { + self.byteDatas = [[NSMutableData alloc] init]; + } + + return self; +} + +- (void)appendData:(NSData *)data { + [self.byteDatas appendData:data]; + + BOOL hasPacket = YES; + + while (hasPacket) { + @autoreleasepool { + if (CIMSIGNAL_PACKET_HEAD_SIZE <= self.byteDatas.length) { + NSData *headData = [self.byteDatas subdataWithRange:NSMakeRange(0, CIMSIGNAL_PACKET_HEAD_SIZE)]; + uint8_t *ptr = (uint8_t *)headData.bytes; + uint64_t _poz = 0; + + uint8_t tag = *(uint8_t *)ptr; + _poz += sizeof(uint8_t); + + uint16_t bodyLength = *(uint16_t *)(ptr + _poz); + _poz += sizeof(uint16_t); + + UInt32 packetSize = CIMSIGNAL_PACKET_HEAD_SIZE + bodyLength; + + if (packetSize <= self.byteDatas.length) { + NSData *packetBody = [self.byteDatas subdataWithRange:NSMakeRange(CIMSIGNAL_PACKET_HEAD_SIZE, bodyLength)]; + + CIMSignalPacket *signalPacket = [[CIMSignalPacket alloc] init]; + signalPacket.tag = tag; + signalPacket.bodyLength = bodyLength; + signalPacket.packetBody = packetBody; + + if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceBuffer:receiveSignalPacket:)]) { + [self.delegate signalServiceBuffer:self receiveSignalPacket:signalPacket]; + } + + NSMutableData *newByteDatas = [self subdata:self.byteDatas loc:packetSize length:self.byteDatas.length - packetSize]; + self.byteDatas = newByteDatas; + hasPacket = YES; + } else { + hasPacket = NO; + } + } else { + hasPacket = NO; + } + } + } +} + +- (void)clear { + @autoreleasepool { + self.byteDatas = [[NSMutableData alloc] init]; + } +} + +- (NSMutableData *)subdata:(NSMutableData *)data loc:(NSUInteger)loc length:(NSUInteger)len { + NSRange subRange = NSMakeRange(loc, len); + NSMutableData *newByteDatas = [[NSMutableData alloc] initWithData:[data subdataWithRange:subRange]]; + + return newByteDatas; +} + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/Message.pbobjc.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/Message.pbobjc.h new file mode 100644 index 0000000..8cf62dc --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/Message.pbobjc.h @@ -0,0 +1,89 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Message.proto + +// This CPP symbol can be defined to use imports that match up to the framework +// imports needed when using CocoaPods. +#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) + #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#endif + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS + #import +#else + #import "GPBProtocolBuffers.h" +#endif + +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. +#endif + +// @@protoc_insertion_point(imports) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +CF_EXTERN_C_BEGIN + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark - MessageRoot + +/** + * Exposes the extension registry for this file. + * + * The base class provides: + * @code + * + (GPBExtensionRegistry *)extensionRegistry; + * @endcode + * which is a @c GPBExtensionRegistry that includes all the extensions defined by + * this file and all files that it depends on. + **/ +@interface MessageRoot : GPBRootObject +@end + +#pragma mark - Model + +typedef GPB_ENUM(MessageModel_FieldNumber) { + MessageModel_FieldNumber_Id_p = 1, + MessageModel_FieldNumber_Action = 2, + MessageModel_FieldNumber_Content = 3, + MessageModel_FieldNumber_Sender = 4, + MessageModel_FieldNumber_Receiver = 5, + MessageModel_FieldNumber_Extra = 6, + MessageModel_FieldNumber_Title = 7, + MessageModel_FieldNumber_Format = 8, + MessageModel_FieldNumber_Timestamp = 9, +}; + +@interface MessageModel : GPBMessage + +@property(nonatomic, readwrite) int64_t id_p; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *action; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *content; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *sender; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *receiver; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *extra; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *title; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *format; + +@property(nonatomic, readwrite) int64_t timestamp; + +@end + +NS_ASSUME_NONNULL_END + +CF_EXTERN_C_END + +#pragma clang diagnostic pop + +// @@protoc_insertion_point(global_scope) diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/Message.pbobjc.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/Message.pbobjc.m new file mode 100644 index 0000000..3524aa1 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/Message.pbobjc.m @@ -0,0 +1,181 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Message.proto + +// This CPP symbol can be defined to use imports that match up to the framework +// imports needed when using CocoaPods. +#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) + #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#endif + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS + #import +#else + #import "GPBProtocolBuffers_RuntimeSupport.h" +#endif + +#import "Message.pbobjc.h" +// @@protoc_insertion_point(imports) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +#pragma mark - MessageRoot + +@implementation MessageRoot + +// No extensions in the file and no imports, so no need to generate +// +extensionRegistry. + +@end + +#pragma mark - MessageRoot_FileDescriptor + +static GPBFileDescriptor *MessageRoot_FileDescriptor(void) { + // This is called by +initialize so there is no need to worry + // about thread safety of the singleton. + static GPBFileDescriptor *descriptor = NULL; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"" + syntax:GPBFileSyntaxProto3]; + } + return descriptor; +} + +#pragma mark - Model + +@implementation MessageModel + +@dynamic id_p; +@dynamic action; +@dynamic content; +@dynamic sender; +@dynamic receiver; +@dynamic extra; +@dynamic title; +@dynamic format; +@dynamic timestamp; + +typedef struct Model__storage_ { + uint32_t _has_storage_[1]; + NSString *action; + NSString *content; + NSString *sender; + NSString *receiver; + NSString *extra; + NSString *title; + NSString *format; + int64_t id_p; + int64_t timestamp; +} Model__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "id_p", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Id_p, + .hasIndex = 0, + .offset = (uint32_t)offsetof(Model__storage_, id_p), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt64, + }, + { + .name = "action", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Action, + .hasIndex = 1, + .offset = (uint32_t)offsetof(Model__storage_, action), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "content", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Content, + .hasIndex = 2, + .offset = (uint32_t)offsetof(Model__storage_, content), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "sender", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Sender, + .hasIndex = 3, + .offset = (uint32_t)offsetof(Model__storage_, sender), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "receiver", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Receiver, + .hasIndex = 4, + .offset = (uint32_t)offsetof(Model__storage_, receiver), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "extra", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Extra, + .hasIndex = 5, + .offset = (uint32_t)offsetof(Model__storage_, extra), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "title", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Title, + .hasIndex = 6, + .offset = (uint32_t)offsetof(Model__storage_, title), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "format", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Format, + .hasIndex = 7, + .offset = (uint32_t)offsetof(Model__storage_, format), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "timestamp", + .dataTypeSpecific.className = NULL, + .number = MessageModel_FieldNumber_Timestamp, + .hasIndex = 8, + .offset = (uint32_t)offsetof(Model__storage_, timestamp), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt64, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[MessageModel class] + rootClass:[MessageRoot class] + file:MessageRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(Model__storage_) + flags:GPBDescriptorInitializationFlag_None]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + + +#pragma clang diagnostic pop + +// @@protoc_insertion_point(global_scope) diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/ReplyBody.pbobjc.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/ReplyBody.pbobjc.h new file mode 100644 index 0000000..8be2466 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/ReplyBody.pbobjc.h @@ -0,0 +1,79 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ReplyBody.proto + +// This CPP symbol can be defined to use imports that match up to the framework +// imports needed when using CocoaPods. +#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) + #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#endif + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS + #import +#else + #import "GPBProtocolBuffers.h" +#endif + +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. +#endif + +// @@protoc_insertion_point(imports) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +CF_EXTERN_C_BEGIN + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark - ReplyBodyRoot + +/** + * Exposes the extension registry for this file. + * + * The base class provides: + * @code + * + (GPBExtensionRegistry *)extensionRegistry; + * @endcode + * which is a @c GPBExtensionRegistry that includes all the extensions defined by + * this file and all files that it depends on. + **/ +@interface ReplyBodyRoot : GPBRootObject +@end + +#pragma mark - Model + +typedef GPB_ENUM(ReplyBodyModel_FieldNumber) { + ReplyBodyModel_FieldNumber_Key = 1, + ReplyBodyModel_FieldNumber_Code = 2, + ReplyBodyModel_FieldNumber_Message = 3, + ReplyBodyModel_FieldNumber_Timestamp = 4, + ReplyBodyModel_FieldNumber_Data_p = 5, +}; + +@interface ReplyBodyModel : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSString *key; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *code; + +@property(nonatomic, readwrite, copy, null_resettable) NSString *message; + +@property(nonatomic, readwrite) int64_t timestamp; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary *data_p; +/** The number of items in @c data_p without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger data_p_Count; + +@end + +NS_ASSUME_NONNULL_END + +CF_EXTERN_C_END + +#pragma clang diagnostic pop + +// @@protoc_insertion_point(global_scope) diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/ReplyBody.pbobjc.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/ReplyBody.pbobjc.m new file mode 100644 index 0000000..6925be5 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/ReplyBody.pbobjc.m @@ -0,0 +1,137 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ReplyBody.proto + +// This CPP symbol can be defined to use imports that match up to the framework +// imports needed when using CocoaPods. +#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) + #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#endif + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS + #import +#else + #import "GPBProtocolBuffers_RuntimeSupport.h" +#endif + +#import "ReplyBody.pbobjc.h" +// @@protoc_insertion_point(imports) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +#pragma mark - ReplyBodyRoot + +@implementation ReplyBodyRoot + +// No extensions in the file and no imports, so no need to generate +// +extensionRegistry. + +@end + +#pragma mark - ReplyBodyRoot_FileDescriptor + +static GPBFileDescriptor *ReplyBodyRoot_FileDescriptor(void) { + // This is called by +initialize so there is no need to worry + // about thread safety of the singleton. + static GPBFileDescriptor *descriptor = NULL; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"" + syntax:GPBFileSyntaxProto3]; + } + return descriptor; +} + +#pragma mark - Model + +@implementation ReplyBodyModel + +@dynamic key; +@dynamic code; +@dynamic message; +@dynamic timestamp; +@dynamic data_p, data_p_Count; + +typedef struct Model__storage_ { + uint32_t _has_storage_[1]; + NSString *key; + NSString *code; + NSString *message; + NSMutableDictionary *data_p; + int64_t timestamp; +} Model__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "key", + .dataTypeSpecific.className = NULL, + .number = ReplyBodyModel_FieldNumber_Key, + .hasIndex = 0, + .offset = (uint32_t)offsetof(Model__storage_, key), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "code", + .dataTypeSpecific.className = NULL, + .number = ReplyBodyModel_FieldNumber_Code, + .hasIndex = 1, + .offset = (uint32_t)offsetof(Model__storage_, code), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "message", + .dataTypeSpecific.className = NULL, + .number = ReplyBodyModel_FieldNumber_Message, + .hasIndex = 2, + .offset = (uint32_t)offsetof(Model__storage_, message), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "timestamp", + .dataTypeSpecific.className = NULL, + .number = ReplyBodyModel_FieldNumber_Timestamp, + .hasIndex = 3, + .offset = (uint32_t)offsetof(Model__storage_, timestamp), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt64, + }, + { + .name = "data_p", + .dataTypeSpecific.className = NULL, + .number = ReplyBodyModel_FieldNumber_Data_p, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(Model__storage_, data_p), + .flags = GPBFieldMapKeyString, + .dataType = GPBDataTypeString, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[ReplyBodyModel class] + rootClass:[ReplyBodyRoot class] + file:ReplyBodyRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(Model__storage_) + flags:GPBDescriptorInitializationFlag_None]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + + +#pragma clang diagnostic pop + +// @@protoc_insertion_point(global_scope) diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/SentBody.pbobjc.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/SentBody.pbobjc.h new file mode 100644 index 0000000..45f9a15 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/SentBody.pbobjc.h @@ -0,0 +1,73 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SentBody.proto + +// This CPP symbol can be defined to use imports that match up to the framework +// imports needed when using CocoaPods. +#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) + #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#endif + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS + #import +#else + #import "GPBProtocolBuffers.h" +#endif + +#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002 +#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources. +#endif +#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION +#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources. +#endif + +// @@protoc_insertion_point(imports) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +CF_EXTERN_C_BEGIN + +NS_ASSUME_NONNULL_BEGIN + +#pragma mark - SentBodyRoot + +/** + * Exposes the extension registry for this file. + * + * The base class provides: + * @code + * + (GPBExtensionRegistry *)extensionRegistry; + * @endcode + * which is a @c GPBExtensionRegistry that includes all the extensions defined by + * this file and all files that it depends on. + **/ +@interface SentBodyRoot : GPBRootObject +@end + +#pragma mark - Model + +typedef GPB_ENUM(Model_FieldNumber) { + Model_FieldNumber_Key = 1, + Model_FieldNumber_Timestamp = 2, + Model_FieldNumber_Data_p = 3, +}; + +@interface SentBodyModel : GPBMessage + +@property(nonatomic, readwrite, copy, null_resettable) NSString *key; + +@property(nonatomic, readwrite) int64_t timestamp; + +@property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary *data_p; +/** The number of items in @c data_p without causing the array to be created. */ +@property(nonatomic, readonly) NSUInteger data_p_Count; + +@end + +NS_ASSUME_NONNULL_END + +CF_EXTERN_C_END + +#pragma clang diagnostic pop + +// @@protoc_insertion_point(global_scope) diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/SentBody.pbobjc.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/SentBody.pbobjc.m new file mode 100644 index 0000000..27aede2 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Proto/SentBody.pbobjc.m @@ -0,0 +1,118 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SentBody.proto + +// This CPP symbol can be defined to use imports that match up to the framework +// imports needed when using CocoaPods. +#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS) + #define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0 +#endif + +#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS + #import +#else + #import "GPBProtocolBuffers_RuntimeSupport.h" +#endif + +#import "SentBody.pbobjc.h" +// @@protoc_insertion_point(imports) + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + +#pragma mark - SentBodyRoot + +@implementation SentBodyRoot + +// No extensions in the file and no imports, so no need to generate +// +extensionRegistry. + +@end + +#pragma mark - SentBodyRoot_FileDescriptor + +static GPBFileDescriptor *SentBodyRoot_FileDescriptor(void) { + // This is called by +initialize so there is no need to worry + // about thread safety of the singleton. + static GPBFileDescriptor *descriptor = NULL; + if (!descriptor) { + GPB_DEBUG_CHECK_RUNTIME_VERSIONS(); + descriptor = [[GPBFileDescriptor alloc] initWithPackage:@"" + syntax:GPBFileSyntaxProto3]; + } + return descriptor; +} + +#pragma mark - Model + +@implementation SentBodyModel + +@dynamic key; +@dynamic timestamp; +@dynamic data_p, data_p_Count; + +typedef struct Model__storage_ { + uint32_t _has_storage_[1]; + NSString *key; + NSMutableDictionary *data_p; + int64_t timestamp; +} Model__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "key", + .dataTypeSpecific.className = NULL, + .number = Model_FieldNumber_Key, + .hasIndex = 0, + .offset = (uint32_t)offsetof(Model__storage_, key), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + }, + { + .name = "timestamp", + .dataTypeSpecific.className = NULL, + .number = Model_FieldNumber_Timestamp, + .hasIndex = 1, + .offset = (uint32_t)offsetof(Model__storage_, timestamp), + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt64, + }, + { + .name = "data_p", + .dataTypeSpecific.className = NULL, + .number = Model_FieldNumber_Data_p, + .hasIndex = GPBNoHasBit, + .offset = (uint32_t)offsetof(Model__storage_, data_p), + .flags = GPBFieldMapKeyString, + .dataType = GPBDataTypeString, + }, + }; + + + + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[SentBodyModel class] + rootClass:[SentBodyRoot class] + file:SentBodyRoot_FileDescriptor() + fields:fields + fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription)) + storageSize:sizeof(Model__storage_) + flags:GPBDescriptorInitializationFlag_None]; + #if defined(DEBUG) && DEBUG + NSAssert(descriptor == nil, @"Startup recursed!"); + #endif // DEBUG + descriptor = localDescriptor; + } + return descriptor; +} + +@end + + +#pragma clang diagnostic pop + +// @@protoc_insertion_point(global_scope) diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/CIMWeakProxy/CIMWeakProxy.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/CIMWeakProxy/CIMWeakProxy.h new file mode 100644 index 0000000..1ba933b --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/CIMWeakProxy/CIMWeakProxy.h @@ -0,0 +1,21 @@ +// +// CIMWeakProxy.h +// CIMKit +// +// Created by Chentao on 2022/9/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CIMWeakProxy : NSProxy + +@property (weak, readonly, nullable, nonatomic) id target; + +- (nonnull instancetype)initWithTarget:(nonnull id)target; ++ (nonnull instancetype)proxyWithTarget:(nonnull id)target; + +@end + +NS_ASSUME_NONNULL_END diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/CIMWeakProxy/CIMWeakProxy.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/CIMWeakProxy/CIMWeakProxy.m new file mode 100644 index 0000000..908cb6b --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/CIMWeakProxy/CIMWeakProxy.m @@ -0,0 +1,79 @@ +// +// CIMWeakProxy.m +// CIMKit +// +// Created by Chentao on 2022/9/14. +// + +#import "CIMWeakProxy.h" + +@implementation CIMWeakProxy + +- (instancetype)initWithTarget:(id)target { + _target = target; + return self; +} + ++ (instancetype)proxyWithTarget:(id)target { + return [[CIMWeakProxy alloc] initWithTarget:target]; +} + +- (id)forwardingTargetForSelector:(SEL)selector { + return _target; +} + +- (void)forwardInvocation:(NSInvocation *)invocation { + void *null = NULL; + + [invocation setReturnValue:&null]; +} + +- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { + return [NSObject instanceMethodSignatureForSelector:@selector(init)]; +} + +- (BOOL)respondsToSelector:(SEL)aSelector { + return [_target respondsToSelector:aSelector]; +} + +- (BOOL)isEqual:(id)object { + return [_target isEqual:object]; +} + +- (NSUInteger)hash { + return [_target hash]; +} + +- (Class)superclass { + return [_target superclass]; +} + +- (Class)class { + return [_target class]; +} + +- (BOOL)isKindOfClass:(Class)aClass { + return [_target isKindOfClass:aClass]; +} + +- (BOOL)isMemberOfClass:(Class)aClass { + return [_target isMemberOfClass:aClass]; +} + +- (BOOL)conformsToProtocol:(Protocol *)aProtocol { + return [_target conformsToProtocol:aProtocol]; +} + +- (BOOL)isProxy { + return YES; +} + +- (NSString *)description { + return [_target description]; +} + +- (NSString *)debugDescription { + return [_target debugDescription]; +} + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataReader.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataReader.h new file mode 100644 index 0000000..bbf4659 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataReader.h @@ -0,0 +1,33 @@ +// +// KCLDataReader.h +// TeachingClient +// +// Created by Chentao on 2017/4/27. +// Copyright © 2017年 Chentao. All rights reserved. +// + +#import + +@interface KCLDataReader : NSObject + +@property (nonatomic, assign) uint64_t poz; +@property (nonatomic, strong, readonly) NSData *data; + ++ (instancetype)readerWithData:(NSData *)data; +- (instancetype)initWithData:(NSData *)data; + +- (NSData *)readBytes:(uint64_t)len; +- (int32_t)readInt32; +- (int64_t)readInt64; +- (int16_t)readInt16; +- (uint32_t)readUInt32; +- (uint64_t)readUInt64; +- (uint16_t)readUInt16; +- (char)readByte; +- (BOOL)readBool; +- (NSString *)readString; +- (NSData *)readPrefixedBytes; +- (float)readFloat; +- (double)readDouble; + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataReader.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataReader.m new file mode 100644 index 0000000..882e1ec --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataReader.m @@ -0,0 +1,123 @@ +// +// KCLDataReader.m +// TeachingClient +// +// Created by Chentao on 2017/4/27. +// Copyright © 2017年 Chentao. All rights reserved. +// + +#import "KCLDataReader.h" + +@implementation KCLDataReader { + char *_pointer; +} + ++ (instancetype)readerWithData:(NSData *)data { + return [[KCLDataReader alloc] initWithData:data]; +} + +- (instancetype)initWithData:(NSData *)data { + self = [super init]; + + if (!self || !data) { + return nil; + } + + _data = data; + _pointer = (char *)data.bytes; + return self; +} + +- (NSData *)readBytes:(uint64_t)len { + if (!len) { + return nil; + } + + NSData *data = [_data subdataWithRange:NSMakeRange(_poz, len)]; + _poz += len; + return data; +} + +- (NSData *)readPrefixedBytes { + uint32_t len = [self readUInt32]; + + return [self readBytes:len]; +} + +- (int32_t)readInt32 { + char *ptr = _pointer + _poz; + + _poz += sizeof(int32_t); + return *(int32_t *)ptr; +} + +- (int64_t)readInt64 { + char *ptr = _pointer + _poz; + + _poz += sizeof(int64_t); + return *(int64_t *)ptr; +} + +- (int16_t)readInt16 { + char *ptr = _pointer + _poz; + + _poz += sizeof(int16_t); + return *(int16_t *)ptr; +} + +- (uint32_t)readUInt32 { + char *ptr = _pointer + _poz; + + _poz += sizeof(uint32_t); + return *(uint32_t *)ptr; +} + +- (uint64_t)readUInt64 { + char *ptr = _pointer + _poz; + + _poz += sizeof(uint64_t); + return *(uint64_t *)ptr; +} + +- (uint16_t)readUInt16 { + char *ptr = _pointer + _poz; + + _poz += sizeof(uint16_t); + return *(uint16_t *)ptr; +} + +- (char)readByte { + char *ptr = _pointer + _poz; + + _poz += sizeof(char); + return *(char *)ptr; +} + +- (BOOL)readBool { + char *ptr = _pointer + _poz; + + _poz += sizeof(BOOL); + return *(BOOL *)ptr; +} + +- (float)readFloat { + char *ptr = _pointer + _poz; + + _poz += sizeof(float); + return *(float *)ptr; +} + +- (double)readDouble { + char *ptr = _pointer + _poz; + + _poz += sizeof(double); + return *(double *)ptr; +} + +- (NSString *)readString { + NSData *data = [self readPrefixedBytes]; + + return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; +} + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataWriter.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataWriter.h new file mode 100644 index 0000000..9e6d2db --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataWriter.h @@ -0,0 +1,34 @@ +// +// KCLDataWriter.h +// TeachingClient +// +// Created by Chentao on 2017/4/27. +// Copyright © 2017年 Chentao. All rights reserved. +// + +#import + +@interface KCLDataWriter : NSObject + +@property (nonatomic, strong, readonly) NSMutableData *data; + ++ (instancetype)writerWithData:(NSMutableData *)data; +- (instancetype)initWithData:(NSMutableData *)data; + +- (void)writeBytes:(NSData *)bytes; +- (void)writeBytes:(const char *)rawBytes length:(uint32_t)length; +- (void)writePrefixedBytes:(NSData *)data; +- (void)writeInt32:(int32_t)value; +- (void)writeInt64:(int64_t)value; +- (void)writeInt16:(int16_t)value; +- (void)writeUInt32:(uint32_t)value; +- (void)writeUInt64:(uint64_t)value; +- (void)writeUInt16:(uint16_t)value; +- (void)writeByte:(char)byte; +- (void)writeBool:(BOOL)value; +- (void)writeString:(NSString *)str; +- (void)writeFloat:(float)value; +- (void)writeDouble:(double)value; + + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataWriter.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataWriter.m new file mode 100644 index 0000000..3a2f146 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/CIMKit/Tool/KCLDataReaderWriter/KCLDataWriter.m @@ -0,0 +1,90 @@ +// +// KCLDataWriter.m +// TeachingClient +// +// Created by Chentao on 2017/4/27. +// Copyright © 2017年 Chentao. All rights reserved. +// + +#import "KCLDataWriter.h" + +@implementation KCLDataWriter + + ++ (instancetype)writerWithData:(NSMutableData *)data { + return [[KCLDataWriter alloc] initWithData:data]; +} + +- (instancetype)initWithData:(NSMutableData *)data { + self = [super init]; + + if (!self || !data) { + return nil; + } + + _data = data; + return self; +} + +- (void)writeBytes:(NSData *)bytes { + if (bytes.length) { + [_data appendData:bytes]; + } +} + +- (void)writeBytes:(const char *)rawBytes length:(uint32_t)length { + if (length) { + [_data appendBytes:rawBytes length:length]; + } +} + +- (void)writePrefixedBytes:(NSData *)data { + [self writeUInt32:(uint32_t)data.length]; + [self writeBytes:data]; +} + +- (void)writeInt32:(int32_t)value { + [self writeBytes:(const char *)&value length:sizeof(int32_t)]; +} + +- (void)writeInt64:(int64_t)value { + [self writeBytes:(const char *)&value length:sizeof(int64_t)]; +} + +- (void)writeInt16:(int16_t)value { + [self writeBytes:(const char *)&value length:sizeof(int16_t)]; +} + +- (void)writeUInt32:(uint32_t)value { + [self writeBytes:(const char *)&value length:sizeof(uint32_t)]; +} + +- (void)writeUInt64:(uint64_t)value { + [self writeBytes:(const char *)&value length:sizeof(uint64_t)]; +} + +- (void)writeUInt16:(uint16_t)value { + [self writeBytes:(const char *)&value length:sizeof(uint16_t)]; +} + +- (void)writeByte:(char)byte { + [self writeBytes:(const char *)&byte length:sizeof(char)]; +} + +- (void)writeBool:(BOOL)value { + [self writeByte:value ? 1 : 0]; +} + +- (void)writeString:(NSString *)str { + [self writePrefixedBytes:[str dataUsingEncoding:NSUTF8StringEncoding]]; +} + +- (void)writeFloat:(float)value { + [self writeBytes:(const char *)&value length:sizeof(float)]; +} + +- (void)writeDouble:(double)value { + [self writeBytes:(const char *)&value length:sizeof(double)]; +} + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Info.plist b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Info.plist new file mode 100644 index 0000000..81ed29b --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/Info.plist @@ -0,0 +1,25 @@ + + + + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneConfigurationName + Default Configuration + UISceneDelegateClassName + SceneDelegate + UISceneStoryboardFile + Main + + + + + + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/SceneDelegate.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/SceneDelegate.h new file mode 100644 index 0000000..2305c54 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/SceneDelegate.h @@ -0,0 +1,15 @@ +// +// SceneDelegate.h +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import + +@interface SceneDelegate : UIResponder + +@property (strong, nonatomic) UIWindow * window; + +@end + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/SceneDelegate.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/SceneDelegate.m new file mode 100644 index 0000000..16200af --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/SceneDelegate.m @@ -0,0 +1,57 @@ +// +// SceneDelegate.m +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import "SceneDelegate.h" + +@interface SceneDelegate () + +@end + +@implementation SceneDelegate + + +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { + // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. + // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. + // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). +} + + +- (void)sceneDidDisconnect:(UIScene *)scene { + // Called as the scene is being released by the system. + // This occurs shortly after the scene enters the background, or when its session is discarded. + // Release any resources associated with this scene that can be re-created the next time the scene connects. + // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). +} + + +- (void)sceneDidBecomeActive:(UIScene *)scene { + // Called when the scene has moved from an inactive state to an active state. + // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. +} + + +- (void)sceneWillResignActive:(UIScene *)scene { + // Called when the scene will move from an active state to an inactive state. + // This may occur due to temporary interruptions (ex. an incoming phone call). +} + + +- (void)sceneWillEnterForeground:(UIScene *)scene { + // Called as the scene transitions from the background to the foreground. + // Use this method to undo the changes made on entering the background. +} + + +- (void)sceneDidEnterBackground:(UIScene *)scene { + // Called as the scene transitions from the foreground to the background. + // Use this method to save data, release shared resources, and store enough scene-specific state information + // to restore the scene back to its current state. +} + + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/ViewController.h b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/ViewController.h new file mode 100644 index 0000000..5e4618b --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/ViewController.h @@ -0,0 +1,14 @@ +// +// ViewController.h +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/ViewController.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/ViewController.m new file mode 100644 index 0000000..f0799bd --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/ViewController.m @@ -0,0 +1,106 @@ +// +// ViewController.m +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import "ViewController.h" +#import "CIMService.h" + +@interface ViewController () + +@property (nonatomic, strong) UIButton *addObserverButton; + +@property (nonatomic, strong) UIButton *removeObserverButton; + +@property (nonatomic, strong) UIButton *connectButton; + +@property (nonatomic, strong) UIButton *closeButton; + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + [[CIMService instance] configHost:@"120.53.221.43" onPort:23456]; + + self.addObserverButton = [[UIButton alloc] initWithFrame:CGRectMake(50, 100, 150, 50)]; + self.addObserverButton.backgroundColor = [UIColor grayColor]; + [self.addObserverButton addTarget:self action:@selector(addObserverButtonHandler) forControlEvents:UIControlEventTouchUpInside]; + [self.addObserverButton setTitle:@"addObserver" forState:UIControlStateNormal]; + [self.view addSubview:self.addObserverButton]; + + self.removeObserverButton = [[UIButton alloc] initWithFrame:CGRectMake(220, 100, 150, 50)]; + self.removeObserverButton.backgroundColor = [UIColor grayColor]; + [self.removeObserverButton addTarget:self action:@selector(removeObserverButtonHandler) forControlEvents:UIControlEventTouchUpInside]; + [self.removeObserverButton setTitle:@"removeObserver" forState:UIControlStateNormal]; + [self.view addSubview:self.removeObserverButton]; + + self.connectButton = [[UIButton alloc] initWithFrame:CGRectMake(50, 170, 150, 50)]; + self.connectButton.backgroundColor = [UIColor grayColor]; + [self.connectButton addTarget:self action:@selector(connectButtonHandler) forControlEvents:UIControlEventTouchUpInside]; + [self.connectButton setTitle:@"connec" forState:UIControlStateNormal]; + [self.view addSubview:self.connectButton]; + + self.closeButton = [[UIButton alloc] initWithFrame:CGRectMake(220, 170, 150, 50)]; + self.closeButton.backgroundColor = [UIColor grayColor]; + [self.closeButton addTarget:self action:@selector(closeButtonHandler) forControlEvents:UIControlEventTouchUpInside]; + [self.closeButton setTitle:@"close" forState:UIControlStateNormal]; + [self.view addSubview:self.closeButton]; +} + +- (void)addObserverButtonHandler { + [[CIMService instance] addConnectionObserver:self]; + [[CIMService instance] addMessageObserver:self]; +} + +- (void)removeObserverButtonHandler { + [[CIMService instance] removeConnectionObserver:self]; + [[CIMService instance] removeMessageObserver:self]; +} + +- (void)connectButtonHandler { + [[CIMService instance] connection]; +} + +- (void)closeButtonHandler { + [[CIMService instance] disconnect]; +} + +#pragma mark - CIMConnectionObserver + +- (void)cimDidBindUserSuccess:(BOOL)bindSuccess { + NSLog(@"%s",__FUNCTION__); +} + +- (void)cimDidConnectSuccess { + [[CIMService instance] bindUserId:@"2222"]; + NSLog(@"%s",__FUNCTION__); +} + +- (void)cimDidReconnection:(NSInteger)reconnectionCount { + NSLog(@"reconnection count:%@", @(reconnectionCount)); +} + +- (void)cimDidConnectClose { + NSLog(@"%s",__FUNCTION__); +} + +- (void)cimDidConnectError:(NSError *_Nullable)error { + NSLog(@"%s",__FUNCTION__); +} + +#pragma mark - CIMPeerMessageObserver + +- (void)cimHandleMessage:(CIMMessageModel *_Nonnull)msg { + NSLog(@"%s",__FUNCTION__); +} + +- (void)cimHandleMessageError:(NSData *_Nonnull)data { + NSLog(@"%s",__FUNCTION__); +} + +@end diff --git a/cim-client-sdk/cim-ios-oc-sdk/CIMKit/main.m b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/main.m new file mode 100644 index 0000000..ef2437d --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/CIMKit/main.m @@ -0,0 +1,18 @@ +// +// main.m +// CIMKit +// +// Created by Chentao on 2022/8/31. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + NSString * appDelegateClassName; + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + appDelegateClassName = NSStringFromClass([AppDelegate class]); + } + return UIApplicationMain(argc, argv, nil, appDelegateClassName); +} diff --git a/cim-client-sdk/cim-ios-oc-sdk/Podfile b/cim-client-sdk/cim-ios-oc-sdk/Podfile new file mode 100644 index 0000000..88851d2 --- /dev/null +++ b/cim-client-sdk/cim-ios-oc-sdk/Podfile @@ -0,0 +1,13 @@ +# Uncomment the next line to define a global platform for your project +# platform :ios, '9.0' + +target 'CIMKit' do + # Comment the next line if you don't want to use dynamic frameworks + use_frameworks! + + # Pods for CIMKit + pod 'Protobuf', '~> 3.21.5' + pod "CocoaAsyncSocket", '~> 7.6.5' + + +end