+
+ /**
+ * Create an account manager object that can be used for doing request to account server.
+ * You can only create this object if OCPlatform was initialized to be a Client or
+ * Client/Server. Otherwise, this will return an empty shared ptr.
+ *
+ * @note For now, OCPlatform SHOULD be initialized to be a Client/Server(Both) for the
+ * methods of this object to work since device id is not generated on Client mode.
+ *
+ * @param host Host IP Address of a account server.
+ * @param connectivityTypeSet Set of types of connectivity. Example: CT_ADAPTER_IP
+ * @return new AccountManager object
+ * @throws OcException if failure
+ */
+ public static OcAccountManager constructAccountManagerObject(
+ String host,
+ EnumSet<OcConnectivityType> connectivityTypeSet) throws OcException {
+ OcPlatform.initCheck();
+ int connTypeInt = 0;
+
+ for (OcConnectivityType connType : OcConnectivityType.values()) {
+ if (connectivityTypeSet.contains(connType))
+ {
+ connTypeInt |= connType.getValue();
+ }
+ }
+ return OcPlatform.constructAccountManagerObject0(
+ host,
+ connTypeInt
+ );
+ }
+
+ private static native OcAccountManager constructAccountManagerObject0(
+ String host,
+ int connectivityType) throws OcException;
+ /**
+ * Method to get device Id in byte array.
+ * @return My DeviceId.
+ */
+ public static native byte[] getDeviceId();
+
+ /**
+ * Method to set DeviceId.
+ */
+ public static native void setDeviceId(byte[] deviceId) throws OcException;
+
+ /**
+ * gets OCRepresentation of KeepAlive resource from given host.
+ *
+ * @param host Host IP Address of pingResource
+ * @param onKeepAliveFoundListener Function to callback with result code and OCRepresentation.
+ * @throws OcException if failure
+ */
+ public static void findKeepAliveResource(String host,
+ KeepAliveListener onKeepAliveFoundListener)
+ throws OcException {
+ OcPlatform.initCheck();
+ OcPlatform.findKeepAliveResourceImpl(host, onKeepAliveFoundListener);
+ }
+
+ private static native void findKeepAliveResourceImpl(String host,
+ KeepAliveListener onKeepAliveFoundListener)
+ throws OcException;
+
+ /**
+ * send KeepAlive request to given host.
+ *
+ * @param interval interval time of expected pong response
+ * @param keepAliveResponseListener handles callback
+ * @throws OcException if failure
+ *
+ */
+ public static void sendKeepAliveRequest(String host, OcRepresentation ocRepresentation,
+ KeepAliveListener keepAliveResponseListener)
+ throws OcException {
+ OcPlatform.initCheck();
+ OcPlatform.sendKeepAliveRequestImpl(host, ocRepresentation, keepAliveResponseListener);
+ }
+
+ private static native void sendKeepAliveRequestImpl(String host,
+ OcRepresentation ocRepresentation,
+ KeepAliveListener keepAliveResponseListener)
+ throws OcException;