Namespace globals emesary
--------------------------------------------------------------------------- Title : EMESARY inter-object communication File Type : Implementation File Description : Provides generic inter-object communication. For an object to receive a message it : must first register with an instance of a Transmitter, and provide a Receive method : To send a message use a Transmitter with an object. That's all there is to it. References : http://chateau-logic.com/content/emesary-nasal-implementation-flightgear : http://www.chateau-logic.com/content/class-based-inter-object-communication : http://chateau-logic.com/content/emesary-efficient-inter-object-communication-using-interfaces-and-inheritance : http://chateau-logic.com/content/c-wpf-application-plumbing-using-emesary Author : Richard Harrison (richard@zaretto.com) Creation Date : 29 January 2016 Version : 4.8 Copyright © 2016 Richard Harrison Released under GPL V2 --------------------------------------------------------------------------- Classes in this file: Transmitter Notification Recipient ---------------------------------------------------------------------------*/
Classes
BinaryAsciiTransfer
Base method of transferring all numeric based values. Using the same techinque as base64 - except this is base248 because we can use a much wider range of characters.
Recipient
--------------------------------------------------------------------------- Recipient - base class for receiving notifications. You have to implement the Receive method The Receive method must return a sensible ReceiptStatus_* code
TransferInt
encode an int into a specified number of characters.
Transmitter
Transmitters send notifications to all recipients that are registered.
Functions
genericEmesaryGlobalTransmitterTransmit
genericEmesaryGlobalTransmitterTransmit allowes to use the emesary.GlobalTransmitter via fgcommand which in turn allows using it in XML bindings, e.g. <binding> <command>emesary-transmit</command> <type>cockpit-switch</type> <ident>eicas-page-select</ident> <page>hydraulic</page> </binding>
Variables
GlobalTransmitter
Instantiate a Global Transmitter, this is a convenience and a known starting point. Generally most classes will use this transmitters, however other transmitters can be created and merely use the global transmitter to discover each other.
TypeIdUnspecified
--------------------------------------------------------------------------- Notification - base class By convention a Notification has a type and a value. Derived classes can add extra properties or methods. NotificationType: Notification Type Ident: Can be an ident, or for simple messages a value that needs transmitting. IsDistinct: non zero if this message supercedes previous messages of this type. Distinct messages are usually sent often and self contained (i.e. no relative state changes such as toggle value) Messages that indicate an event (such as after a pilot action) will usually be non-distinct. So an example would be gear/up down or ATC acknowledgements that all need to be transmitted The IsDistinct is important for any messages that are bridged over MP as only the most recently sent distinct message will be transmitted over MP. Example: position update, where only current position is relevant -> IsDistinct=1; 0 = queue all messages for MP bridging 1 = queue only latest message (replace any old message of same type+ident)