X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Fsrc%2Fbt_le_adapter%2Fandroid%2Fcaleclient.h;h=3dc64f6ca57eceefc4d4f6dbf6fcae80ea776a3c;hb=1cee1631595cac6a6394ac2e0b365c6dd5a42c68;hp=10066e1e53a0f8fb27dd6c65c0f4b2966be49975;hpb=390866079e285d2c74918432c0d597d5da52f8a0;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.h b/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.h index 10066e1..3dc64f6 100644 --- a/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.h +++ b/resource/csdk/connectivity/src/bt_le_adapter/android/caleclient.h @@ -37,19 +37,15 @@ extern "C" static const uint16_t GATT_ERROR = 133; -static const uint16_t STATE_CHARACTER_SET = 2; -static const uint16_t STATE_CHARACTER_UNSET = 1; -static const uint16_t STATE_CHARACTER_NO_CHANGE = 0; - -static const uint16_t STATE_SEND_NONE = 0; -static const uint16_t STATE_SEND_SUCCESS = 1; -static const uint16_t STATE_SEND_FAILED = 2; +static const uint16_t STATE_SEND_NONE = 1; +static const uint16_t STATE_SEND_SUCCESS = 2; +static const uint16_t STATE_SEND_FAIL = 3; +static const uint16_t STATE_SENDING = 4; typedef struct le_state_info { char address[CA_MACADDR_SIZE]; - jint connectedState; - uint16_t notificationState; + uint16_t connectedState; uint16_t sendState; jboolean autoConnectFlag; } CALEState_t; @@ -180,13 +176,6 @@ CAResult_t CALEClientSendMulticastMessageImpl(JNIEnv *env, const uint8_t *data, const uint32_t dataLen); /** - * check whether it is connected or not with remote address. - * @param[in] address remote address. - * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). - */ -CAResult_t CALECheckSendState(const char* address); - -/** * send data to remote device. * if it isn't connected yet. connect LE before try to send data. * @param[in] env JNI interface pointer. @@ -272,20 +261,23 @@ void CALEClientSetScanFlag(bool flag); CAResult_t CALEClientStopScanImpl(JNIEnv *env, jobject callback); /** - * set auto connect flag for connectGatt API. + * set flag into State List. * @param[in] env JNI interface pointer. * @param[in] jni_address remote address. + * @param[in] state_idx state index. * @param[in] flag auto connect flag. */ -CAResult_t CALEClientSetAutoConnectFlag(JNIEnv *env, jstring jni_address, jboolean flag); +CAResult_t CALEClientSetFlagToState(JNIEnv *env, jstring jni_address, + jint state_idx, jboolean flag); /** - * get auto connect flag. + * get flag from State List. * @param[in] env JNI interface pointer. * @param[in] jni_address remote address. - * @return current auto connect flag; + * @param[in] state_idx state index. + * @return current flag; */ -jboolean CALEClientGetAutoConnectFlag(JNIEnv *env, jstring jni_address); +jboolean CALEClientGetFlagFromState(JNIEnv *env, jstring jni_address, jint state_idx); /** * connect to gatt server hosted. @@ -505,20 +497,12 @@ jstring CALEClientGetLEAddressFromBTDevice(JNIEnv *env, jobject bluetoothDevice) /** * update new state information. * @param[in] address remote address. - * @param[in] connectedState connection state. - * @param[in] notificationState whether characteristic notification already set or not. - * @param[in] sendState whether sending was success or not. + * @param[in] state_type state type. + * @param[in] target_state state index to update. * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). */ -CAResult_t CALEClientUpdateDeviceState(const char* address, uint32_t connectedState, - uint16_t notificationState, uint16_t sendState); - -/** - * add new state to state list. - * @param[in] state new state. - * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). - */ -CAResult_t CALEClientAddDeviceStateToList(CALEState_t* state); +CAResult_t CALEClientUpdateDeviceState(const char* address, uint16_t state_type, + uint16_t target_state); /** * check whether the remote address is existed or not. @@ -555,18 +539,14 @@ CAResult_t CALEClientRemoveDeviceState(const char* remoteAddress); CALEState_t* CALEClientGetStateInfo(const char* remoteAddress); /** - * check whether the remote address is connected or not. - * @param[in] remoteAddress remote address. - * @return true or false. - */ -bool CALEClientIsConnectedDevice(const char* remoteAddress); - -/** - * check whether the remote address set CharacteristicNotification or not. + * check whether the remote address has same state with target state. * @param[in] remoteAddress remote address. + * @param[in] state_type state_type. + * @param[in] target_state state index to check. * @return true or false. */ -bool CALEClientIsSetCharacteristic(const char* remoteAddress); +bool CALEClientIsValidState(const char* remoteAddress, uint16_t state_type, + uint16_t target_state); /** * create scan device list. @@ -613,6 +593,15 @@ CAResult_t CALEClientCloseProfileProxy(JNIEnv *env, jobject gatt); */ jobject CALEClientGattConnect(JNIEnv *env, jobject bluetoothDevice, jboolean autoconnect); +/** + * connect to GATT Server hosted by this device directly. + * @param[in] env JNI interface pointer. + * @param[in] bluetoothDevice bluetooth device object. + * @param[in] autoconnect connect as soon as the device becomes avaiable(true). + * @return ::CA_STATUS_OK or ERROR CODES (::CAResult_t error codes in cacommon.h). + */ +CAResult_t CALEClientDirectConnect(JNIEnv *env, jobject bluetoothDevice, jboolean autoconnect); + #ifdef __cplusplus } /* extern "C" */ #endif