X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=android%2Fandroid_api%2Fbase%2Fsrc%2Fmain%2Fjava%2Forg%2Fiotivity%2Fbase%2FOcPlatform.java;h=516022120a1582df19b9a4d02e4ff7362fe0f31b;hb=a942f3c9ab2adb06d953dc99fb375399b7b82d61;hp=6fd9d313c1171d6a96a9dda969a37112d76af3a0;hpb=961bb5970c6a95cab134d51dc399a45c39f27393;p=platform%2Fupstream%2Fiotivity.git diff --git a/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java b/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java index 6fd9d31..5160221 100644 --- a/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java +++ b/android/android_api/base/src/main/java/org/iotivity/base/OcPlatform.java @@ -1340,4 +1340,39 @@ public final class OcPlatform { OcPlatform.initCheck(); return sPlatformQualityOfService; } + + /** + * 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 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; }