2 *******************************************************************
4 * Copyright 2016 Samsung Electronics All Rights Reserved.
6 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
20 *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
23 package org.iotivity.base;
25 import java.util.List;
26 import java.util.EnumSet;
28 import java.util.ArrayList;
33 * OcCloudProvisioning class is responsible for providing methods for cloud
36 public class OcCloudProvisioning {
38 private long mNativeHandle;
43 * API to construct the CloudProvisioning
45 * @param ipAddr address of the cloud server
46 * @param port port of the cloud server
48 public OcCloudProvisioning(String ip, int port) {
53 public String getIP() {
57 public int getPort() {
61 private void setNativeHandle(long nativeHandle) {
62 this.mNativeHandle = nativeHandle;
65 public interface RequestCertificateListener {
66 public void requestCertificateListener(boolean result);
69 public interface GetAclIdByDeviceListener {
70 public void getAclIdByDeviceListener(boolean result,String aclId);
73 public interface GetIndividualAclInfoListener {
74 public void getIndividualAclInfoListener(boolean result);
77 public interface GetCRLListener {
78 public void getCRLListener(boolean result);
81 public interface PostCRLListener {
82 public void postCRLListener(boolean result);
86 * Method to Request a certificate from the cloud
87 * @param certificateIssueRequestListener function called by the stack on completion of request.
90 public native void requestCertificate(
91 RequestCertificateListener certificateIssueRequestListener) throws OcException;
94 * Method to get ACL ID for the device
95 * @param deviceId device ID for which the Acl ID is requested
96 * @param cloudAclIdGetByDeviceHandler function called by the stack on completion of request.
99 public native void getAclIdByDevice(String deviceId,
100 GetAclIdByDeviceListener cloudAclIdGetByDeviceHandler) throws OcException;
103 * Method to get ACL information about the given Acl ID
104 * @param aclId ACL ID for which the Acl information is requested
105 * @param cloudAclIndividualGetInfoHandler function called by the stack on completion of request.
106 * @throws OcException
108 public native void getIndividualAclInfo(String aclId,
109 GetIndividualAclInfoListener cloudAclIndividualGetInfoHandler) throws OcException;
112 * Method to get certificate revocation list
113 * @param cloudGetCRLHandler function called by the stack on completion of request.
114 * @throws OcException
116 public native void getCRL(GetCRLListener cloudGetCRLHandler)
120 * Method to post the certificate revocation list to cloud
121 * @param thisUpdate thisUpdate [mandatory param].
122 * @param nextUpdate nextUpdate [mandatory param].
123 * @param crl revocation list [optional].
124 * @param serialNumbers [optional].
125 * @param cloudPostCRLHandler function called by the stack on completion of request.
126 * @throws OcException
128 public native void postCRL0(String thisUpdate, String nextUpdate, String crl, ArrayList<String> serialNumbers,
129 PostCRLListener cloudPostCRLHandler) throws OcException;