Skip to content

Commit

Permalink
handle proxy owner method
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Aug 2, 2023
1 parent b251591 commit ef72f76
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ open class OcaMatrix<Member: OcaRoot>: OcaWorker {
proxy = try await Proxy<Member>(self)
}

public class Proxy<ProxyMember: OcaRoot>: OcaRoot {
public class Proxy<ProxyMember: OcaRoot>: OcaRoot, OcaOwnable {
weak var matrix: OcaMatrix<ProxyMember>?

override public class var classIdentification: OcaClassIdentification {
Expand All @@ -79,6 +79,10 @@ open class OcaMatrix<Member: OcaRoot>: OcaWorker {
)
}

public var owner: OcaONo {
matrix?.objectNumber ?? OcaInvalidONo
}

override open func handleCommand(
_ command: Ocp1Command,
from controller: any AES70Controller
Expand All @@ -90,6 +94,14 @@ open class OcaMatrix<Member: OcaRoot>: OcaWorker {
/// root object class methods are handled directly, because they refer to the proxy
/// object
return try await super.handleCommand(command, from: controller)
} else if ProxyMember.self is OcaWorker.Type,
command.methodID == OcaMethodID("2.4")
{
return try encodeResponse(owner)
} else if ProxyMember.self is OcaAgent.Type,
command.methodID == OcaMethodID("2.2")
{
return try encodeResponse(owner)
}

guard let matrix else {
Expand Down

0 comments on commit ef72f76

Please sign in to comment.