GenInterfaceCtor(stream, inf);
GenInterfaceConnect(stream, inf);
GenInterfaceDtor(stream, inf);
+ GenInterfaceConnectSync(stream, inf);
}
void CProxyBodyGen::GenInterfaceFileSharing(std::ofstream& stream,
GetInterfaceIdWithNamespace(inf)));
}
+void CProxyBodyGen::GenInterfaceConnectSync(std::ofstream& stream,
+ const Interface& inf) {
+ stream << SmartIndent(ReplaceAll(CB_INTERFACE_CONNECT_SYNC, "##",
+ GetInterfaceIdWithNamespace(inf)));
+}
+
std::string CProxyBodyGen::GetMethodWriteString(const Interface& inf,
const Declaration& decl) {
const char setter[] = "$$($$, $$);\n";
void GenInterfaceCtor(std::ofstream& stream, const Interface& inf);
void GenInterfaceConnect(std::ofstream& stream, const Interface& inf);
void GenInterfaceDtor(std::ofstream& stream, const Interface& inf);
+ void GenInterfaceConnectSync(std::ofstream& stream, const Interface& inf);
private:
void GenInterfaceDelegator(std::ofstream& stream, const std::string& id,
}
)__c_cb";
+const char CB_INTERFACE_CONNECT_SYNC[] =
+R"__c_cb(
+int rpc_port_proxy_##_connect_sync(rpc_port_proxy_##_h h)
+{
+ int r;
+
+ if (!h || !h->proxy) {
+ _E("Invalid parameter");
+ return -1;
+ }
+
+ r = rpc_port_proxy_connect_sync(h->proxy, h->stub_appid, "##");
+ if (r != 0) {
+ _E("Failed to connect sync ##(%s)", h->stub_appid);
+ return r;
+ }
+
+ return 0;
+}
+)__c_cb";
+
#endif // IDLC_C_GEN_C_PROXY_BODY_GEN_CB_H_
GenInterfaceConnect(stream, inf);
GenInterfaceDtor(stream, inf);
GenInterfaceMethods(stream, inf);
+ GenInterfaceConnectSync(stream, inf);
}
void CProxyHeaderGen::GenInterfaceDelegators(std::ofstream& stream,
GetInterfaceIdWithNamespace(inf));
}
+void CProxyHeaderGen::GenInterfaceConnectSync(std::ofstream& stream,
+ const Interface& inf) {
+ stream << ReplaceAll(CB_INTERFACE_CONNECT_SYNC, "##",
+ GetInterfaceIdWithNamespace(inf));
+}
+
} // namespace tidl
void GenInterfaceCtor(std::ofstream& stream, const Interface& inf);
void GenInterfaceConnect(std::ofstream& stream, const Interface& inf);
void GenInterfaceDtor(std::ofstream& stream, const Interface& inf);
+ void GenInterfaceConnectSync(std::ofstream& stream, const Interface& inf);
private:
void GenInterfaceDelegator(std::ofstream& stream, const std::string& id,
int rpc_port_##_destroy(rpc_port_##_h delegate);
)__c_cb";
+const char CB_INTERFACE_CONNECT_SYNC[] =
+R"__c_cb(
+int rpc_port_proxy_##_connect_sync(rpc_port_proxy_##_h h);
+)__c_cb";
+
#endif // IDLC_C_GEN_C_PROXY_HEADER_GEN_CB_H_
const char CB_PROXY_HELPER_METHODS[] =
R"__cpp_cb(
-void ##::Connect() {
- int ret = rpc_port_proxy_connect(proxy_, target_appid_.c_str(), "##");
+void ##::Connect(bool sync) {
+ int ret;
+ if (sync)
+ ret = rpc_port_proxy_connect_sync(proxy_, target_appid_.c_str(), "##");
+ else
+ ret = rpc_port_proxy_connect(proxy_, target_appid_.c_str(), "##");
if (ret != RPC_PORT_ERROR_NONE) {
_E("Failed to connect ##");
switch (ret) {
/// </summary>
/// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
/// <privilege>http://tizen.org/privilege/datasharing</privilege>
+ // <param name="sync">if true, connects to the service app synchornously</param>
/// <exception cref="InvalidIDException">
/// Thrown when the appid to connect is invalid.
/// </exception>
/// Thrown when the permission is denied.
/// </exception>
/// <remark> If you want to use this method, you must add privileges.</remark>
- void Connect();
+ void Connect(bool sync = false);
/// <summary>
/// Disposes delegate objects in this interface
GenTemplate(CB_CONNECT_METHOD, stream,
[&]()->std::string {
return iface.GetID();
+ },
+ [&]()->std::string {
+ return iface.GetID();
});
stream << NLine(1);
}
}
/// <summary>
+ /// Connects to the service app synchronously.
+ /// </summary>
+ /// <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ /// <privilege>http://tizen.org/privilege/datasharing</privilege>
+ /// <exception cref="InvalidIDException">
+ /// Thrown when the appid to connect is invalid.
+ /// </exception>
+ /// <exception cref="InvalidIOException">
+ /// Thrown when internal I/O error happen.
+ /// </exception>
+ /// <exception cref="PermissionDeniedException">
+ /// Thrown when the permission is denied.
+ /// </exception>
+ /// <remark> If you want to use this method, you must add privileges.</remark>
+ public void ConnectSync()
+ {
+ ConnectSync(_appId, "$$");
+ }
+
+ /// <summary>
/// Disposes delegate objects in this interface
/// </summary>
/// <param name="tag">The tag string from delegate object</param>