|
|
@@ -49,6 +49,7 @@ import com.ntels.kneet.v3.common.websocket.WebSocketService;
|
|
|
import com.ntels.kneet.v3.common.websocket.onWebSocketResponse;
|
|
|
import com.ntels.kneet.v3.model.Configuration;
|
|
|
import com.ntels.kneet.v3.model.Device;
|
|
|
+import com.ntels.kneet.v3.model.ParentModel;
|
|
|
import com.ntels.kneet.v3.view.dialog.CustomDialog;
|
|
|
import com.ntels.kneet.v3.view.dialog.Dialog_Custom_List;
|
|
|
|
|
|
@@ -922,32 +923,65 @@ public class Fragment_Things extends Fragment implements View.OnClickListener,
|
|
|
*/
|
|
|
private void send_D_cloud_devices_device_id_nodes_node_id() {
|
|
|
|
|
|
- String url = appConfig.getUrl() + util.getString(act, R.string.API_VERSION) +
|
|
|
+ String url = appConfig.getCloudGatewayUrl() + util.getString(act, R.string.CLOUD_API_VERSION) +
|
|
|
util.getString(act, R.string.SEND_D_cloud_devices_device_id_nodes_node_id);
|
|
|
- String param = "";
|
|
|
String requestUrl = "";
|
|
|
|
|
|
try {
|
|
|
- url = util.convGetRestReplace(url, Constants.HTTP_device_id, sCall_HTTP_device_id);
|
|
|
- url = util.convGetRestReplace(url, Constants.HTTP_node_id, sCall_HTTP_node_id);
|
|
|
+ HashMap<String, String> pathParams = new HashMap<>();
|
|
|
+ pathParams.put(Constants.HTTP_device_id, sCall_HTTP_device_id);
|
|
|
+ pathParams.put(Constants.HTTP_node_id, sCall_HTTP_node_id);
|
|
|
|
|
|
- HashMap<String, Object> mapParam = new HashMap<>();
|
|
|
- mapParam.put(Constants.HTTP_homegroup_id, appConfig.getSelect_Homegrp_Id());
|
|
|
- mapParam.put(Constants.HTTP_member_id, appConfig.getLogin_Member_Id());
|
|
|
+ HashMap<String, Object> mapParams = new HashMap<>();
|
|
|
+ mapParams.put(Constants.HTTP_homegroup_id, appConfig.getSelect_Homegrp_Id());
|
|
|
+ mapParams.put(Constants.HTTP_member_id, appConfig.getLogin_Member_Id());
|
|
|
|
|
|
- param = util.convGetParam(mapParam);
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
+ requestUrl = HttpRequester.builder(act).makeRequestUrl(url, pathParams, mapParams);
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
customDialog.MsgAlert(act, Constants.MSG807);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- requestUrl = url + param;
|
|
|
LogUtil.i(TAG, "Request url : " + requestUrl);
|
|
|
|
|
|
+ HttpRequester.builder(act)
|
|
|
+ .delete(requestUrl)
|
|
|
+ .withTargetClass(ParentModel.class)
|
|
|
+ .withListener(new Listener<ParentModel>() {
|
|
|
+ @Override
|
|
|
+ public void onResponse(ParentModel response) {
|
|
|
+ LogUtil.i(TAG, "cloud node delete result code : " + response.getResultCode());
|
|
|
+ if (response.getResultCode().equals("00")) {
|
|
|
+ intent = new Intent(act, Things_Device_Del_03.class);
|
|
|
+ util.callActivityForResultNoAnim(act, intent, Constants.ACT_THINGS_DEVICE_DEL_03);
|
|
|
+ } else {
|
|
|
+ customDialog.MsgAlert(act, Constants.MSG000, "[" + response.getResultCode() + "] " + response.getResultMsg());
|
|
|
+ onListReload();
|
|
|
+ }
|
|
|
+ swipeRefreshLayout.setRefreshing(false);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .withErrorListener(new ErrorListener() {
|
|
|
+ @Override
|
|
|
+ public void onErrorResponse(VolleyError error) {
|
|
|
|
|
|
+ if (null != error) {
|
|
|
+ LogUtil.e(TAG, "error.getMessage() : " + "[" + error.networkResponse.statusCode + "]" + error.getMessage());
|
|
|
+ try {
|
|
|
+ LogUtil.i(TAG, new String(error.networkResponse.data, "UTF-8"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ swipeRefreshLayout.setRefreshing(false);
|
|
|
+ customDialog.MsgAlert(act, Constants.MSG807);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .withDialog(!swipeRefreshLayout.isRefreshing())
|
|
|
+ .execute();
|
|
|
|
|
|
- try {
|
|
|
+ /*try {
|
|
|
HttpSend httpSend;
|
|
|
|
|
|
httpSend = new HttpSend(act, !swipeRefreshLayout.isRefreshing());
|
|
|
@@ -963,7 +997,7 @@ public class Fragment_Things extends Fragment implements View.OnClickListener,
|
|
|
appConfig.getSelect_Homegrp_Id(), appConfig.getLogin_Member_Id());
|
|
|
} catch (Exception ex) {
|
|
|
ex.printStackTrace();
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
/**
|