public class CloudPropProvisioningStatus
{
private ESResult m_result;
- private ESCloudProvState m_esCloudState;
/**
* Constructor
*
* @see ESCloudProvState
*/
- public CloudPropProvisioningStatus(int result, int state)
+ public CloudPropProvisioningStatus(int result)
{
m_result = ESResult.fromInt(result);
- m_esCloudState = ESCloudProvState.fromInt(state);
}
/**
{
return m_result;
}
-
- /**
- * Get a state of cloud property provisioning
- *
- * @result ESCloudProvState a state of cloud property provisioning
- *
- * @see ESCloudProvState
- */
- public ESCloudProvState getESCloudState()
- {
- return m_esCloudState;
- }
};
* It defines an result during easy setup process, which is same as one in Easy Setup C++ SDK
*/
public enum ESResult {
- ES_ERROR(-1),
+
ES_OK(0),
- ES_NETWORKFOUND(1),
- ES_NETWORKCONNECTED(2),
- ES_NETWORKNOTCONNECTED(3),
- ES_RESOURCECREATED(11),
- ES_RECVREQOFPROVRES(21),
- ES_RECVREQOFNETRES(22),
- ES_RECVUPDATEOFPROVRES(23),
- ES_RECVTRIGGEROFPROVRES(24),
- ES_UNAUTHORIZED(25);
+ ES_FOUND_ENROLLEE(1),
+ ES_NOT_FOUND_ENROLLEE(11),
+ ES_SEC_OPERATION_IS_NOT_SUPPORTED(20),
+ ES_UNAUTHORIZED_REQ(21),
+ ES_SEC_PROVISION_FAILS(22),
+ ES_ERROR(255);
private int value;
}
ESResult esResult = cloudPropProvisioningStatus->getESResult();
- ESCloudProvState cloudProvisionState = cloudPropProvisioningStatus->getESCloudState();
//create the java object
jobject jCloudPropProvisioningStatus = NULL;
jCloudPropProvisioningStatus = env->NewObject(g_cls_CloudPropProvisioningStatus,
g_mid_CloudPropProvisioningStatus_ctor,
- (jint)esResult,
- (jint)cloudProvisionState);
+ (jint)esResult);
- ES_LOGI("JniCloudPropProvisioningStatus::onCloudPropProvisioningStatus - %d, %d", esResult, cloudProvisionState);
+ ES_LOGI("JniCloudPropProvisioningStatus::onCloudPropProvisioningStatus - %d", esResult);
if (!jCloudPropProvisioningStatus)
{
ES_LOGE("JniCloudPropProvisioningStatus::onCloudPropProvisioningStatus Unable to create the java object");
bool needRemoveListener = false;
- if(cloudProvisionState == ES_CLOUD_PROVISIONING_ERROR ||
- cloudProvisionState == ES_CLOUD_PROVISIONING_SUCCESS )
+ if(esResult == ES_OK)
{
needRemoveListener = true;
}
return;
}
- int nativeESResult = convertNativeDeviceProvResultToInt(devicePropProvStatusCb->getESResult());
+ ESResult esResult = devicePropProvStatusCb->getESResult();
jobject jDevicePropProvisioningStatus = NULL;
jDevicePropProvisioningStatus = env->NewObject(g_cls_DevicePropProvisioningStatus,
g_mid_DevicePropProvisioningStatus_ctor,
- (jint)nativeESResult);
+ (jint)esResult);
- ES_LOGI("JniDevicePropProvisioningStatus::onDevicePropProvisioningStatus - %d", nativeESResult);
+ ES_LOGI("JniDevicePropProvisioningStatus::onDevicePropProvisioningStatus - %d", esResult);
if (!jDevicePropProvisioningStatus)
{
ES_LOGE("JniDevicePropProvisioningStatus::onDevicePropProvisioningStatus Unable to create the java object");
case WIFI_MODE::WIFI_11AC:
return 4;
}
-}
-
-int convertNativeDeviceProvResultToInt(ESResult nativeResult)
-{
- switch (nativeResult)
- {
- case ESResult::ES_ERROR:
- return -1;
- case ESResult::ES_OK:
- return 0;
- case ESResult::ES_NETWORKFOUND:
- return 1;
- case ESResult::ES_NETWORKCONNECTED:
- return 2;
- case ESResult::ES_NETWORKNOTCONNECTED:
- return 3;
- case ESResult::ES_RESOURCECREATED:
- return 11;
- case ESResult::ES_RECVREQOFPROVRES:
- return 21;
- case ESResult::ES_RECVREQOFNETRES:
- return 22;
- case ESResult::ES_RECVUPDATEOFPROVRES:
- return 23;
- case ESResult::ES_RECVTRIGGEROFPROVRES:
- return 24;
- case ESResult::ES_UNAUTHORIZED:
- return 31;
- }
}
\ No newline at end of file
WIFI_ENCTYPE getWifiEncTypeFromInt(int encType);
int convertNativeWifiFreqToInt(WIFI_FREQ wifiFreq);
int convertNativeWifiModeToInt(WIFI_MODE wifiMode);
-int convertNativeDeviceProvResultToInt(ESResult nativeResult);
#endif //__JNI_ES_UTILS_H_
env->DeleteLocalRef(clazz);
g_mid_CloudPropProvisioningStatus_ctor = env->GetMethodID(g_cls_CloudPropProvisioningStatus, "<init>",
- "(II)V");
+ "(I)V");
if (!g_mid_CloudPropProvisioningStatus_ctor) return JNI_ERR;
// Integer
else if(result.equals(ESResult.ES_ERROR)) {
mProvisionDevPropState.setText("Failed");
}
- else if(result.equals(ESResult.ES_UNAUTHORIZED)) {
+ else if(result.equals(ESResult.ES_UNAUTHORIZED_REQ)) {
mProvisionDevPropState.setText("Failed. Need SecProv");
}
mStartProvisionDevProp.setEnabled(true);
@Override
public void onProgress(CloudPropProvisioningStatus cloudProvisioningStatus) {
final ESResult result = cloudProvisioningStatus.getESResult();
- final ESCloudProvState state = cloudProvisioningStatus.getESCloudState();
runOnUiThread(new Runnable() {
@Override
public void run() {
- if(result.equals(ESResult.ES_OK)) {
- if(state.equals(ESCloudProvState.ES_CLOUD_ENROLLEE_FOUND)) {
- mProvisionCloudPropState.setText("Found Resource");
- }
- else if(state.equals(ESCloudProvState.ES_CLOUD_PROVISIONING_SUCCESS)) {
- mProvisionCloudPropState.setText("Success");
- }
+ if(result.equals(ESResult.ES_FOUND_ENROLLEE)) {
+ mProvisionCloudPropState.setText("Found Resource");
+ }
+ else if(result.equals(ESResult.ES_NOT_FOUND_ENROLLEE)) {
+ mProvisionCloudPropState.setText("Not Found Resource");
+ }
+ else if(result.equals(ESResult.ES_OK)) {
+ mProvisionCloudPropState.setText("Cloud Provisioning succeeds");
}
else {
- if(state.equals(ESCloudProvState.ES_CLOUD_ENROLLEE_NOT_FOUND)) {
- mProvisionCloudPropState.setText("Not Found Resource");
- }
- else if(state.equals(ESCloudProvState.ES_CLOUD_PROVISIONING_ERROR)) {
- mProvisionCloudPropState.setText("Failed");
- }
- mStartProvisionCloudProp.setEnabled(true);
+ mProvisionCloudPropState.setText("Cloud Provisioning fails");
}
}
});