| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.JsonElement;
|
| | | import com.google.gson.JsonObject;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.mm.android.deviceaddmodule.LCDeviceEngine;
|
| | | import com.mm.android.deviceaddmodule.device_wifi.CurWifiInfo;
|
| | | import com.mm.android.deviceaddmodule.device_wifi.WifiConfig;
|
| | |
| | | import org.json.JSONObject;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | public class DeviceAddOpenApiManager {
|
| | | private static int TIME_OUT = 10 * 1000;
|
| | |
| | | HashMap<String, Object> paramsMap = new HashMap<String, Object>();
|
| | | paramsMap.put("token", bindDeviceData.data.token);
|
| | | paramsMap.put("deviceId", bindDeviceData.data.deviceId);
|
| | | paramsMap.put("code", bindDeviceData.data.code);
|
| | | JsonObject json = HttpSend.execute(paramsMap, CONST.METHOD_BINDDEVICE,DMS_TIME_OUT);
|
| | | BindDeviceData.Response response = new BindDeviceData.Response();
|
| | | response.parseData(json);
|
| | | return response;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 绑定设备
|
| | | *
|
| | | * @param bindDeviceData
|
| | | * @return
|
| | | * @throws BusinessException
|
| | | */
|
| | | public static BindDeviceData.Response hdlUserDeviceBind(BindDeviceData bindDeviceData) throws BusinessException {
|
| | | HashMap<String, Object> paramsMap = new HashMap<String, Object>();
|
| | | paramsMap.put("deviceId", bindDeviceData.data.deviceId);
|
| | | paramsMap.put("spk","security.ipcam.imou");
|
| | | paramsMap.put("code", bindDeviceData.data.code);
|
| | | JsonObject json = HttpSend.execute(paramsMap, CONST.METHOD_BINDDEVICE,DMS_TIME_OUT);
|
| | | BindDeviceData.Response response = new BindDeviceData.Response();
|
| | |
| | | return json.get("openid").getAsString();
|
| | | }
|
| | |
|
| | | public static boolean addPolicy(AddDevicePolicyData req)throws BusinessException{
|
| | | String jsonParam = new Gson().toJson(req);
|
| | | HttpSend.execute(jsonParam, CONST.ADD_POLICY,TIME_OUT);
|
| | | return true;
|
| | | public static boolean addPolicy(AddDevicePolicyData req)throws BusinessException {
|
| | | // String jsonParam = new Gson().toJson(req);
|
| | | // HttpSend.execute(jsonParam, CONST.ADD_POLICY,TIME_OUT);
|
| | | // return true;
|
| | |
|
| | | final Map<String, Object> map = new Gson().fromJson(new Gson().toJson(req), new TypeToken<Map<String, String>>() {
|
| | | }.getType());
|
| | |
|
| | | JsonObject json = HttpSend.execute(map, CONST.CREATE_SUB_ACCOUNT, TIME_OUT);
|
| | | return true;
|
| | | }
|
| | | }
|