From 7e482568c14c1a9967e478b53529db3480b3b090 Mon Sep 17 00:00:00 2001 From: Randeep Singh Date: Fri, 2 Sep 2016 17:05:18 +0530 Subject: [PATCH] Added Cloud provisioning java class Change-Id: I57a37af84f2202051d99627cfbc18bad6de5d8e4 Signed-off-by: Randeep Singh Reviewed-on: https://gerrit.iotivity.org/gerrit/11339 Reviewed-by: sandeep sharma Tested-by: jenkins-iotivity --- .../org/iotivity/base/OcCloudProvisioning.java | 131 +++++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100755 android/android_api/base/src/main/java/org/iotivity/base/OcCloudProvisioning.java diff --git a/android/android_api/base/src/main/java/org/iotivity/base/OcCloudProvisioning.java b/android/android_api/base/src/main/java/org/iotivity/base/OcCloudProvisioning.java new file mode 100755 index 0000000..9b73305 --- /dev/null +++ b/android/android_api/base/src/main/java/org/iotivity/base/OcCloudProvisioning.java @@ -0,0 +1,131 @@ +/* + ******************************************************************* + * + * Copyright 2016 Samsung Electronics All Rights Reserved. + * + *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= + */ + +package org.iotivity.base; + +import java.util.List; +import java.util.EnumSet; +import java.util.Map; +import java.util.ArrayList; + + + +/** + * OcCloudProvisioning class is responsible for providing methods for cloud + * provisioning. + */ +public class OcCloudProvisioning { + + private long mNativeHandle; + private String mIp; + private int mPort; + + /** + * API to construct the CloudProvisioning + * + * @param ipAddr address of the cloud server + * @param port port of the cloud server + */ + public OcCloudProvisioning(String ip, int port) { + this.mIp = ip; + this.mPort = port; + } + + public String getIP() { + return mIp; + } + + public int getPort() { + return mPort; + } + + private void setNativeHandle(long nativeHandle) { + this.mNativeHandle = nativeHandle; + } + + public interface RequestCertificateListener { + public void requestCertificateListener(boolean result); + } + + public interface GetAclIdByDeviceListener { + public void getAclIdByDeviceListener(boolean result,String aclId); + } + + public interface GetIndividualAclInfoListener { + public void getIndividualAclInfoListener(boolean result); + } + + public interface GetCRLListener { + public void getCRLListener(boolean result); + } + + public interface PostCRLListener { + public void postCRLListener(boolean result); + } + + /** + * Method to Request a certificate from the cloud + * @param certificateIssueRequestListener function called by the stack on completion of request. + * @throws OcException + */ + public native void requestCertificate( + RequestCertificateListener certificateIssueRequestListener) throws OcException; + + /** + * Method to get ACL ID for the device + * @param deviceId device ID for which the Acl ID is requested + * @param cloudAclIdGetByDeviceHandler function called by the stack on completion of request. + * @throws OcException + */ + public native void getAclIdByDevice(String deviceId, + GetAclIdByDeviceListener cloudAclIdGetByDeviceHandler) throws OcException; + + /** + * Method to get ACL information about the given Acl ID + * @param aclId ACL ID for which the Acl information is requested + * @param cloudAclIndividualGetInfoHandler function called by the stack on completion of request. + * @throws OcException + */ + public native void getIndividualAclInfo(String aclId, + GetIndividualAclInfoListener cloudAclIndividualGetInfoHandler) throws OcException; + + /** + * Method to get certificate revocation list + * @param cloudGetCRLHandler function called by the stack on completion of request. + * @throws OcException + */ + public native void getCRL(GetCRLListener cloudGetCRLHandler) + throws OcException; + + /** + * Method to post the certificate revocation list to cloud + * @param thisUpdate thisUpdate [mandatory param]. + * @param nextUpdate nextUpdate [mandatory param]. + * @param crl revocation list [optional]. + * @param serialNumbers [optional]. + * @param cloudPostCRLHandler function called by the stack on completion of request. + * @throws OcException + */ + public native void postCRL0(String thisUpdate, String nextUpdate, String crl, ArrayList serialNumbers, + PostCRLListener cloudPostCRLHandler) throws OcException; +} + -- 2.7.4