Exemplo n.º 1
0
 public void Remove(MnemonicSample value)
 {
     GmsecPINVOKE.MnemonicSampleList_Remove(swigCPtr, MnemonicSample.getCPtr(value));
     if (GmsecPINVOKE.SWIGPendingException.Pending)
     {
         throw GmsecPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 2
0
 public void Insert(int index, MnemonicSample value)
 {
     GmsecPINVOKE.MnemonicSampleList_Insert(swigCPtr, index, MnemonicSample.getCPtr(value));
     if (GmsecPINVOKE.SWIGPendingException.Pending)
     {
         throw GmsecPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 3
0
        public int LastIndexOf(MnemonicSample value)
        {
            int ret = GmsecPINVOKE.MnemonicSampleList_LastIndexOf(swigCPtr, MnemonicSample.getCPtr(value));

            if (GmsecPINVOKE.SWIGPendingException.Pending)
            {
                throw GmsecPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 4
0
        public bool Contains(MnemonicSample value)
        {
            bool ret = GmsecPINVOKE.MnemonicSampleList_Contains(swigCPtr, MnemonicSample.getCPtr(value));

            if (GmsecPINVOKE.SWIGPendingException.Pending)
            {
                throw GmsecPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 5
0
        public static MnemonicSampleList Repeat(MnemonicSample value, int count)
        {
            global::System.IntPtr cPtr = GmsecPINVOKE.MnemonicSampleList_Repeat(MnemonicSample.getCPtr(value), count);
            MnemonicSampleList    ret  = (cPtr == global::System.IntPtr.Zero) ? null : new MnemonicSampleList(cPtr, true);

            if (GmsecPINVOKE.SWIGPendingException.Pending)
            {
                throw GmsecPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 6
0
        private MnemonicSample getitem(int index)
        {
            global::System.IntPtr cPtr = GmsecPINVOKE.MnemonicSampleList_getitem(swigCPtr, index);
            MnemonicSample        ret  = (cPtr == global::System.IntPtr.Zero) ? null : new MnemonicSample(cPtr, false);

            if (GmsecPINVOKE.SWIGPendingException.Pending)
            {
                throw GmsecPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
Exemplo n.º 7
0
    static int Main(string[] args)
    {
        if (args.Length < 1)
        {
            Console.WriteLine("usage mnemonic_message.exe mw-id=<middleware ID>");
            return(-1);
        }

        Config config = new Config(args);

        InitializeLogging(config);

        //o Set the GMSEC message specification version to be used to determine
        // what the structure of messages is for verification and the
        // construction of MistMessages
        config.AddValue("GMSEC-SPECIFICATION-VERSION", GMSEC_SPEC_VERSION);

        //o Enable Message validation.  This parameter is "false" by default.
        config.AddValue("GMSEC-MSG-CONTENT-VALIDATE", "true");

        Log.Info("API version: " + ConnectionManager.GetAPIVersion());

        try
        {
            ConnectionManager connManager = new ConnectionManager(config);

            Log.Info("Opening the connection to the middleware server");
            connManager.Initialize();

            Log.Info("Middleware version: " + connManager.GetLibraryVersion());

            //o Create all of the GMSEC Message header Fields which will
            // be used by all GMSEC Messages
            //
            // Note: Since these Fields contain variable values which are
            // based on the context in which they are used, they cannot be
            // automatically populated using MistMessage.
            FieldList definedFields = new FieldList();

            StringField missionField = new StringField("MISSION-ID", "MISSION");
            // Note: SAT-ID-PHYSICAL is an optional header Field, according
            // to the GMSEC ISD.
            StringField satIdField     = new StringField("SAT-ID-PHYSICAL", "SPACECRAFT");
            StringField facilityField  = new StringField("FACILITY", "GMSEC Lab");
            StringField componentField = new StringField("COMPONENT", "device_message");

            definedFields.Add(missionField);
            definedFields.Add(satIdField);
            definedFields.Add(facilityField);
            definedFields.Add(componentField);

            //o Use setStandardFields to define a set of header fields for
            // all messages which are created or published on the
            // ConnectionManager using the following functions:
            // createLogMessage, publishLog, createHeartbeatMessage,
            // startHeartbeatService, createResourceMessage,
            // publishResourceMessage, or startResourceMessageService
            connManager.SetStandardFields(definedFields);

            //o Populate the Mnemonic Sample(s)
            MnemonicSample mSample = new MnemonicSample("MS1", new I32Field("MS1", 15));
            mSample.SetEUValue(new F32Field("My EU", (float)15.0));
            mSample.SetFlags(1);
            mSample.SetLimit(MnemonicSample.LimitFlag.RED_HIGH);
            // Implicitly set limit enable/disable with setting of limit
            mSample.SetQuality(true);
            mSample.SetStalenessStatus(false);
            mSample.SetTextValue("15");

            MnemonicSampleList mnemonic_samples = new MnemonicSampleList();
            mnemonic_samples.Add(mSample);

            //o Add the Mnemonic values to a Mnemonic object
            Mnemonic mnemonic    = new Mnemonic("M1", mnemonic_samples);
            I16Field statusField = new I16Field("status", 5);
            mnemonic.SetStatus(statusField);
            mnemonic.SetUnits("units");

            //o Determine which version of the GMSEC message specification
            // the ConnectionManager was initialized with
            uint version = connManager.GetSpecification().GetVersion();

            //o Construct an MVAL Message and add the Mnemonic values to it
            using (MnemonicMessage mvalMessage = new MnemonicMessage(MVAL_MESSAGE_SUBJECT, "MSG.MVAL", connManager.GetSpecification()))
            {
                mvalMessage.AddMnemonic(mnemonic);

                //o If validating with the 2014 spec, the MSG-ID field is
                // required
                if (version == 201400)
                {
                    mvalMessage.SetValue("MSG-ID", "MVAL Request MSG-ID would go here");
                }

                //o Add the header fields to the MVAL message
                connManager.AddStandardFields(mvalMessage);

                Log.Info("Publishing MVAL message:\n" + mvalMessage.ToXML());
                connManager.Publish(mvalMessage);
            }

            connManager.Cleanup();
        }
        catch (GmsecException e)
        {
            Log.Error(e.ToString());
            return(-1);
        }

        return(0);
    }
Exemplo n.º 8
0
 /// <summary>Adds the given MnemonicSample to the mnemonic</summary>
 ///
 /// <param name="sample">The MnemonicSample object</param>
 public void AddSample(MnemonicSample sample)
 {
 }
Exemplo n.º 9
0
 /// <summary>Copy-constructor that can be used to create a copy of a %MnemonicSample instance.</summary>
 ///
 /// <param name="other">The other %MnemonicSample to copy</param>
 public MnemonicSample(MnemonicSample other)
 {
 }