Skip to content

OTPModuleReferenceFrame

dsmurfin edited this page Aug 28, 2021 · 3 revisions

OTPModuleReferenceFrame

OTP Module Reference Frame

public struct OTPModuleReferenceFrame: OTPModule, Hashable 

Implements an OTP Standard Module of the Reference Frame type and handles creation and parsing.

This data structure contains the Address of the Reference Frame of the Point. If a Reference Frame Module is included in a Point Layer, any other Modules included in this Point shall contain transform information relative to that of the Reference Frame.

Example usage:

   do {
       
       let address = try OTPAddress(1,2,10)
 
       let module = OTPModuleReferenceFrame(address: address, relative: false)
 
       // do something with module
 
   } catch {
       // handle error
   }
 

Inheritance

Hashable, OTPModule

Initializers

init()

Initializes this OTPModule with default values.

public init() 

init(address:)

Initializes an OTP Module Reference Frame.

public init(address: OTPAddress) 

Parameters

  • address: The Address of the Reference Frame Point.

Properties

identifier

Uniquely identifies the module using an OTPModuleIdentifier.

public static let identifier: OTPModuleIdentifier 

dataLength

The size of the module's data in bytes.

public static let dataLength: OTPPDULength = 7

moduleLength

The total size of the module in bytes, including identifiers and length.

public static let moduleLength: OTPPDULength = dataLength + OTPPDULength(ModuleLayer.Offset.data.rawValue)

systemNumber

The OTPSystemNumber of the reference frame of the OTPPoint containing this module.

public var systemNumber: OTPSystemNumber = 1

groupNumber

The OTPGroupNumber of the reference frame of the OTPPoint containing this module.

public var groupNumber: OTPGroupNumber = 1

pointNumber

The OTPPointNumber of the reference frame of the OTPPoint containing this module.

public var pointNumber: OTPPointNumber = 1

logDescription

A human-readable log description of this module.

public var logDescription: String 

Methods

createAsData()

Creates a Module as Data.

public func createAsData() -> Data 

Returns

The OTPModule as a Data object.

parse(fromData:)

Attempts to create an OTPModuleReferenceFrame from the data.

public static func parse(fromData data: Data) throws -> (module: Self, length: OTPPDULength) 

Parameters

  • data: The data to be parsed.

Throws

An error of type ModuleLayerValidationError.

Returns

A valid OTPModuleReferenceFrame and the length of the PDU.

merge(modules:)

Merges an arrray of modules.

public static func merge(modules: [OTPModule]) -> (module: Self?, excludePoint: Bool) 

Parameters

  • modules: The OTPModules to be merged.

Returns

An optional OTPModule of this type, and whether to exclude the OTPPoint due to a mismatch.

isEqualToModule(_:)

Calculates whether this module is considered equal to another one.

public func isEqualToModule(_ module: OTPModule) -> Bool 

Parameters

  • module: The OTPModule to be compared against.

Returns

Whether these OTPModules are considered equal.

Clone this wiki locally