private void initPublisher(String pub, int strength)
	    {
		    mgr = new DDSEntityManager("Ownership");
		    String partitionName = "Ownership example";

		    // create Domain Participant
		    mgr.createParticipant(partitionName);
    		
		    // create Type
		    StockTypeSupport stkTS = new StockTypeSupport();
		    mgr.registerType(stkTS);
    		
		    // create Topic
		    mgr.createTopic("OwnershipStockTracker");
    		
		    // create Publisher
		    mgr.createPublisher();
    		
		    // create DataWriter
		    mgr.createWriterWithStrength(strength);
		    dwriter= mgr.getWriter();
            OwnershipDataWriter = dwriter as StockDataWriter;
    		
		    msft = new Stock();
		    msft.ticker = "MSFT";
            msft.publisher = pub;
            msft.strength = strength;
            msftHandle = OwnershipDataWriter.RegisterInstance(msft);
	    }
 public ReturnCode GetDiscoveredTopicData(
     ref DDS.TopicBuiltinTopicData topic_data, DDS.InstanceHandle topic_handle)
 {
     throw new System.NotImplementedException();
     //return realParticipant.get_discovered_topic_data(
     //        topic_data, topic_handle);
 }
Beispiel #3
0
 public ReturnCode IgnoreTopic(InstanceHandle handle)
 {
     return Gapi.DomainParticipant.ignore_topic(
             GapiPeer,
             handle);
 }
Beispiel #4
0
 public ReturnCode IgnoreSubscription(InstanceHandle handle)
 {
     return Gapi.DomainParticipant.ignore_subscription(
             GapiPeer,
             handle);
 }
Beispiel #5
0
 public ReturnCode IgnorePublication(InstanceHandle handle)
 {
     return Gapi.DomainParticipant.ignore_publication(
             GapiPeer,
             handle);
 }
Beispiel #6
0
        public ReturnCode GetDiscoveredTopics(ref InstanceHandle[] topicHandles)
        {
            ReturnCode result;
            InstanceHandleUserData a = new InstanceHandleUserData(0, topicHandles);
            GCHandle iHUserDataHandle = GCHandle.Alloc(a, GCHandleType.Normal);

            result = (ReturnCode)  Gapi.DomainParticipant.get_discovered_topics(
                    GapiPeer,
                    CopyInstanceHandleAttr,
                    GCHandle.ToIntPtr(iHUserDataHandle));

            topicHandles = a.Seq;
            iHUserDataHandle.Free();

            return result;
        }
Beispiel #7
0
        public ReturnCode GetMatchedPublicationData(
                ref PublicationBuiltinTopicData publicationData, 
                InstanceHandle publicationHandle)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.PublicationBuiltinTopicDataMarshaler marshaler =
                    new OpenSplice.CustomMarshalers.PublicationBuiltinTopicDataMarshaler())
            {
                result = Gapi.DataReader.get_matched_publication_data(
                        GapiPeer,
                        marshaler.GapiPtr,
                        publicationHandle);

                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref publicationData);
                }
            }

            return result;
        }
 public ReturnCode IgnoreSubscription(InstanceHandle handle)
 {
     return realParticipant.IgnoreSubscription(handle);
 }
 public ReturnCode GetDiscoveredParticipants(ref InstanceHandle[] handles)
 {
     throw new System.NotImplementedException();
     // return realParticipant.get_discovered_participants(handles);
 }
Beispiel #10
0
        static void Main(string[] args)
        {
            if(args.Length != 3)
            {
                Console.WriteLine("Insufficient number of arguments.");
                usage();
                Environment.Exit(-1);
            }
            else
            {
                String durabilityKind = args[0];
                Boolean autodisposeFlag = Boolean.Parse(args[1].ToString());
                Boolean automaticFlag = Boolean.Parse(args[2].ToString());

                DDSEntityManager mgr = new DDSEntityManager();
                String partitionName = "Durability example";

                // Set the Durability Kind
                mgr.setDurabilityKind(durabilityKind);

                // Set the auto dispose flag
                mgr.setAutoDispose(autodisposeFlag);

                Thread.Sleep(1000);

                // create Domain Participant
                mgr.createParticipant(partitionName);

                // create Type
                MsgTypeSupport stkTS = new MsgTypeSupport();
                mgr.registerType(stkTS);

                // create Topic
                mgr.createTopic("DurabilityData_Msg", "Durability");

                // create Publisher
                mgr.createPublisher();

                // create DataWriter
                mgr.createWriter();

                // Publish Events
                IDataWriter dwriter = mgr.getWriter();
                MsgDataWriter msgWriter = dwriter as MsgDataWriter;

                Msg [] DurabilityDataMsg = new Msg[10];
                InstanceHandle [] handle = new InstanceHandle [10];

                ReturnCode status = ReturnCode.Error;

                for (int x = 0; x < 10; x++)
                {
                    DurabilityDataMsg[x] = new Msg();
                    DurabilityDataMsg[x].id = x;
                    DurabilityDataMsg[x].content = x.ToString();

                    Console.WriteLine("Storing {0}", DurabilityDataMsg[x].content);

                    handle[x] = msgWriter.RegisterInstance(DurabilityDataMsg[x]);
                    ErrorHandler.checkHandle(handle[x], "DataWriter.RegisterInstance");
                    status = msgWriter.Write(DurabilityDataMsg[x], handle[x]);
                    ErrorHandler.checkStatus(status, "DataWriter.Write");
                }

                if (!automaticFlag)
                {
                    char c = (char)0;
                    Console.WriteLine("Enter E to exit");
                    while (c != 'E')
                    {
                        c = (char)Console.Read();
                    }
                }
                else
                {
                    Console.WriteLine("=== sleeping 10s...");
                    Thread.Sleep(10000);
                }

                // Clean up
                status = mgr.getPublisher().DeleteDataWriter(msgWriter);
                ErrorHandler.checkStatus(status, "Publisher.DeleteDatWriter");
                mgr.deletePublisher();
                mgr.deleteTopic();
                mgr.deleteParticipant();
            }
        }
Beispiel #11
0
        public ReturnCode GetMatchedSubscriptionData(
                ref SubscriptionBuiltinTopicData subscriptionData, 
                InstanceHandle subscriptionHandle)
        {
            ReturnCode result;

            using (OpenSplice.CustomMarshalers.SubscriptionBuiltinTopicDataMarshaler marshaler = 
                    new OpenSplice.CustomMarshalers.SubscriptionBuiltinTopicDataMarshaler())
            {
                result = Gapi.DataWriter.get_matched_subscription_data(
                        GapiPeer,
                        marshaler.GapiPtr,
                        subscriptionHandle);

                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref subscriptionData);
                }
            }

            return result;
        }
Beispiel #12
0
        public ReturnCode GetMatchedSubscriptions(ref InstanceHandle[] subscriptionHandles)
        {
            ReturnCode result;

            using (SequenceInstanceHandleMarshaler marshaler = 
                    new SequenceInstanceHandleMarshaler())
            {
                result = Gapi.DataWriter.get_matched_subscriptions(
                        GapiPeer,
                        marshaler.GapiPtr);

                if (result == ReturnCode.Ok)
                {
                    marshaler.CopyOut(ref subscriptionHandles);
                }
            }

            return result;
        }
		internal ReturnCode Put(ByteData data, InstanceHandle handle)
		{
			return FooDataWriter.Write(this, data, handle);
		}
		public ReturnCode UnregisterInstance(ByteData data, InstanceHandle handle)
		{
			return FooDataWriter.UnregisterInstance(this, data, handle);
		}
Beispiel #15
0
 internal InstanceHandleUserData(int Index, InstanceHandle[] Seq)
 {
     this.Index = Index;
     this.Seq = Seq;
 }
 public bool ContainsEntity(InstanceHandle a_handle)
 {
     return realParticipant.ContainsEntity(a_handle);
 }
Beispiel #17
0
 public bool ContainsEntity(InstanceHandle handle)
 {
     byte result = Gapi.DomainParticipant.contains_entity(
             GapiPeer,
             handle);
     return result != 0;
 }
 public int GetDiscoveredTopics(out InstanceHandle[] handles)
 {
     throw new System.NotImplementedException();
     // return realParticipant.get_discovered_topics(handles);
 }
Beispiel #19
0
        public ReturnCode GetDiscoveredTopicData(ref TopicBuiltinTopicData data, InstanceHandle handle)
        {
            ReturnCode result;
            GCHandle dataHandle = GCHandle.Alloc(data, GCHandleType.Normal);

            result = (ReturnCode)  Gapi.DomainParticipant.get_discovered_topic_data(
                    GapiPeer,
                    GCHandle.ToIntPtr(dataHandle),
                    handle,
                    TopicDataMarshaler.CopyOutDelegate);

            data = dataHandle.Target as TopicBuiltinTopicData;
            dataHandle.Free();

            return result;
        }
 public ReturnCode IgnoreTopic(InstanceHandle handle)
 {
     return realParticipant.IgnoreTopic(handle);
 }
 public DDS.ReturnCode GetDiscoveredParticipantData(
         ref ParticipantBuiltinTopicData participant_data, InstanceHandle particpant_handle)
 {
     throw new System.NotImplementedException();
     //return realParticipant.get_discovered_participant_data(
       //      participant_data, participant_handle);
 }