From 1b27e1149e100fcfaf6954395bd47e88716d1d9e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 28 Sep 2021 14:25:59 +0900 Subject: [PATCH] Update README markdown Change-Id: If7d5891ce99f2c426e8e887b90e1eff03d5ae99c Signed-off-by: Hwankyu Jhun --- README.md | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ac16a11..6f5c490 100755 --- a/README.md +++ b/README.md @@ -203,6 +203,26 @@ int rpc_port_set_Foo_Age(rpc_port_Foo_h h, int Age); // Setter for property ‘A int rpc_port_set_Foo_Name(rpc_port_Foo_h h, const char* Name); // Setter for property ‘Name’ int rpc_port_get_Foo_Age(rpc_port_Foo_h h, int* Age); // Getter for property ‘Age’ int rpc_port_get_Foo_Name(rpc_port_Foo_h h, char** Name); // Getter for property ‘Name’ + +// Proxy (Since TIDLC version 1.5.0) +typedef struct rpc_port_proxy_Foo_s *rpc_port_proxy_Foo_h; // Handle for Foo +int rpc_port_proxy_create_Foo(rpc_port_proxy_Foo_h* h); // Constructor for Foo +int rpc_port_proxy_destroy_Foo(rpc_port_proxy_Foo_h h); // Destructor for Foo +int rpc_port_proxy_clone_Foo(rpc_port_proxy_Foo_h h, rpc_port_proxy_Foo_h* clone); // Copy constructor for Foo +int rpc_port_proxy_set_Foo_Age(rpc_port_proxy_Foo_h h, int Age); // Setter for property ‘Age’ +int rpc_port_proxy_set_Foo_Name(rpc_port_proxy_Foo_h h, const char* Name); // Setter for property ‘Name’ +int rpc_port_proxy_get_Foo_Age(rpc_port_proxy_Foo_h h, int* Age); // Getter for property ‘Age’ +int rpc_port_proxy_get_Foo_Name(rpc_port_proxy_Foo_h h, char** Name); // Getter for property ‘Name’ + +// Stub (Since TIDLC version 1.5.0) +typedef struct rpc_port_stub_Foo_s *rpc_port_stub_Foo_h; // Handle for Foo +int rpc_port_stub_create_Foo(rpc_port_stub_Foo_h* h); // Constructor for Foo +int rpc_port_stub_destroy_Foo(rpc_port_stub_Foo_h h); // Destructor for Foo +int rpc_port_stub_clone_Foo(rpc_port_stub_Foo_h h, rpc_port_stub_Foo_h* clone); // Copy constructor for Foo +int rpc_port_stub_set_Foo_Age(rpc_port_stub_Foo_h h, int Age); // Setter for property ‘Age’ +int rpc_port_stub_set_Foo_Name(rpc_port_stub_Foo_h h, const char* Name); // Setter for property ‘Name’ +int rpc_port_stub_get_Foo_Age(rpc_port_stub_Foo_h h, int* Age); // Getter for property ‘Age’ +int rpc_port_stub_get_Foo_Name(rpc_port_stub_Foo_h h, char** Name); // Getter for property ‘Name’ ``` ### Proxy Interface @@ -225,8 +245,9 @@ class Runnable { Runnable(IEventListener* listener, const std::string& target_appid); // Constructor virtual ~Runnable(); // Destructor - int Connect(); // Method for connecting service app + int Connect(); // Method for connecting to the stub int Run(Foo foo); //Method from TIDL + void Disconnect(); // Method for disconnecting from the stub (Since TIDLC version 1.6.1) }; ``` @@ -237,14 +258,17 @@ public class Runnable : IDisposable { public event EventHandler Disconnected; // Event handler public event EventHandler Rejected; // Event handler public Runnable(string appId); // Constructor - public void Connect(); // Method for connecting service app - public int Run(Foo foo); //Method from TIDL + public void Connect(); // Method for connecting to the stub + public int Run(Foo foo); //Method from TIDL + public void Disconnect(); // Method for disconnecting from the stub (Since TIDLC version 1.6.1) … }; ``` **C** ```c +// Previous version typedef struct Runnable_s* rpc_port_proxy_Runnable_h; // Handle for ‘Runnable’ + typedef struct { void (*connected)(rpc_port_proxy_Runnable_h h, void* user_data); // Connected event callback void (*disconnected)(rpc_port_proxy_Runnable_h h, void* user_data); // Disconnected event callback @@ -264,6 +288,42 @@ int rpc_port_proxy_Runnable_destroy(rpc_port_proxy_Runnable_h h); int rpc_port_proxy_Runnable_invoke_Run(rpc_port_proxy_Runnable_h h, rpc_port_Foo_h foo); ``` +```c +// Since TIDLC version 1.5.0 +typedef struct rpc_port_proxy_Runnable_s* rpc_port_proxy_Runnable_h; // Handle for ‘Runnable’ + +// Called when the port is connected +typedef void (*rpc_port_proxy_Runnable_connected_cb)(rpc_port_proxy_Runnable_h h, void *user_data); + +// Called when the port is disconnected +typedef void (*rpc_port_proxy_Runnable_disconnected_cb)(rpc_port_proxy_Runnable_h h, void *user_data); + +// Called when the connection request is rejected +typedef void (*rpc_port_proxy_Runnable_rejected_cb)(rpc_port_proxy_Runnable_h h, void *user_data); + +// The structure type containing the set of callback functions for handling proxy events +typedef struct { + rpc_port_proxy_Runnable_connected_cb connected; + rpc_port_proxy_Runnable_disconnected_cb disconnected; + rpc_port_proxy_Runnable_rejected_cb rejected; +} rpc_port_proxy_Runnable_callback_s; + +// Function for creating Runnable proxy handle +int rpc_port_proxy_Runnable_create(const char* stub_appid, rpc_port_proxy_Runnable_callback_s* callback, void* user_data, rpc_port_proxy_Runnable_h* h); + +// Function for connecting to the stub +int rpc_port_proxy_Runnable_connect(rpc_port_proxy_Runnable_h h); + +// Function for destroying Runnable proxy handle +int rpc_port_proxy_Runnable_destroy(rpc_port_proxy_Runnable_h h); + +// Function from TIDL +int rpc_port_proxy_Runnable_invoke_Run(rpc_port_proxy_Runnable_h h, rpc_port_Foo_h foo); + +// Function for disconnection from the stub (Since TIDLC version 1.6.1) +int rpc_port_proxy_Runnable_disconnect(rpc_port_proxy_Runnable_h h); +``` + ### Stub Interface **TIDL** @@ -284,11 +344,14 @@ class Runnable { virtual void OnCreate() = 0; // Called when service object is created virtual void OnTerminate() = 0; // Called when service object is terminated virtual int Run(Foo foo) = 0; // Method to implement + + ... + void Disconnect(); // Method for disconnecting from the RPC service (Since TIDLC version 1.6.1) }; Runnable(); // Constructor ~Runnable(); // Destructor - void Listen(std::shared\_ptr service\_factory); // Method for listening + void Listen(std::shared\_ptr service_factory); // Method for listening }; ``` @@ -300,6 +363,7 @@ public sealed class Runnable : IDisposable { public abstract void OnTerminate(); // Called when service object is terminated public abstract int Run(Foo foo); // Method to implement … + public void Disconnect(); // Method for disconnecting from the RPC service (Since TIDLC version 1.6.1) }; public Runnable(); // Constructor public void Listen(Type serviceType); // Method for listening @@ -309,6 +373,7 @@ public sealed class Runnable : IDisposable { **C** ```c +// Previous version // Handle for ‘Runnable’ typedef struct Runnable_context_s* rpc_port_stub_Runnable_context_h; @@ -336,3 +401,42 @@ int rpc_port_stub_Runnable_register(rpc_port_stub_Runnable_callback_s* callback, int rpc_port_stub_Runnable_unregister(void); ``` +```c +// Since TIDLC version 1.5.0 +// Handle for ‘Runnable’ +typedef struct rpc_port_stub_Runnable_context_s* rpc_port_stub_Runnable_context_h; + +// Set extra data into the context +int rpc_port_stub_Runnable_context_set_tag(rpc_port_stub_Runnable_context_h context, void* tag); + +// Get extra data from the context +int rpc_port_stub_Runnable_context_get_tag(rpc_port_stub_Runnable_context_h context, void** tag); + +// Disconnect from the proxy +int rpc_port_stub_Runnable_context_disconnect(rpc_port_stub_Runnable_context_h context); + +// Called when the service object is created +typedef void (*rpc_port_stub_Runnable_create_cb)(rpc_port_stub_Runnable_context_h context, void *user_data); + +// Called when the service object is terminated +typedef void (*rpc_port_stub_Runnable_terminate_cb)(rpc_port_stub_Runnable_context_h context, void *user_data); + +// Called when the proxy sends the request for 'Run' +typedef void (*rpc_port_stub_Runnable_Run_cb)(rpc-port_stub_Runnable_context_h context, rpc_port_stub_Foo_h foo, void *user_data); + +// The structure type containing the set of callback functions for handling stub events +typedef struct { + rpc_port_stub_Runnable_create_cb create; + rpc_port_stub_Runnable_terminate_cb terminate; + rpc_port_stub_Runnable_Run_cb Run; +} rpc_port_stub_Runnable_callback_s; + +// Initialize interface ‘Runnable’ +int rpc_port_stub_Runnable_register(rpc_port_stub_Runnable_callback_s* callback, void* user_data); + +// Deinitialize interface ‘Runnable’ +int rpc_port_stub_Runnable_unregister(void); + +// Gets the number of connected clients +int rpc_port_stub_Runnable_get_client_number(unsigned int *client_number); +``` \ No newline at end of file -- 2.7.4