1RAPI_CONNECTION_FROM_NAME(3) http://www.synce.org/RAPI_CONNECTION_FROM_NAME(3)
2
3
4
6 rapi_connection_from_name - obtain connection for RAPI function calls
7
9 #include <rapi.h>
10
11 RapiConnection *rapi_connection_from_name(const char *device_name);
12
13 RapiConnection *rapi_connection_from_info(SynceInfo *info);
14
15 void rapi_connection_select(RapiConnection *connection);
16
17 void rapi_connection_destroy(RapiConnection *connection);
18
19 HRESULT CeRapiInit();
20
21 STDAPI CeRapiUninit();
22
24 The rapi_connection_from_info() function returns a pointer to a newly
25 allocated RapiConnection struct, used for remote function calls to a
26 mobile device. The RapiConnection keeps a pointer to the SynceInfo
27 struct but does not copy it, therefore freeing the SynceInfo before the
28 RapiConnection is not recommended.
29
30 rapi_connection_from_name() accomplishes the same for the connected
31 device named device_name. Refer to synce_info_new(3) for insight on
32 how this name and the connection daemon in use can affect the device
33 contacted.
34
35 rapi_connection_select() allows for selection between multiple active
36 connections. NULL can be passed to result in no active connection.
37
38 rapi_connection_destroy() frees a RapiConnection. This should not be
39 called before CeRapiUninit().
40
41 CeRapiInit() connects the current RapiConnection to it's mobile device.
42 If already initialised, CERAPI_E_ALREADYINITIALIZED is returned.
43
44 CeRapiUninit() destroys the connection for the current RapiConnection.
45 The RapiConnection cannot be re-initialised, it must be destroyed.
46
47 An example of using multiple devices follows.
48
49 /*
50 * SynCE support for switching between multiple devices
51 *
52 * Example code for two devices follows!
53 *
54 * It shows two different ways to get a RapiConnection object.
55 *
56 */
57
58 RapiConnection* a = rapi_connection_from_name("device_a");
59 rapi_connection_select(a);
60 CeRapiInit()
61
62 SynceInfo* info_b = synce_info_new("device_b");
63 RapiConnection* b = rapi_connection_from_info(info_b);
64 rapi_connection_select(b);
65 CeRapiInit()
66
67 rapi_connection_select(a);
68 ...some RAPI calls to device A...
69
70 rapi_connection_select(b);
71 ...some RAPI calls to device B...
72
73 rapi_connection_select(a);
74 CeRapiUninit();
75 rapi_connection_destroy(a);
76
77 rapi_connection_select(b);
78 CeRapiUninit();
79 rapi_connection_destroy(b);
80 synce_info_destroy(info_b);
81
82
84 rapi_connection_from_name() and rapi_connection_from_info() return a
85 pointer to a new RapiConnection.
86
87 CeRapiInit() and CeRapiUninit() return S_OK on success or an error code
88 on failure.
89
91 This manual page was written by Mark Ellis <mark_ellis@users.sourceā
92 forge.net>.
93
95 synce(7), synce_info_new(3), odccm(1), vdccm(1)
96
97
98
99The SynCE Project 2007-08-26 RAPI_CONNECTION_FROM_NAME(3)