diff --git a/CoatySwift/Classes/Common/CoatyObjectFamily.swift b/CoatySwift/Classes/Common/CoatyObjectFamily.swift index e120cc1..e1f5b1a 100644 --- a/CoatySwift/Classes/Common/CoatyObjectFamily.swift +++ b/CoatySwift/Classes/Common/CoatyObjectFamily.swift @@ -22,7 +22,7 @@ public enum CoatyObjectFamily: String, ObjectFamily { case log = "coaty.Log" case location = "coaty.Location" case snapshot = "coaty.Snapshot" - case component = "coaty.Component" + case identity = "coaty.Component" // Core type matching for dynamic coaty applications. case core_CoatyObject = "CoatyObject" @@ -34,7 +34,7 @@ public enum CoatyObjectFamily: String, ObjectFamily { case core_IoSource = "IoSource" case core_IoActor = "IoActor" case core_Config = "Config" - case core_Component = "Component" + case core_Identity = "Component" case core_Log = "Log" case core_Location = "Location" @@ -42,8 +42,8 @@ public enum CoatyObjectFamily: String, ObjectFamily { switch self { case .coatyObject: return CoatyObject.self - case .component: - return Component.self + case .identity: + return Identity.self case .snapshot: // This does _not always_ work properly. Snapshot objects need to be parametrized with the // object family of the snapshotted objects. The base implementation only allows core objects. diff --git a/CoatySwift/Classes/Communication/Events/AdvertiseEvent.swift b/CoatySwift/Classes/Communication/Events/AdvertiseEvent.swift index 397eb50..1693add 100644 --- a/CoatySwift/Classes/Communication/Events/AdvertiseEvent.swift +++ b/CoatySwift/Classes/Communication/Events/AdvertiseEvent.swift @@ -24,14 +24,14 @@ public class AdvertiseEventFactory: EventFactoryInit { /// Note that this class should preferably be initialized via its withObject() method. public class AdvertiseEvent: CommunicationEvent> { - override init(eventSource: Component, eventData: AdvertiseEventData) { + override init(eventSource: Identity, eventData: AdvertiseEventData) { super.init(eventSource: eventSource, eventData: eventData) } /// Convenience factory method that configures an instance of an AdvertiseEvent with /// an object and privateData. Note that the event source should be the controller that /// creates the AdvertiseEvent. - internal static func withObject(eventSource: Component, + internal static func withObject(eventSource: Identity, object: CoatyObject, privateData: [String: Any]? = nil) -> AdvertiseEvent { diff --git a/CoatySwift/Classes/Communication/Events/CallEvent.swift b/CoatySwift/Classes/Communication/Events/CallEvent.swift index 78951b0..38db888 100644 --- a/CoatySwift/Classes/Communication/Events/CallEvent.swift +++ b/CoatySwift/Classes/Communication/Events/CallEvent.swift @@ -83,11 +83,11 @@ public class CallEvent: CommunicationEvent) { + fileprivate override init(eventSource: Identity, eventData: CallEventData) { super.init(eventSource: eventSource, eventData: eventData) } - fileprivate init(eventSource: Component, eventData: CallEventData, operation: String) { + fileprivate init(eventSource: Identity, eventData: CallEventData, operation: String) { if !CommunicationTopic.isValidEventTypeFilter(filter: operation) { LogManager.log.warning("\(operation) is not a valid operation name.") diff --git a/CoatySwift/Classes/Communication/Events/ChannelEvent.swift b/CoatySwift/Classes/Communication/Events/ChannelEvent.swift index ce4ed19..3ff4175 100644 --- a/CoatySwift/Classes/Communication/Events/ChannelEvent.swift +++ b/CoatySwift/Classes/Communication/Events/ChannelEvent.swift @@ -51,11 +51,11 @@ public class ChannelEvent: CommunicationEvent) { + fileprivate override init(eventSource: Identity, eventData: ChannelEventData) { super.init(eventSource: eventSource, eventData: eventData) } - internal init(eventSource: Component, eventData: ChannelEventData, channelId: String) { + internal init(eventSource: Identity, eventData: ChannelEventData, channelId: String) { if !CommunicationTopic.isValidEventTypeFilter(filter: channelId) { LogManager.log.warning("\(channelId) is not a valid channel identifier.") diff --git a/CoatySwift/Classes/Communication/Events/CommunicationEvent.swift b/CoatySwift/Classes/Communication/Events/CommunicationEvent.swift index 7f91e46..6700fd4 100644 --- a/CoatySwift/Classes/Communication/Events/CommunicationEvent.swift +++ b/CoatySwift/Classes/Communication/Events/CommunicationEvent.swift @@ -17,7 +17,7 @@ public class CommunicationEvent: Codable { /// Event data that conforms to event type specific CommunicationEventData public var data: T - public var source: Component? + public var source: Identity? public var sourceId: CoatyUUID? /// The associated user id of an inbound event. The value is always nil for @@ -27,7 +27,7 @@ public class CommunicationEvent: Codable { // MARK: - Initializer. - init(eventSource: Component, eventData: T) { + init(eventSource: Identity, eventData: T) { self.source = eventSource self.sourceId = eventSource.objectId self.userId = nil diff --git a/CoatySwift/Classes/Communication/Events/CompleteEvent.swift b/CoatySwift/Classes/Communication/Events/CompleteEvent.swift index ea25f40..12f3d6d 100644 --- a/CoatySwift/Classes/Communication/Events/CompleteEvent.swift +++ b/CoatySwift/Classes/Communication/Events/CompleteEvent.swift @@ -26,7 +26,7 @@ public class CompleteEventFactory: EventFactoryInit { /// Note that this class should preferably be initialized via its withObject() method. public class CompleteEvent: CommunicationEvent> { - override init(eventSource: Component, eventData: CompleteEventData) { + override init(eventSource: Identity, eventData: CompleteEventData) { super.init(eventSource: eventSource, eventData: eventData) } diff --git a/CoatySwift/Classes/Communication/Events/DeadvertiseEvent.swift b/CoatySwift/Classes/Communication/Events/DeadvertiseEvent.swift index 68ee70c..bff7b9c 100644 --- a/CoatySwift/Classes/Communication/Events/DeadvertiseEvent.swift +++ b/CoatySwift/Classes/Communication/Events/DeadvertiseEvent.swift @@ -20,14 +20,14 @@ public class DeadvertiseEventFactory: EventFactoryInit { /// Note that this class should preferably be initialized via its withObjectIds() method. public class DeadvertiseEvent: CommunicationEvent> { - override init(eventSource: Component, eventData: DeadvertiseEventData) { + override init(eventSource: Identity, eventData: DeadvertiseEventData) { super.init(eventSource: eventSource, eventData: eventData) } /// Convenience factory method that configures an instance of a DeadvertiseEvent with /// object ids to be deadvertised. Note that the event source should be the controller that /// creates the DeadvertiseEvent. - internal static func withObjectIds(eventSource: Component, + internal static func withObjectIds(eventSource: Identity, objectIds: [CoatyUUID]) throws -> DeadvertiseEvent { let deadvertiseEventData = DeadvertiseEventData(objectIds: objectIds) diff --git a/CoatySwift/Classes/Communication/Events/DiscoverEvent.swift b/CoatySwift/Classes/Communication/Events/DiscoverEvent.swift index 9d4dec7..2f4e9c7 100644 --- a/CoatySwift/Classes/Communication/Events/DiscoverEvent.swift +++ b/CoatySwift/Classes/Communication/Events/DiscoverEvent.swift @@ -103,7 +103,7 @@ public class DiscoverEvent: CommunicationEvent: EventFactoryInit { public var CallEvent: CallEventFactory public var ReturnEvent: ReturnEventFactory - override init(_ identity: Component) { + override init(_ identity: Identity) { self.AdvertiseEvent = AdvertiseEventFactory(identity) self.DeadvertiseEvent = DeadvertiseEventFactory(identity) self.ChannelEvent = ChannelEventFactory(identity) diff --git a/CoatySwift/Classes/Communication/Events/QueryEvent.swift b/CoatySwift/Classes/Communication/Events/QueryEvent.swift index f0afaf2..bd1077f 100644 --- a/CoatySwift/Classes/Communication/Events/QueryEvent.swift +++ b/CoatySwift/Classes/Communication/Events/QueryEvent.swift @@ -65,7 +65,7 @@ public class QueryEvent: CommunicationEvent) { + fileprivate override init(eventSource: Identity, eventData: QueryEventData) { super.init(eventSource: eventSource, eventData: eventData) } diff --git a/CoatySwift/Classes/Communication/Events/ResolveEvent.swift b/CoatySwift/Classes/Communication/Events/ResolveEvent.swift index de1f796..ca57524 100644 --- a/CoatySwift/Classes/Communication/Events/ResolveEvent.swift +++ b/CoatySwift/Classes/Communication/Events/ResolveEvent.swift @@ -50,7 +50,7 @@ public class ResolveEvent: CommunicationEvent) { + override init(eventSource: Identity, eventData: ResolveEventData) { super.init(eventSource: eventSource, eventData: eventData) } diff --git a/CoatySwift/Classes/Communication/Events/RetrieveEvent.swift b/CoatySwift/Classes/Communication/Events/RetrieveEvent.swift index 67e493c..0dc2ae0 100644 --- a/CoatySwift/Classes/Communication/Events/RetrieveEvent.swift +++ b/CoatySwift/Classes/Communication/Events/RetrieveEvent.swift @@ -32,7 +32,7 @@ public class RetrieveEvent: CommunicationEvent) { + fileprivate override init(eventSource: Identity, eventData: RetrieveEventData) { super.init(eventSource: eventSource, eventData: eventData) } diff --git a/CoatySwift/Classes/Communication/Events/ReturnEvent.swift b/CoatySwift/Classes/Communication/Events/ReturnEvent.swift index faa8059..e7a5a81 100644 --- a/CoatySwift/Classes/Communication/Events/ReturnEvent.swift +++ b/CoatySwift/Classes/Communication/Events/ReturnEvent.swift @@ -50,7 +50,7 @@ public class ReturnEvent: CommunicationEvent) { + fileprivate override init(eventSource: Identity, eventData: ReturnEventData) { super.init(eventSource: eventSource, eventData: eventData) } diff --git a/CoatySwift/Classes/Communication/Events/UpdateEvent.swift b/CoatySwift/Classes/Communication/Events/UpdateEvent.swift index ac603a3..79f7b5e 100644 --- a/CoatySwift/Classes/Communication/Events/UpdateEvent.swift +++ b/CoatySwift/Classes/Communication/Events/UpdateEvent.swift @@ -53,7 +53,7 @@ public class UpdateEvent: CommunicationEvent) { + fileprivate override init(eventSource: Identity, eventData: UpdateEventData) { super.init(eventSource: eventSource, eventData: eventData) } diff --git a/CoatySwift/Classes/Communication/Manager/CM+Observe.swift b/CoatySwift/Classes/Communication/Manager/CM+Observe.swift index 3da6862..4aee6a4 100644 --- a/CoatySwift/Classes/Communication/Manager/CM+Observe.swift +++ b/CoatySwift/Classes/Communication/Manager/CM+Observe.swift @@ -32,7 +32,7 @@ extension CommunicationManager { /// - coreType: observed coreType. /// - objectType: observed objectType. private func observeAdvertise>(topic: String, - eventTarget: Component, + eventTarget: Identity, coreType: CoreType?, objectType: String?) throws -> Observable { @@ -92,7 +92,7 @@ extension CommunicationManager { /// - eventTarget: eventTarget target for which Advertise events should be emitted. /// - coreType: coreType core type of objects to be observed. /// - Returns: An observable emitting the advertise events, that have the given coreType. - public func observeAdvertiseWithCoreType>(eventTarget: Component, + public func observeAdvertiseWithCoreType>(eventTarget: Identity, coreType: CoreType) throws -> Observable { let topic = try CommunicationTopic.createTopicStringByLevelsForSubscribe(eventType: .Advertise, eventTypeFilter: coreType.rawValue) @@ -107,7 +107,7 @@ extension CommunicationManager { /// - eventTarget: eventTarget target for which Advertise events should be emitted. /// - objectType: objectType object type of objects to be observed. /// - Returns: An observable emitting the advertise events, that have the given objectType. - public func observeAdvertiseWithObjectType>(eventTarget: Component, + public func observeAdvertiseWithObjectType>(eventTarget: Identity, objectType: String) throws -> Observable { let topic = try CommunicationTopic.createTopicStringByLevelsForSubscribe(eventType: .Advertise, eventTypeFilter: objectType) @@ -129,7 +129,7 @@ extension CommunicationManager { /// - eventTarget: target for which Channel events should be emitted /// - channelId: a channel identifier /// - Returns: a hot observable emitting incoming Channel events. - public func observeChannel>(eventTarget: Component, + public func observeChannel>(eventTarget: Identity, channelId: String) throws -> Observable { if !CommunicationTopic.isValidEventTypeFilter(filter: channelId) { @@ -180,7 +180,7 @@ extension CommunicationManager { /// - Parameters: /// - eventTarget: target for which Deadvertise events should be emitted /// - Returns: a hot observable emitting incoming Deadvertise events - public func observeDeadvertise(eventTarget: Component) throws -> Observable> { + public func observeDeadvertise(eventTarget: Identity) throws -> Observable> { let deadvertiseTopic = try CommunicationTopic.createTopicStringByLevelsForSubscribe(eventType: .Deadvertise) var observable = client.messages.map(convertToTupleFormat) @@ -219,7 +219,7 @@ extension CommunicationManager { /// - Parameters: /// - eventTarget: target for which Update events should be emitted. /// - Returns: a hot observable emitting incoming Update events. - public func observeUpdate>(eventTarget: Component) throws -> Observable { + public func observeUpdate>(eventTarget: Identity) throws -> Observable { let updateTopic = try CommunicationTopic.createTopicStringByLevelsForSubscribe(eventType: .Update) @@ -265,7 +265,7 @@ extension CommunicationManager { /// - Parameters: /// - eventTarget: target for which Discover events should be emitted. /// - Returns: a hot observable emitting incoming Discover events. - public func observeDiscover>(eventTarget: Component) throws -> Observable { + public func observeDiscover>(eventTarget: Identity) throws -> Observable { let discoverTopic = try CommunicationTopic.createTopicStringByLevelsForSubscribe(eventType: .Discover) var observable = client.messages.map(convertToTupleFormat) @@ -323,7 +323,7 @@ extension CommunicationManager { /// - operationId: the name of the operation to be invoked /// - Returns: a hot observable emitting incoming Call events /// whose context filter matches the given context - public func observeCall>(eventTarget: Component, operationId: String) throws -> Observable { + public func observeCall>(eventTarget: Identity, operationId: String) throws -> Observable { if !CommunicationTopic.isValidEventTypeFilter(filter: operationId) { throw CoatySwiftError.InvalidArgument("\(operationId) is not a valid parameter name.") } diff --git a/CoatySwift/Classes/Communication/Manager/CM+Publish.swift b/CoatySwift/Classes/Communication/Manager/CM+Publish.swift index 849cc3b..5cd2dc5 100644 --- a/CoatySwift/Classes/Communication/Manager/CM+Publish.swift +++ b/CoatySwift/Classes/Communication/Manager/CM+Publish.swift @@ -53,7 +53,7 @@ extension CommunicationManager { messageToken: CoatyUUID().string) // Save advertises for Components or Devices. - if advertiseEvent.data.object.coreType == .Component || + if advertiseEvent.data.object.coreType == .Identity || advertiseEvent.data.object.coreType == .Device { // Add if not existing already in deadvertiseIds. @@ -280,7 +280,7 @@ extension CommunicationManager { /// - event: the complete event that should be sent out. /// - messageToken: the message token associated with the update-complete /// request. - internal func publishComplete(identity: Component, + internal func publishComplete(identity: Identity, event: CompleteEvent, messageToken: String) throws { @@ -300,7 +300,7 @@ extension CommunicationManager { /// - event: the resolve event that should be sent out. /// - messageToken: the message token associated with the discover-resolve /// request. - internal func publishResolve(identity: Component, + internal func publishResolve(identity: Identity, event: ResolveEvent, messageToken: String) throws { @@ -378,7 +378,7 @@ extension CommunicationManager { /// - event: the return event that should be sent out. /// - messageToken: the message token associated with the call-return /// request. - internal func publishReturn(identity: Component, + internal func publishReturn(identity: Identity, event: ReturnEvent, messageToken: String) throws { diff --git a/CoatySwift/Classes/Communication/Manager/CommunicationManager.swift b/CoatySwift/Classes/Communication/Manager/CommunicationManager.swift index 39470db..9abb88d 100644 --- a/CoatySwift/Classes/Communication/Manager/CommunicationManager.swift +++ b/CoatySwift/Classes/Communication/Manager/CommunicationManager.swift @@ -32,7 +32,7 @@ public class CommunicationManager { private var subscriptions = [String: Int]() /// Coaty identity object of the communication manager. Initialized through initializeIdentity(). - var identity: Component! + var identity: Identity! /// The operating state of the communication manager. var operatingState: BehaviorSubject = BehaviorSubject(value: .initial) @@ -81,7 +81,7 @@ public class CommunicationManager { // MARK: - Setup methods. func initializeIdentity() { - identity = Component(name: "CommunicationManager") + identity = Identity(name: "CommunicationManager") // Merge property values from CommunicationOptions.identity option. if self.communicationOptions.identity != nil { @@ -312,7 +312,7 @@ public class CommunicationManager { try? observeDiscover(eventTarget: identity) .filter({ (event) -> Bool in - (event.data.isDiscoveringTypes() && event.data.isCoreTypeCompatible(.Component)) || + (event.data.isDiscoveringTypes() && event.data.isCoreTypeCompatible(.Identity)) || (event.data.isDiscoveringObjectId() && event.data.objectId == self.identity.objectId) }) .subscribe(onNext: { event in diff --git a/CoatySwift/Classes/Communication/Manager/ControllerCommunicationManager.swift b/CoatySwift/Classes/Communication/Manager/ControllerCommunicationManager.swift index 4eec98e..070e4c4 100644 --- a/CoatySwift/Classes/Communication/Manager/ControllerCommunicationManager.swift +++ b/CoatySwift/Classes/Communication/Manager/ControllerCommunicationManager.swift @@ -10,13 +10,13 @@ import RxSwift public class ControllerCommunicationManager { - private var controllerIdentity: Component + private var controllerIdentity: Identity private var cm: CommunicationManager - public var identity: Component { + public var identity: Identity { return self.cm.identity } - init(identity: Component, communicationManager: CommunicationManager) { + init(identity: Identity, communicationManager: CommunicationManager) { self.controllerIdentity = identity self.cm = communicationManager } diff --git a/CoatySwift/Classes/Communication/Misc/CommunicationTopic.swift b/CoatySwift/Classes/Communication/Misc/CommunicationTopic.swift index 4fc6adb..e329b5a 100644 --- a/CoatySwift/Classes/Communication/Misc/CommunicationTopic.swift +++ b/CoatySwift/Classes/Communication/Misc/CommunicationTopic.swift @@ -146,7 +146,7 @@ class CommunicationTopic { /// See [Communication Protocol - Topic Structure](https://coatyio.github.io/coaty-js/man/communication-protocol/#topic-structure) /// - Parameters: /// - eventType: CommunicationEventType (e.g. Advertise) - /// - eventTypeFilter: may either be a core type (e.g. Component) or an object type + /// - eventTypeFilter: may either be a core type (e.g. Identity) or an object type /// (e.g. org.example.object) /// - associatedUserId: an optional UUID String, if the parameter is omitted it is replaced /// with a wildcard. @@ -190,7 +190,7 @@ class CommunicationTopic { /// See [Communication Protocol](https://coatyio.github.io/coaty-js/man/communication-protocol/#topic-structure) /// - Parameters: /// - eventType: CommunicationEventType (e.g. Advertise) - /// - eventTypeFilter: may either be a core type (e.g. Component) or an object type + /// - eventTypeFilter: may either be a core type (e.g. Identity) or an object type /// (e.g. org.example.object) /// - associatedUserId: an optional UUID String, if the parameter is omitted it is replaced /// with "-". @@ -214,7 +214,7 @@ class CommunicationTopic { /// See [Communication Protocol](https://coatyio.github.io/coaty-js/man/communication-protocol/#topic-filters) /// - Parameters: /// - eventType: CommunicationEventType (e.g. Advertise) - /// - eventTypeFilter: may either be a core type (e.g. Component) or an object type + /// - eventTypeFilter: may either be a core type (e.g. Identity) or an object type /// (e.g. org.example.object) /// - associatedUserId: an optional UUID String, if the parameter is omitted it is replaced /// with a wildcard. diff --git a/CoatySwift/Classes/Model/Core Types/Component.swift b/CoatySwift/Classes/Model/Core Types/Component.swift index 61cad78..7d8e7f9 100644 --- a/CoatySwift/Classes/Model/Core Types/Component.swift +++ b/CoatySwift/Classes/Model/Core Types/Component.swift @@ -1,18 +1,18 @@ // Copyright (c) 2019 Siemens AG. Licensed under the MIT License. // -// Component.swift +// Identity.swift // CoatySwift // import Foundation /// Represents a Coaty container component, i.e. a controller or the communication manager. -open class Component: CoatyObject { +open class Identity: CoatyObject { public init(name: String = "ComponentObject", - objectType: String = "\(COATY_OBJECT_TYPE_NAMESPACE_PREFIX)\(CoreType.Component)", + objectType: String = "\(COATY_OBJECT_TYPE_NAMESPACE_PREFIX)\(CoreType.Identity)", objectId: CoatyUUID = .init()) { - super.init(coreType: .Component, objectType: objectType, objectId: objectId, name: name) + super.init(coreType: .Identity, objectType: objectType, objectId: objectId, name: name) } public required init(from decoder: Decoder) throws { diff --git a/CoatySwift/Classes/Model/Core Types/CoreType.swift b/CoatySwift/Classes/Model/Core Types/CoreType.swift index 4f77059..c830d3b 100644 --- a/CoatySwift/Classes/Model/Core Types/CoreType.swift +++ b/CoatySwift/Classes/Model/Core Types/CoreType.swift @@ -19,7 +19,7 @@ public enum CoreType: String, Codable { case Task case IoSource case IoActor - case Component + case Identity case Config case Log case Location diff --git a/CoatySwift/Classes/Runtime/Controller.swift b/CoatySwift/Classes/Runtime/Controller.swift index 84a7d7f..428b007 100644 --- a/CoatySwift/Classes/Runtime/Controller.swift +++ b/CoatySwift/Classes/Runtime/Controller.swift @@ -22,7 +22,7 @@ open class Controller { private (set) public var runtime: Runtime private (set) public var options: ControllerOptions? private (set) public var controllerType: String - private (set) public var identity: Component! + private (set) public var identity: Identity! /// This disposebag holds references to all of your subscriptions. It is standard in RxSwift /// to call `.disposed(by: self.disposeBag)` at the end of every subscription. @@ -37,7 +37,7 @@ open class Controller { self.controllerType = controllerType // Create default identity. - self.identity = Component(name: self.controllerType) + self.identity = Identity(name: self.controllerType) self.initializeIdentity(identity: identity) self.initializeIdentityFromOptions() @@ -76,7 +76,7 @@ open class Controller { /// implementation advertises its identity if requested by the controller /// option property `shouldAdvertiseIdentity` (if this property is not /// specified, the identity is advertised by default). The base - /// implementation also observes Discover events for core type "Component" or + /// implementation also observes Discover events for core type "Identity" or /// the identity's object ID and resolves them with the controller's /// identity. open func onCommunicationManagerStarting() { @@ -112,7 +112,7 @@ open class Controller { /// in the configuration options take precedence. /// /// @param identity the default identity object for a controller instance - open func initializeIdentity(identity: Component) {} + open func initializeIdentity(identity: Identity) {} private func initializeIdentityFromOptions() { // Merge property values from ControllerOptions.identity option. @@ -162,7 +162,7 @@ open class Controller { try? self.communicationManager .observeDiscover() .filter { event -> Bool in - (event.data.isDiscoveringTypes() && event.data.isCoreTypeCompatible(.Component)) || + (event.data.isDiscoveringTypes() && event.data.isCoreTypeCompatible(.Identity)) || (event.data.isDiscoveringObjectId() && event.data.objectId == self.identity.objectId) }.subscribe(onNext: { event in let resolveEvent = self.eventFactory.ResolveEvent.with(object: self.identity) diff --git a/CoatySwift/Classes/Runtime/Dynamic/DynamicController.swift b/CoatySwift/Classes/Runtime/Dynamic/DynamicController.swift index 2aee202..7b22916 100644 --- a/CoatySwift/Classes/Runtime/Dynamic/DynamicController.swift +++ b/CoatySwift/Classes/Runtime/Dynamic/DynamicController.swift @@ -22,7 +22,7 @@ open class DynamicController { private (set) public var runtime: Runtime private (set) public var options: ControllerOptions? private (set) public var controllerType: String - private (set) public var identity: Component + private (set) public var identity: Identity /// This disposebag holds references to all of your subscriptions. It is standard in RxSwift /// to call `.disposed(by: self.disposeBag)` at the end of every subscription. @@ -37,7 +37,7 @@ open class DynamicController { self.controllerType = controllerType // Create default identity. - self.identity = Component(name: self.controllerType) + self.identity = Identity(name: self.controllerType) self.initializeIdentity(identity: identity) self.initializeIdentityFromOptions() @@ -77,7 +77,7 @@ open class DynamicController { /// implementation advertises its identity if requested by the controller /// option property `shouldAdvertiseIdentity` (if this property is not /// specified, the identity is advertised by default). The base - /// implementation also observes Discover events for core type "Component" or + /// implementation also observes Discover events for core type "Identity" or /// the identity's object ID and resolves them with the controller's /// identity. open func onCommunicationManagerStarting() { @@ -113,7 +113,7 @@ open class DynamicController { /// in the configuration options take precedence. /// /// @param identity the default identity object for a controller instance - open func initializeIdentity(identity: Component) {} + open func initializeIdentity(identity: Identity) {} private func initializeIdentityFromOptions() { // Merge property values from ControllerOptions.identity option. @@ -163,7 +163,7 @@ open class DynamicController { try? self.communicationManager .observeDiscover() .filter { event -> Bool in - (event.data.isDiscoveringTypes() && event.data.isCoreTypeCompatible(.Component)) || + (event.data.isDiscoveringTypes() && event.data.isCoreTypeCompatible(.Identity)) || (event.data.isDiscoveringObjectId() && event.data.objectId == self.identity.objectId) }.subscribe(onNext: { event in let resolveEvent = self.eventFactory.ResolveEvent.with(object: self.identity) diff --git a/Example/CoatySwift.xcodeproj/xcshareddata/xcschemes/CoatySwift.xcscheme b/Example/CoatySwift.xcodeproj/xcshareddata/xcschemes/CoatySwift.xcscheme index 5b85b0d..85a7165 100644 --- a/Example/CoatySwift.xcodeproj/xcshareddata/xcschemes/CoatySwift.xcscheme +++ b/Example/CoatySwift.xcodeproj/xcshareddata/xcschemes/CoatySwift.xcscheme @@ -42,7 +42,7 @@ buildForAnalyzing = "YES">