added direct gatt connect in Android
[platform/upstream/iotivity.git] / resource / csdk / connectivity / src / bt_le_adapter / android / caleclient.h
1 /* ****************************************************************
2  *
3  * Copyright 2014 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  ******************************************************************/
20
21 /**
22  * @file
23  * This file contains the APIs for BT LE communications.
24  */
25 #ifndef CA_LECLIENT_H_
26 #define CA_LECLIENT_H_
27
28 #include "cacommon.h"
29 #include "cathreadpool.h"
30 #include "uarraylist.h"
31 #include "jni.h"
32
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37
38 static const uint16_t GATT_ERROR = 133;
39
40 static const uint16_t STATE_SEND_NONE = 1;
41 static const uint16_t STATE_SEND_SUCCESS = 2;
42 static const uint16_t STATE_SEND_FAIL = 3;
43 static const uint16_t STATE_SENDING = 4;
44
45 typedef struct le_state_info
46 {
47     char address[CA_MACADDR_SIZE];
48     uint16_t connectedState;
49     uint16_t sendState;
50     jboolean autoConnectFlag;
51     jboolean isDescriptorFound;
52 } CALEState_t;
53
54 /**
55  * Callback to be notified on reception of any data from remote devices.
56  * @param[in]  address                MAC address of remote device.
57  * @param[in]  data                   Data received from remote device.
58  * @pre  Callback must be registered using CALESetCallback(CAPacketReceiveCallback callback)
59  */
60 typedef void (*CAPacketReceiveCallback)(const char *address, const uint8_t *data);
61
62 /**
63  * initialize JNI object.
64  */
65 void CALEClientJniInit();
66
67 /**
68  * set context of application.
69  */
70 void CALEClientJNISetContext();
71
72 /**
73  * create interface object and initialize the object.
74  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
75  */
76 CAResult_t CALEClientCreateJniInterfaceObject();
77
78 /**
79  * initialize client for BLE.
80  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
81  */
82 CAResult_t CALEClientInitialize();
83
84 /**
85  * terminate client for BLE.
86  */
87 void CALEClientTerminate();
88
89 /**
90  * destroy interface object and terminate the interface.
91  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
92  */
93 CAResult_t CALEClientDestroyJniInterface();
94
95 /**
96  * for destroy sending routine.
97  * @param[in]   env                   JNI interface pointer.
98  * @param[in]   gatt                  Gatt profile object.
99  */
100 void CALEClientSendFinish(JNIEnv *env, jobject gatt);
101
102 /**
103  * send data for unicast (interface).
104  * @param[in]   address               remote address.
105  * @param[in]   data                  data for transmission.
106  * @param[in]   dataLen               data length.
107  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
108  */
109 CAResult_t CALEClientSendUnicastMessage(const char *address, const uint8_t *data,
110                                         const uint32_t dataLen);
111
112 /**
113  * send data for multicast (interface).
114  * @param[in]   data                  data for transmission.
115  * @param[in]   dataLen               data length.
116  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
117  */
118 CAResult_t CALEClientSendMulticastMessage(const uint8_t *data, const uint32_t dataLen);
119
120 /**
121  * start unicast server.
122  * @param[in]   address               remote address.
123  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
124  */
125 CAResult_t CALEClientStartUnicastServer(const char *address);
126
127 /**
128  * start multicast server (start discovery).
129  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
130  */
131 CAResult_t CALEClientStartMulticastServer();
132
133 /**
134  * stop unicast server.
135  */
136 void CALEClientStopUnicastServer();
137
138 /**
139  * stop multicast server (stop discovery).
140  */
141 void CALEClientStopMulticastServer();
142
143 /**
144  * set this callback for receiving data packets from peer devices.
145  * @param[in]   callback              callback to be notified on reception of
146  *                                    unicast/multicast data packets.
147  */
148 void CALEClientSetCallback(CAPacketReceiveCallback callback);
149
150 /**
151  * waiting to get scanned device from BT Platform.
152  * if there is no scanned device in the list.
153  * @param[in]   env                   JNI interface pointer.
154  * @param[in]   address               LE address.
155  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
156  */
157 CAResult_t CALEClientIsThereScannedDevices(JNIEnv *env, const char* address);
158
159 /**
160  * send data for unicast (implement).
161  * @param[in]   address               remote address.
162  * @param[in]   data                  data for transmission.
163  * @param[in]   dataLen               data length.
164  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
165  */
166 CAResult_t CALEClientSendUnicastMessageImpl(const char *address, const uint8_t *data,
167                                             const uint32_t dataLen);
168
169 /**
170  * send data for multicast (implement).
171  * @param[in]   env                   JNI interface pointer.
172  * @param[in]   data                  data for transmission.
173  * @param[in]   dataLen               data length.
174  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
175  */
176 CAResult_t CALEClientSendMulticastMessageImpl(JNIEnv *env, const uint8_t *data,
177                                               const uint32_t dataLen);
178
179 /**
180  * send data to remote device.
181  * if it isn't connected yet. connect LE before try to send data.
182  * @param[in]   env                   JNI interface pointer.
183  * @param[in]   device                bluetooth device object.
184  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
185  */
186 CAResult_t CALEClientSendData(JNIEnv *env, jobject device);
187
188 /**
189  * get address from bluetooth gatt object.
190  * @param[in]   env                   JNI interface pointer.
191  * @param[in]   gatt                  Gatt profile object.
192  * @return  bluetooth address.
193  */
194 jstring CALEClientGetAddressFromGattObj(JNIEnv *env, jobject gatt);
195
196 /**
197  * get remote address from bluetooth socket object.
198  * @param[in]   env                   JNI interface pointer.
199  * @param[in]   bluetoothSocketObj    bluetooth socket.
200  * @return  bluetooth address.
201  */
202 jstring CALEClientGetRemoteAddress(JNIEnv *env, jobject bluetoothSocketObj);
203
204 /**
205  * close gatt.
206  * @param[in]   env                   JNI interface pointer.
207  * @param[in]   bluetoothGatt         gatt profile object.
208  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
209  */
210 CAResult_t CALEClientGattClose(JNIEnv *env, jobject bluetoothGatt);
211
212 /**
213  * start to scan whole bluetooth devices (interface).
214  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
215  */
216 CAResult_t CALEClientStartScan();
217
218 /**
219  * start to scan whole bluetooth devices (implement).
220  * @param[in]   env                   JNI interface pointer.
221  * @param[in]   callback              callback to receive device object by scanning.
222  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
223  */
224 CAResult_t CALEClientStartScanImpl(JNIEnv *env, jobject callback);
225
226 /**
227  * start to scan target bluetooth devices for service uuid (implement).
228  * @param[in]   env                   JNI interface pointer.
229  * @param[in]   uuids                 target UUID.
230  * @param[in]   callback              callback to receive device object by scanning.
231  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
232  */
233 CAResult_t CALEClientStartScanWithUUIDImpl(JNIEnv *env, jobjectArray uuids,
234                                            jobject callback);
235
236 /**
237  * get uuid object.
238  * @param[in]   env                   JNI interface pointer.
239  * @param[in]   uuid                  uuid.
240  * @return  uuid object.
241  */
242 jobject CALEClientGetUUIDObject(JNIEnv *env, const char *uuid);
243
244 /**
245  * stop scan (interface).
246  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
247  */
248 CAResult_t CALEClientStopScan();
249
250 /**
251  * set ble scanning flag.
252  * @param[in]   flag        scan flag.
253  */
254 void CALEClientSetScanFlag(bool flag);
255
256 /**
257  * stop scan (implement).
258  * @param[in]   env                   JNI interface pointer.
259  * @param[in]   callback              callback to receive device object by scanning.
260  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
261  */
262 CAResult_t CALEClientStopScanImpl(JNIEnv *env, jobject callback);
263
264 /**
265  * set flag into State List.
266  * @param[in]   env                   JNI interface pointer.
267  * @param[in]   jni_address           remote address.
268  * @param[in]   state_idx             state index.
269  * @param[in]   flag                  auto connect flag.
270  */
271 CAResult_t CALEClientSetFlagToState(JNIEnv *env, jstring jni_address,
272                                     jint state_idx, jboolean flag);
273
274 /**
275  * get flag from State List.
276  * @param[in]   env                   JNI interface pointer.
277  * @param[in]   jni_address           remote address.
278  * @param[in]   state_idx             state index.
279  * @return  current flag;
280  */
281 jboolean CALEClientGetFlagFromState(JNIEnv *env, jstring jni_address, jint state_idx);
282
283 /**
284  * connect to gatt server hosted.
285  * @param[in]   env                   JNI interface pointer.
286  * @param[in]   bluetoothDevice       bluetooth Device object.
287  * @param[in]   autoconnect           whether to directly connect to the remote device(false) or
288  *                                     to automatically connect as soon as the remote device
289  *                                     becomes available.
290  * @return  gatt object
291  */
292 jobject CALEClientConnect(JNIEnv *env, jobject bluetoothDevice, jboolean autoconnect);
293
294 /**
295  * disconnect to gatt server by a target device.
296  * @param[in]   env                   JNI interface pointer.
297  * @param[in]   bluetoothGatt         Gatt profile object.
298  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
299  */
300 CAResult_t CALEClientDisconnect(JNIEnv *env, jobject bluetoothGatt);
301
302 /**
303  * disconnect to gatt server by whole devices.
304  * @param[in]   env                   JNI interface pointer.
305  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
306  */
307 CAResult_t CALEClientDisconnectAll(JNIEnv *env);
308
309 /**
310  * disconnect to gatt server by selected address.
311  * @param[in]   env                   JNI interface pointer.
312  * @param[in]   remoteAddress         remote address.
313  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
314  */
315 CAResult_t CALEClientDisconnectforAddress(JNIEnv *env, jstring remoteAddress);
316
317 /**
318  * start discovery server.
319  * @param[in]   env                   JNI interface pointer.
320  * @param[in]   bluetoothGatt         Gatt profile object.
321  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
322  */
323 CAResult_t CALEClientDiscoverServices(JNIEnv *env, jobject bluetoothGatt);
324
325 /**
326  * call CALESetValueAndWriteCharacteristic when connection is successful.
327  * @param[in]   env                   JNI interface pointer.
328  * @param[in]   gatt                  Gatt profile object.
329  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
330  */
331 CAResult_t CALEClientWriteCharacteristic(JNIEnv *env, jobject gatt);
332
333 /**
334  * create GattCharacteristic and call CALEClientWriteCharacteristicImpl
335  * for request to write gatt characteristic.
336  * @param[in]   env                   JNI interface pointer.
337  * @param[in]   gatt                  Gatt profile object.
338  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
339  */
340 CAResult_t CALESetValueAndWriteCharacteristic(JNIEnv *env, jobject gatt);
341
342 /**
343  * request to write gatt characteristic.
344  * @param[in]   env                   JNI interface pointer.
345  * @param[in]   bluetoothGatt         Gatt profile object.
346  * @param[in]   gattCharacteristic    characteristic object that contain data to send.
347  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
348  */
349 CAResult_t CALEClientWriteCharacteristicImpl(JNIEnv *env, jobject bluetoothGatt,
350                                              jobject gattCharacteristic);
351
352 /**
353  * request to read gatt characteristic.
354  * @param[in]   env                   JNI interface pointer.
355  * @param[in]   bluetoothGatt         Gatt profile object.
356  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
357  */
358 CAResult_t CALEClientReadCharacteristic(JNIEnv *env, jobject bluetoothGatt);
359
360 /**
361  * enable notification for a target device.
362  * @param[in]   env                   JNI interface pointer.
363  * @param[in]   bluetoothGatt         Gatt profile object.
364  * @param[in]   characteristic        Characteristic object.
365  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
366  */
367 CAResult_t CALEClientSetCharacteristicNotification(JNIEnv *env, jobject bluetoothGatt,
368                                                   jobject characteristic);
369
370 /**
371  * create gatt characteristic object.
372  * @param[in]   env                   JNI interface pointer.
373  * @param[in]   bluetoothGatt         Gatt profile object.
374  * @param[in]   data                  for make Characteristic with data.
375  * @return  Gatt Characteristic object.
376  */
377 jobject CALEClientCreateGattCharacteristic(JNIEnv *env, jobject bluetoothGatt, jbyteArray data);
378
379 /**
380  * get gatt service.
381  * @param[in]   env                   JNI interface pointer.
382  * @param[in]   bluetoothGatt         Gatt profile object.
383  * @param[in]   characterUUID         for make BluetoothGattCharacteristic object.
384  * @return  Gatt Service.
385  */
386 jobject CALEClientGetGattService(JNIEnv *env, jobject bluetoothGatt, jstring characterUUID);
387
388 /**
389  * get value from characteristic.
390  * @param[in]   env                   JNI interface pointer.
391  * @param[in]   characteristic        Characteristic object.
392  * @return  value in characteristic.
393  */
394 jbyteArray CALEClientGetValueFromCharacteristic(JNIEnv *env, jobject characteristic);
395
396 /**
397  * create UUID List.
398  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
399  */
400 CAResult_t CALEClientCreateUUIDList();
401
402 /**
403  * set UUID to descriptor.
404  * @param[in]   env                   JNI interface pointer.
405  * @param[in]   bluetoothGatt         Gatt profile object.
406  * @param[in]   characteristic        Characteristic object.
407  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
408  */
409 CAResult_t CALEClientSetUUIDToDescriptor(JNIEnv *env, jobject bluetoothGatt,
410                                          jobject characteristic);
411
412 /**
413  * add device object to scan device list.
414  * @param[in]   env                   JNI interface pointer.
415  * @param[in]   device                bluetooth device object.
416  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
417  */
418 CAResult_t CALEClientAddScanDeviceToList(JNIEnv *env, jobject device);
419
420 /**
421  * check whether the device exist in list or not.
422  * @param[in]   env                   JNI interface pointer.
423  * @param[in]   remoteAddress         remote address.
424  * @return  true or false.
425  */
426 bool CALEClientIsDeviceInScanDeviceList(JNIEnv *env, const char *remoteAddress);
427
428 /**
429  * remove all devices in scan device list.
430  * @param[in]   env                   JNI interface pointer.
431  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
432  */
433 CAResult_t CALEClientRemoveAllScanDevices(JNIEnv *env);
434
435 /**
436  * remove target device in scan device list.
437  * @param[in]   env                   JNI interface pointer.
438  * @param[in]   remoteAddress         remote address.
439  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
440  */
441 CAResult_t CALEClientRemoveDeviceInScanDeviceList(JNIEnv *env, jstring remoteAddress);
442
443 /**
444  * add gatt object to gatt object list.
445  * @param[in]   env                   JNI interface pointer.
446  * @param[in]   gatt                  Gatt profile object.
447  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
448  */
449 CAResult_t CALEClientAddGattobjToList(JNIEnv *env, jobject gatt);
450
451 /**
452  * check whether the gatt object exist in list or not.
453  * @param[in]   env                   JNI interface pointer.
454  * @param[in]   remoteAddress         remote address.
455  * @return  true or false.
456  */
457 bool CALEClientIsGattObjInList(JNIEnv *env, const char *remoteAddress);
458
459 /**
460  * get the gatt object.
461  * @param[in]   env                   JNI interface pointer.
462  * @param[in]   remoteAddress         remote address.
463  * @return  gatt object.
464  */
465 jobject CALEClientGetGattObjInList(JNIEnv *env, const char* remoteAddress);
466
467 /**
468  * remove all gatt objects in gatt object list.
469  * @param[in]   env                   JNI interface pointer.
470  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
471  */
472 CAResult_t CALEClientRemoveAllGattObjs(JNIEnv *env);
473
474 /**
475  * remove target device in gatt object list.
476  * @param[in]   env                   JNI interface pointer.
477  * @param[in]   gatt                  Gatt profile object.
478  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
479  */
480 CAResult_t CALEClientRemoveGattObj(JNIEnv *env, jobject gatt);
481
482 /**
483  * remove gatt object of target device for address in gatt object list.
484  * @param[in]   env                   JNI interface pointer.
485  * @param[in]   gatt                  Gatt profile object.
486  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
487  */
488 CAResult_t CALEClientRemoveGattObjForAddr(JNIEnv *env, jstring addr);
489
490 /**
491  * get ble address from Bluetooth device.
492  * @param[in]   env                   JNI interface pointer.
493  * @param[in]   bluetoothDevice       Bluetooth device.
494  * @return  ble address.
495  */
496 jstring CALEClientGetLEAddressFromBTDevice(JNIEnv *env, jobject bluetoothDevice);
497
498 /**
499  * update new state information.
500  * @param[in]   address               remote address.
501  * @param[in]   state_type            state type.
502  * @param[in]   target_state          state index to update.
503  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
504  */
505 CAResult_t CALEClientUpdateDeviceState(const char* address, uint16_t state_type,
506                                        uint16_t target_state);
507
508 /**
509  * check whether the remote address is existed or not.
510  * @param[in]   address               remote address.
511  * @return  true or false.
512  */
513 bool CALEClientIsDeviceInList(const char *remoteAddress);
514
515 /**
516  * remove all device states.
517  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
518  */
519 CAResult_t CALEClientRemoveAllDeviceState();
520
521 /**
522  * Reset values of device state for all of devices.
523  * this method has to be invoked when BT adapter is disabled.
524  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
525  */
526 CAResult_t CALEClientResetDeviceStateForAll();
527
528 /**
529  * remove the device state for a remote device.
530  * @param[in]   remoteAddress         remote address.
531  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
532  */
533 CAResult_t CALEClientRemoveDeviceState(const char* remoteAddress);
534
535 /**
536  * get state information for a remote device.
537  * @param[in]   remoteAddress         remote address.
538  * @return  CALEState_t.
539  */
540 CALEState_t* CALEClientGetStateInfo(const char* remoteAddress);
541
542 /**
543  * check whether the remote address has same state with target state.
544  * @param[in]   remoteAddress         remote address.
545  * @param[in]   state_type            state_type.
546  * @param[in]   target_state          state index to check.
547  * @return  true or false.
548  */
549 bool CALEClientIsValidState(const char* remoteAddress, uint16_t state_type,
550                             uint16_t target_state);
551
552 /**
553  * create scan device list.
554  */
555 void CALEClientCreateDeviceList();
556
557 /**
558  * update the counter which data is sent to remote device.
559  * @param[in]   env                   JNI interface pointer.
560  */
561 void CALEClientUpdateSendCnt(JNIEnv *env);
562
563 /**
564  * initialize mutex.
565  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
566  */
567 CAResult_t CALEClientInitGattMutexVaraibles();
568
569 /**
570  * terminate mutex.
571  */
572 void CALEClientTerminateGattMutexVariables();
573
574 /**
575  * set send finish flag.
576  * @param[in]   flag        finish flag.
577  */
578 void CALEClientSetSendFinishFlag(bool flag);
579
580 /**
581  * close the connection of the profile proxy to the Service.
582  * @param[in]   env                   JNI interface pointer.
583  * @param[in]   gatt                  gatt profile object.
584  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
585  */
586 CAResult_t CALEClientCloseProfileProxy(JNIEnv *env, jobject gatt);
587
588 /**
589  * connect to GATT Server hosted by this device.
590  * @param[in]   env                   JNI interface pointer.
591  * @param[in]   bluetoothDevice       bluetooth device object.
592  * @param[in]   autoconnect           connect as soon as the device becomes avaiable(true).
593  * @return  gatt profile object
594  */
595 jobject CALEClientGattConnect(JNIEnv *env, jobject bluetoothDevice, jboolean autoconnect);
596
597 /**
598  * connect to GATT Server hosted by this device directly.
599  * @param[in]   env                   JNI interface pointer.
600  * @param[in]   bluetoothDevice       bluetooth device object.
601  * @param[in]   autoconnect           connect as soon as the device becomes avaiable(true).
602  * @return  ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h).
603  */
604 CAResult_t CALEClientDirectConnect(JNIEnv *env, jobject bluetoothDevice, jboolean autoconnect);
605
606 #ifdef __cplusplus
607 } /* extern "C" */
608 #endif
609
610 #endif /* CA_LECLIENT_H_ */