}
```
-**Rust**
-```Rust
-pub struct RemoteException {
- pub cause: i32,
- pub message: String,
-}
-
-impl RemoteException {
- pub fn new() -> Self;
- pub fn with_message(message: &str) -> Self;
- pub fn with_cause_and_message(cause: i32, message: &str) -> Self;
- pub fn get_cause(&self) -> i32;
- pub fn get_message(&self) -> &String;
-}
-
-pub mod message_base {
- pub struct MessageBase {
- pub id: i32,
- pub name: String,
- pub msg: String,
- }
-}
-
-pub mod message_derived {
- pub struct MessageDerived {
- pub id: i32,
- pub name: String,
- pub msg: String,
- pub address: String,
- }
-}
-
-pub mod message {
- pub struct OnReceived<'a> {
- base: DelegateBase,
- callback: Box<dyn Fn(String, message_base::MessageBase) + Send + 'a>
- }
-
- impl<'b> OnReceived<'b> {
- pub fn new(once: bool) -> OnReceived<'b>;
- pub fn on_received<F>(&mut self, handler: F) where F: Fn(String, message_base::MessageBase) + Send + 'b;
- }
-
- pub struct Message<'a> {
- proxy: Arc<Mutex<Proxy<'a>>>,
- delegate_list: Vec<Box<dyn Delegate + Send + 'a>>,
- }
-
- impl<'b> Message<'b> {
- /// <summary>
- /// Constructor for this struct
- /// </summary>
- pub fn new() -> Arc<Mutex<Message<'b>>>;
-
- /// <summary>
- /// Connects to the service app.
- /// </summary>
- /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
- /// <privilege>http://tizen.org/privilege/datasharing</privilege>
- /// <param name="appid">The service app ID to connect</param>
- /// <exception cref="InvalidParameter">
- /// Returns when the appid to connect is invalid.
- /// </exception>
- /// <exception cref="IoError">
- /// Returns when internal I/O error happen.
- /// </exception>
- /// <exception cref="PermissionDenied">
- /// Returns when the permission is denied.
- /// </exception>
- /// <remark> If you want to use this method, you must add privileges.</remark>
- pub fn try_connect(&self, appid: &str) -> Result<(), ErrorId>;
-
-
- /// <summary>
- /// Connects to the service app synchornously.
- /// </summary>
- /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
- /// <privilege>http://tizen.org/privilege/datasharing</privilege>
- /// <param name="appid">The service app ID to connect</param>
- /// <exception cref="InvalidParameter">
- /// Returns when the appid to connect is invalid.
- /// </exception>
- /// <exception cref="IoError">
- /// Returns when internal I/O error happen.
- /// </exception>
- /// <exception cref="PermissionDenied">
- /// Returns when the permission is denied.
- /// </exception>
- /// <remark> If you want to use this method, you must add privileges.</remark>
- pub fn try_connect_sync(&self, appid: &str) -> Result<(), ErrorId>;
-
-
- /// <summary>
- /// This method will be invoked when the client app is connected to the service app.
- /// </summary>
- /// <param name="handler">The handler to be invoked when the client app is connected</param>
- pub fn on_connected<F>(&mut self, handler: F) where F: Fn(&str, &str, Port) + 'b;
-
- /// <summary>
- /// This method will be invoked after the client app was disconnected from the service app.
- /// </summary>
- /// <param name="handler">The handler to be invoked when the client app is disconnected</param>
- pub fn on_disconnected<F>(&mut self, handler: F) where F: Fn(&str, &str) + 'b;
-
- /// <summary>
- /// This method will be invoked when the service app rejects the client app.
- /// </summary>
- /// <param name="handler">The handler to be invoked when the service app rejects the client app</param>
- pub fn on_rejected<F>(&mut self, handler: F) where F: Fn(&str, &str) + 'b;
-
- pub fn register(&mut self, sender: String, callback: OnReceived<'b>) -> Result<i32, Exception>;
-
- pub fn unregister(&mut self, ) -> Result<(), Exception>;
-
- pub fn send(&mut self, message: message_base::MessageBase) -> Result<i32, Exception>;
- }
-}
-```
--
<a name="stub-interface-1"></a>
#### Stub interface
--- /dev/null
- set<double> double_set;
+protocol 2
+
+struct Envelope {
+ enum peer {
+ client,
+ server
+ }
+
+ map<string, int> string_map;
++ set<int> int_set;
+ list<string> string_list;
+ array<bundle> bundle_array;
+}
+
+struct BeginEnvelope : Envelope {
+ Envelope.peer peer_info;
+ string message;
+}
+
+struct EndEnvelope : Envelope {
+ Envelope.peer peer_info;
+ string message;
+}
+
+struct DerivedEnvelope : BeginEnvelope {
+ int id;
+}
+
+interface Message {
+ void NotifyCB(string sender, string msg) delegate;
+
+ int Register(string name, NotifyCB cb);
+ void Unregister() async;
+ int Send(string msg);
+ [privilege = "http://tizen.org/privilege/alarm.set"]
+ int SendEnvelope(string name, map<string, Envelope> envelope_map);
+ int SendEnvelopeType(string name, Envelope envelope);
+}