4 <name>Tizen.Applications.MessagePort</name>
7 <member name="T:Tizen.Applications.Messages.MessagePort">
9 The message port API provides functions to send and receive messages between applications.
12 The message port API provides functions for passing messages between applications. An application should register its own local port to receive messages from remote applications.
13 If a remote application sends a message, the registered callback function of the local port is called.
14 The trusted message-port API allows communications between applications that are signed by the same developer(author) certificate.
17 <member name="M:Tizen.Applications.Messages.MessagePort.#ctor(System.String,System.Boolean)">
19 Initializes the instance of the MessagePort class.
21 <param name="portName">The name of the local message port.</param>
22 <param name="trusted">If true, it is the trusted message port of application, otherwise false.</param>
23 <exception cref="T:System.InvalidOperationException">Thrown when portName is null or empty.</exception>
25 MessagePort messagePort = new MessagePort("SenderPort", true);
28 <member name="M:Tizen.Applications.Messages.MessagePort.Finalize">
30 Destructor of the MessagePort class.
33 <member name="E:Tizen.Applications.Messages.MessagePort.MessageReceived">
35 Called when a message is received.
38 MessagePort messagePort = new MessagePort("SenderPort", true);
39 messagePort.MessageReceived += MessageReceivedCallback;
40 static void MessageReceivedCallback(object sender, MessageReceivedEventArgs e)
42 Console.WriteLine("Message Received ");
43 if (e.Remote.AppId != null) {
44 Console.WriteLine("from :"+e.Remote.AppId);
49 <member name="P:Tizen.Applications.Messages.MessagePort.PortName">
51 The name of the local message port.
54 <member name="P:Tizen.Applications.Messages.MessagePort.Trusted">
56 If true, the message port is a trusted port, otherwise false.
59 <member name="P:Tizen.Applications.Messages.MessagePort.Listening">
61 If true, the message port is listening, otherwise false.
64 <member name="M:Tizen.Applications.Messages.MessagePort.Listen">
66 Register the local message port.
68 <exception cref="T:System.InvalidOperationException">Thrown when portName is already used, when there is an invalid parameter, when out of memory, when there is an I/O error.</exception>
70 MessagePort messagePort = new MessagePort("SenderPort", true);
71 messagePort.MessageReceived += MessageReceivedCallback;
75 <member name="M:Tizen.Applications.Messages.MessagePort.StopListening">
77 Unregisters the local message port.
79 <exception cref="T:System.InvalidOperationException">Thrown when messageport is already stopped, when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error.</exception>
81 MessagePort messagePort = new MessagePort("SenderPort", true);
82 messagePort.MessageReceived += MessageReceivedCallback;
84 using (var message = new Tizen.Application.Bundle())
86 message.AddItem("message", "a_string");
87 messagePort.Send(message, "ReceiverAppID", "ReceiverPort");
89 messageProt.StopListening();
92 <member name="M:Tizen.Applications.Messages.MessagePort.Send(Tizen.Applications.Bundle,System.String,System.String)">
94 Sends an untrusted message to the message port of a remote application.
96 <param name="message">The message to be passed to the remote application, the recommended message size is under 4KB.</param>
97 <param name="remoteAppId">The ID of the remote application.</param>
98 <param name="remotePortName">The name of the remote message port.</param>
99 <exception cref="T:System.InvalidOperationException">Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error.</exception>
100 <exception cref="T:System.ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(4KB).</exception>
102 MessagePort messagePort = new MessagePort("SenderPort", true);
103 messagePort.MessageReceived += MessageReceivedCallback;
104 messagePort.Listen();
105 using (var message = new Tizen.Application.Bundle())
107 message.AddItem("message", "a_string");
108 messagePort.Send(message, "ReceiverAppID", "ReceiverPort");
112 <member name="M:Tizen.Applications.Messages.MessagePort.Send(Tizen.Applications.Bundle,System.String,System.String,System.Boolean)">
114 Sends a message to the message port of a remote application.
116 <param name="message">The message to be passed to the remote application, the recommended message size is under 4KB.</param>
117 <param name="remoteAppId">The ID of the remote application.</param>
118 <param name="remotePortName">The name of the remote message port.</param>
119 <param name="trusted">If true, it is the trusted message port of remote application, otherwise false.</param>
120 <exception cref="T:System.InvalidOperationException">Thrown when there is an invalid parameter, when the port is not found, when out of memory, when there is an I/O error.</exception>
121 <exception cref="T:System.ArgumentOutOfRangeException">Thrown when message has exceeded the maximum limit(4KB).</exception>
123 MessagePort messagePort = new MessagePort("SenderPort", true);
124 messagePort.MessageReceived += MessageReceivedCallback;
125 messagePort.Listen();
126 using (var message = new Tizen.Application.Bundle())
128 message.AddItem("message", "a_string");
129 messagePort.Send(message, "ReceiverAppID", "ReceiverPort", true);
133 <member name="M:Tizen.Applications.Messages.MessagePort.Dispose(System.Boolean)">
135 Releases the unmanaged resource used by the MessagePort class specifying whether to perform a normal dispose operation.
137 <param name="disposing">true for a normal dispose operation; false to finalize the handle.</param>
139 <member name="M:Tizen.Applications.Messages.MessagePort.Dispose">
141 Releases all resources used by the MessagePort class.
144 <member name="T:Tizen.Applications.Messages.MessageReceivedEventArgs">
146 An extended EventArgs class, which contains remote message port information and message.
149 <member name="P:Tizen.Applications.Messages.MessageReceivedEventArgs.Remote">
151 Contains AppId, port name, and trusted.
154 <member name="P:Tizen.Applications.Messages.MessageReceivedEventArgs.Message">
156 The message passed from the remote application.
159 <member name="T:Tizen.Applications.Messages.RemoteValues">
161 Contains AppId, port name, and trusted.
164 <member name="P:Tizen.Applications.Messages.RemoteValues.AppId">
166 The ID of the remote application that sent this message.
169 <member name="P:Tizen.Applications.Messages.RemoteValues.PortName">
171 The name of the remote message port.
174 <member name="P:Tizen.Applications.Messages.RemoteValues.Trusted">
176 If true, the remote port is a trusted port, otherwise, if false, it is not.