1 /* *****************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
23 * This file contains the declaration of Group Synchronization APIs
24 * for JNI implementation.
27 #ifndef JNI_GROUP_SYNCHRONIZATION_H_
28 #define JNI_GROUP_SYNCHRONIZATION_H_
34 #include <jni_string.h>
41 * API for finding a specific remote group when a resource tries to join a group.
42 * Callback is called when a group is found or not.
44 * @param resourceTypes - resource types of a group to find and join
46 * @return OCStackResult - return value of this API.
47 * It returns OC_STACK_OK if success.
49 * NOTE: It return OC_STACK ERROR when It was finding a group.
50 * You should call this api when the group finding process has stopped.
51 * OCStackResult is defined in ocstack.h.
54 JNIEXPORT jint JNICALL JNIGroupSynchronizationFindGroup
55 (JNIEnv *env, jobject interfaceObject, jobject resourceTypes);
58 * API for creating a new group.
60 * @param resourceType - resource type of a group to create
62 * @return OCStackResult - return value of this API.
63 * It returns OC_STACK_OK if success.
65 * NOTE: OCStackResult is defined in ocstack.h.
67 JNIEXPORT jint JNICALL JNIGroupSynchronizationCreateGroup
68 (JNIEnv *env, jobject interfaceObject, jstring resourceType);
71 * API for joining a group. This API is used when a resource that has a group tries
72 * to find a specific remote resource and makes it join a group
74 * @param resourceType - resource type of a group to join.
75 * @param resourceHandle - resource handle to join a group.
77 * @return OCStackResult - return value of this API.
78 * It returns OC_STACK_OK if success.
80 * NOTE: If you want to join the resource in the remote(other) process, use the API
81 * jniThingsManagerJoinGroupObject instead of this.
82 * OCStackResult is defined in ocstack.h.
84 JNIEXPORT jint JNICALL JNIGroupSynchronizationJoinGroupString
85 (JNIEnv *env, jobject interfaceObject, jstring resourceType, jobject resourceHandle);
88 * API for joining a group. This API is used when a resource that
89 * doesn't have a group tries to find and join a specific remote group.
91 * @param resource - group resource pointer to join.
92 * @param resourceHandle - resource handle to join a group.
94 * @return OCStackResult - return value of this API.
95 * It returns OC_STACK_OK if success.
97 * NOTE: NOTE: If you want to join the resource in the same process, use the API
98 * jniThingsManagerJoinGroupString instead of this.
99 * OCStackResult is defined in ocstack.h.
101 JNIEXPORT jint JNICALL JNIGroupSynchronizationJoinGroupObject
102 (JNIEnv *env, jobject interfaceObject, jobject resource, jobject resourceHandle);
105 * API for leaving a joined group.
107 * @param resourceType - resource type of a group to leave.
108 * @param resourceHandle - resource handle to join a group.
110 * @return OCStackResult - return value of this API.
111 * It returns OC_STACK_OK if success.
113 * NOTE: OCStackResult is defined in ocstack.h.
115 JNIEXPORT jint JNICALL JNIGroupSynchronizationLeaveGroup
116 (JNIEnv *env, jobject interfaceObject, jstring resourceType, jobject resourceHandle);
119 * API for leaving a joined group.
121 * @param resource - resource of a group to leave.
122 * @param resourceType - resource type of a group to leave.
123 * @param resourceHandle - resource handle to join a group.
125 * @return OCStackResult - return value of this API.
126 * It returns OC_STACK_OK if success.
128 * NOTE: OCStackResult is defined in ocstack.h.
130 JNIEXPORT jint JNICALL JNIGroupSynchronizationLeaveGroupForResource
131 (JNIEnv *env, jobject interfaceObject, jobject resource, jstring resourceType,
132 jobject resourceHandle);
135 * API for deleting a group.
137 * @param collectionResourceType - resource type of a group to delete.
141 JNIEXPORT void JNICALL JNIGroupSynchronizationDeleteGroup
142 (JNIEnv *env, jobject interfaceObject, jstring collectionResourceType);
145 * API for getting a list of joined groups.
147 * @return std::map - return value of this API.
148 * It returns group resource type and group resource handle as a map type.
150 JNIEXPORT jobject JNICALL JNIGroupSynchronizationGetGroupList
151 (JNIEnv *env, jobject interfaceObject);
156 #endif //JNI_GROUP_SYNCHRONIZATION_H_