From 319d9cd6097e6d825bccd1d940c1609f4ffd6543 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期一, 26 二月 2024 13:30:09 +0800 Subject: [PATCH] 2024年02月26日13:28:31 --- /dev/null | 51 --------------------------------------------------- settings.gradle | 3 --- local.properties | 5 ++--- app/build.gradle | 1 - 4 files changed, 2 insertions(+), 58 deletions(-) diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/HDLLinkLocalSdk.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/HDLLinkLocalSdk.java deleted file mode 100644 index db9a046..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/HDLLinkLocalSdk.java +++ /dev/null @@ -1,3240 +0,0 @@ -package com.hdl.sdk.link; - -import android.content.Context; -import android.text.TextUtils; -import android.widget.Toast; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; -import com.hdl.linkpm.sdk.core.exception.HDLLinkCopyException; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.sdk.link.bean.GatewayLocationBean; -import com.hdl.sdk.link.bean.LinkGroupControlCreateBean; -import com.hdl.sdk.link.bean.LinkIrDeviceBean; -import com.hdl.sdk.link.bean.LinkOtaBean; -import com.hdl.sdk.link.bean.LinkSidNameBean; -import com.hdl.sdk.link.bean.MMWAreaBean; -import com.hdl.sdk.link.common.config.TopicConstant; -import com.hdl.sdk.link.common.exception.HDLLinkCode; -import com.hdl.sdk.link.common.exception.HDLLinkException; -import com.hdl.sdk.link.common.utils.ErrorUtils; -import com.hdl.sdk.link.common.utils.IdUtils; -import com.hdl.sdk.link.common.utils.LogUtils; -import com.hdl.sdk.link.common.utils.gson.GsonConvert; -import com.hdl.sdk.link.bean.LinkCreateLogicBean; -import com.hdl.sdk.link.bean.LinkCreateSceneBean; -import com.hdl.sdk.link.bean.LinkEnableLogicBean; -import com.hdl.sdk.link.bean.LinkEnableSecurityBean; -import com.hdl.sdk.link.bean.LinkFunctionBean; -import com.hdl.sdk.link.bean.LinkLogicBean; -import com.hdl.sdk.link.bean.LinkOidBean; -import com.hdl.sdk.link.bean.LinkReNameGWBean; -import com.hdl.sdk.link.bean.LinkRoomBean; -import com.hdl.sdk.link.bean.LinkRoomBindBean; -import com.hdl.sdk.link.bean.LinkSceneBean; -import com.hdl.sdk.link.bean.LinkSidStrBean; -import com.hdl.sdk.link.bean.LinkSidUidBean; -import com.hdl.sdk.link.core.bean.FileRequest; -import com.hdl.sdk.link.core.bean.LinkRequest; -import com.hdl.sdk.link.core.bean.LinkResponse; -import com.hdl.sdk.link.core.bean.request.AuthenticateRequest; -import com.hdl.sdk.link.core.bean.request.DeviceControlRequest; -import com.hdl.sdk.link.core.bean.request.FunctionAttributeRequest; -import com.hdl.sdk.link.core.bean.request.PropertyReadRequest; -import com.hdl.sdk.link.core.bean.response.BaseLocalResponse; -import com.hdl.sdk.link.core.bean.scenebatch.SceneCanDeleteInfo; -import com.hdl.sdk.link.core.bean.scenebatch.SceneGroupInfo; -import com.hdl.sdk.link.core.callback.GatewayCallBack; -import com.hdl.sdk.link.core.callback.HDLLinkCallBack; -import com.hdl.sdk.link.core.callback.HDLLinkResponseCallBack; -import com.hdl.sdk.link.common.event.EventDispatcher; -import com.hdl.sdk.link.common.event.EventListener; -import com.hdl.sdk.link.core.callback.HDLLinkTCallBack; -import com.hdl.sdk.link.core.config.HDLLinkConfig; -import com.hdl.sdk.link.core.connect.HDLUdpConnect; -import com.hdl.sdk.link.core.bean.gateway.GatewayBean; -import com.hdl.sdk.link.core.connect.HDLConnectHelper; -import com.hdl.sdk.link.core.utils.LinkResponseUtils; -import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; - -import java.lang.reflect.Type; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -/** - * Created by jlchen on 11/15/21. - * - * @Description : HDLLink - */ -public class HDLLinkLocalSdk { - /** - * instance - */ - private volatile static HDLLinkLocalSdk instance; - - /** - * getInstance - * - * @return HDLLink - */ - public static synchronized HDLLinkLocalSdk getInstance() { - if (instance == null) { - synchronized (HDLLinkLocalSdk.class) { - if (instance == null) { - instance = new HDLLinkLocalSdk(); - } - } - } - return instance; - } - - private static Context context; - - - public void init(Context context) { - this.context = context.getApplicationContext(); - - String[] gatewayErrors = context.getResources().getStringArray(R.array.gateway); - Map<String, String> codeAndMsgMap = new HashMap<>(); - for (String gatewayError : gatewayErrors) { - String codeMsg[] = gatewayError.split("="); - codeAndMsgMap.put(codeMsg[0], codeMsg[1]); - } - //鍒濆鍖栫姸鎬佺爜澶氳瑷�淇℃伅 - ErrorUtils.errorsMap.putAll(codeAndMsgMap); - } - - public Context getContext() { - return context; - } - - public boolean isZh() { - Locale locale = getContext().getResources().getConfiguration().locale; - String language = locale.getLanguage(); - if (language.endsWith("zh")) - return true; - else - return false; - } - - public static void showToast(String msg){ -// runOnUiThread(new Runnable() { -// @Override -// public void run() { -// try { -// if (toast == null) { -// toast = Toast.makeText(HDLGlobal.getInstance().getContext(), message, Toast.LENGTH_SHORT); -// } else { -// toast.setText(message); -// } -// toast.show(); -// } catch (Exception ignored) { -// -// } -// } -// -// }); - Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); - } - - /** - * 璁剧疆鎵撳嵃鏄惁寮�鍚� - * - * @param enable - */ - public void setLogEnabled(boolean enable) { - LogUtils.setEnabled(enable); - } - - /** - * 娉ㄥ唽鎵�鏈変富棰樻秷鎭殑鐩戝惉 - * - * @param listener - */ - public synchronized void registerAllTopicsListener(EventListener listener) { - EventDispatcher.getInstance().registerAllTopicsListener(listener); - } - - /** - * 鍙栨秷鎵�鏈変富棰樻秷鎭殑鐩戝惉 - * - * @param listener - */ - public synchronized void removeAllTopicsListener(EventListener listener) { - if (listener == null) return; - EventDispatcher.getInstance().removeAllTopicsListener(listener); - } - - /***********************涓夋柟璁惧鍜岀綉鍏抽�氫俊涔嬪墠鐨勮璇佹祦绋�****************************/ - /** - * 妫�娴嬫槸鍚﹀凡缁忚璇佽繃 - * 璁よ瘉閫氳繃鎵嶈兘杩涜璁惧鎺у埗 - * - * @return - */ - public boolean checkIfCertified() { - return HDLLinkConfig.getInstance().checkIfCertified(); - } - - /** - * 寮�濮嬬洃鍚拰鍙戣捣鍏ョ綉鍙婅璇佽姹� - * - * @param request 璁よ瘉璇锋眰淇℃伅 - * @param callBack 缁撴灉鍥炶皟 - */ - public void startAuthenticateRequest(AuthenticateRequest request, HDLLinkCallBack callBack) { - HDLUdpConnect.getInstance().startAuthenticateRequest(request, callBack); - } - - /** - * 鍙戦�佸叆缃戝強璁よ瘉璇锋眰 - * - * @param ip 缃戝叧IP - * @param request 璁よ瘉璇锋眰淇℃伅 - * @param callBack 缁撴灉鍥炶皟 - */ - public void sendAuthenticateRequest(String ip, AuthenticateRequest request, HDLLinkCallBack callBack) { - HDLUdpConnect.getInstance().sendAuthenticateRequest(ip, request, callBack); - } - - /***********************涓夋柟璁惧璇峰厛璁よ瘉鎴愬姛 鍐嶈皟鐢ㄤ笅闈㈢殑鎺ュ彛鍜岀綉鍏抽�氫俊****************************/ - /** - * 缁勬挱鎼滅储鎸囧畾缃戝叧鏄惁鍦ㄧ嚎锛屾悳绱㈠埌鍒欒繑鍥炴寚瀹氱殑缃戝叧瀵硅薄 - * - * @param callBack 鍥炶皟 - */ - public void searchGatewayMulticast(HDLUdpConnect.SearchGatewayCallBack callBack) { - HDLUdpConnect.getInstance().searchGatewayMulticast(callBack); - } - - /** - * 缁勬挱鎼滅储鎸囧畾缃戝叧鏄惁鍦ㄧ嚎锛屾悳绱㈠埌鍒欒繑鍥炴寚瀹氱殑缃戝叧瀵硅薄 - * - * @param callBack 鍥炶皟 - */ - public void searchGatewayBroadcast(HDLUdpConnect.SearchGatewayCallBack callBack) { - HDLUdpConnect.getInstance().searchGatewayBroadcast(callBack); - } - - /** - * 鑾峰彇璁惧鍒楄〃 - */ - public void getDeviceList(HDLLinkTCallBack<List<LinkOidBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - String topic = String.format(TopicConstant.GET_DEVICE_LIST, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getDeviceList onSuccess"); - Type type = new TypeToken<BaseLocalResponse<List<LinkOidBean>>>() { - }.getType(); - List<LinkOidBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 绾㈠瀹�/閬ユ帶鍣ㄥ畾浣� - */ - public void locationIr(String sid, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - List<JSONObject> stringList = new ArrayList<>(); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("sid", sid); - jsonObject1.put("duration_time", "5"); - stringList.add(jsonObject1); - jsonObject.put("objects", stringList); - String topic = String.format(TopicConstant.IR_FIND_REMOTE, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("locationIr onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 绾㈠瀹濆垹闄わ紙閲囩敤link鍗忚閫氱煡鍒犻櫎骞堕��缃戝瓙璁惧鎷撴墤鍏崇郴锛� - */ - public void deleteLinkDevice(String oid, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - List<JSONObject> stringList = new ArrayList<>(); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("oid", oid); - stringList.add(jsonObject1); - jsonObject.put("objects", stringList); - String topic = String.format(TopicConstant.DELETING_GATEWAY_SLAVE, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("deleteLinkDevice onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 閬ユ帶鍣ㄥ垹闄わ紙閲囩敤link鍗忚閫氱煡鍒犻櫎骞堕��缃戝瓙璁惧鎷撴墤鍏崇郴锛� - */ - public void deleteIrControlDevice(String sid, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - List<JSONObject> stringList = new ArrayList<>(); - JSONObject jsonObject1 = new JSONObject(); - jsonObject1.put("sid", sid); - stringList.add(jsonObject1); - jsonObject.put("objects", stringList); - String topic = String.format(TopicConstant.DELETING_GATEWAY_SLAVE, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("deleteIrControlDevice onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 璁惧鎺у埗 - */ - public void controlDevice(Object object, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - List<Object> stringList = new ArrayList<>(); - stringList.add(object); - jsonObject.put("objects", stringList); - String topic = String.format(TopicConstant.PROPERTY_DOWN, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("controlDevice onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - public void controlDevice(Object object, String gatewayId, String ipAddress, String mac, boolean encrypt, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - List<Object> stringList = new ArrayList<>(); - stringList.add(object); - jsonObject.put("objects", stringList); - String topic = String.format(TopicConstant.PROPERTY_DOWN, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), encrypt); - new HDLConnectHelper(ipAddress, request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("controlDevice onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true, mac).send(); - } - - /** - * 鏇存敼涓荤綉鍏冲娉ㄥ悕 - */ - public void changeGWName(String gateWayName, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<LinkReNameGWBean> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - LinkReNameGWBean linkReNameGWBean = new LinkReNameGWBean(); - linkReNameGWBean.setDevice_name(gateWayName); - data.setObjects(linkReNameGWBean); - String topic = String.format(TopicConstant.GATEWAY_RENAME, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("changeGWName onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鏇存敼浠庣綉鍏冲娉ㄥ悕 - */ - public void changeCongGWName(String gateWayName, String gatewayId, String ipAddress, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<LinkReNameGWBean> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - LinkReNameGWBean linkReNameGWBean = new LinkReNameGWBean(); - linkReNameGWBean.setDevice_name(gateWayName); - data.setObjects(linkReNameGWBean); - String topic = String.format(TopicConstant.GATEWAY_RENAME, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - request.setCloudTopic(String.format(TopicConstant.NATIVE_LINK_DOWN_SLAVE, HDLLinkConfig.getInstance().getGatewayId(), gatewayId)); - new HDLConnectHelper(ipAddress, request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("changeCongGWName onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * sid鏇存敼鍚嶅瓧 - */ - public void sidNameChange(List<LinkSidNameBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidNameBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.EDIT_FUNCTION, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("sidNameChange onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - public void sidNameChange(List<LinkSidNameBean> bean, String gatewayId, String ipaddress, boolean isLocalEncrypt, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidNameBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.EDIT_FUNCTION, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), isLocalEncrypt); - new HDLConnectHelper(ipaddress, request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("sidNameChange onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } - - /** - * sid缁戝畾鎴块棿 - */ - public void sidBindUid(List<LinkSidUidBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidUidBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SID_BIND_ROOM, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("sidBindUid onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * sid缁戝畾鎴块棿 - */ - public void sidBindUid(List<LinkSidUidBean> bean, String gatewayId, String ipaddress, boolean isLocalEncrypt, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidUidBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SID_BIND_ROOM, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), isLocalEncrypt); - new HDLConnectHelper(ipaddress, request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("sidBindUid onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } - - /** - * sid鍒犻櫎缁戝畾鎴块棿鍏崇郴 - */ - public void sidDeleteUid(List<LinkSidUidBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidUidBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SID_DELETE_ROOM, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("sidDeleteUid onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍒涘缓鍦烘櫙 - */ - public void createScene(List<LinkCreateSceneBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkCreateSceneBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.CREATE_SCENE, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("createScene onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 缂栬緫鍦烘櫙 鎵归噺澶勭悊缁� - */ - public void editSceneBatchGroup(List<SceneGroupInfo> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<SceneGroupInfo>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SCENE_EDIT, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("editSceneBatchGroup onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 缂栬緫鍦烘櫙 鎵归噺澶勭悊鍒犻櫎 - */ - public void editSceneBatchDelete(List<SceneCanDeleteInfo> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<SceneCanDeleteInfo>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SCENE_EDIT, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("editSceneBatchDelete onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 缂栬緫鍦烘櫙 - */ - public void editScene(List<LinkCreateSceneBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkCreateSceneBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SCENE_EDIT, gatewayId); - for (int i = 0; i < data.getObjects().size(); i++) { - if (data.getObjects().get(i).getFunctions().size() == 0) { - data.getObjects().get(i).setFunctions(null); - } -// if (data.getObjects().get(i).getUids().size() == 0) { -// data.getObjects().get(i).setUids(null); -// } - } - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("editScene onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍒犻櫎鍦烘櫙 - */ - public void deleteScene(List<LinkSidStrBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidStrBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SCENE_DELETE, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("deleteScene onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鑾峰彇鑷姩鍖栧垪琛� - */ - public void getLogicList(HDLLinkTCallBack<List<LinkLogicBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - String topic = String.format(TopicConstant.LOGIC_LIST_GET, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getLogicList onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkLogicBean>>>() { - }.getType(); - List<LinkLogicBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鑾峰彇鑷姩鍖栬鎯� - */ - public void getLogicDetail(List<LinkSidStrBean> list, HDLLinkTCallBack<List<LinkCreateLogicBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidStrBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(list); - String topic = String.format(TopicConstant.LOGIC_GET, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getLogicDetail onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkCreateLogicBean>>>() { - }.getType(); - List<LinkCreateLogicBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鏂板缓鑷姩鍖� - */ - public void createLogic(List<LinkCreateLogicBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkCreateLogicBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.LOGIC_EDIT, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("createLogic onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 寮�鍚叧闂嚜鍔ㄥ寲 - */ - public void enableLogic(List<LinkEnableLogicBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkEnableLogicBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.LOGIC_ENABLE_EDIT, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("enableLogic onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍒犻櫎鑷姩鍖� - */ - public void deleteLogic(List<LinkSidStrBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidStrBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.LOGIC_DELETE, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("deleteLogic onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 绾㈠瀹濊瘯鐮� - */ - public void irCodeTest(JSONObject content, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - JSONArray jsonArray = new JSONArray(); - jsonArray.add(content); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - jsonObject.put("objects", jsonArray); - String topic = String.format(TopicConstant.IR_CODE_TEST, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("irCodeTest onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 绾㈠瀹濇坊鍔犻仴鎺у櫒 - */ - public void irDeviceAdd(JSONObject content, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - JSONArray jsonArray = new JSONArray(); - jsonArray.add(content); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - jsonObject.put("objects", jsonArray); - String topic = String.format(TopicConstant.IR_DEVICE_ADD, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneList onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 绾㈠瀹濊嚜瀛︾爜 - */ - public void irCodeStudy(JSONObject content, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - JSONArray jsonArray = new JSONArray(); - jsonArray.add(content); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - jsonObject.put("objects", jsonArray); - String topic = String.format(TopicConstant.IR_CODE_STUDY, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("irCodeStudy onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 绾㈠瀹濊嚜瀛︾爜鍒犻櫎 - */ - public void irCodeRemove(JSONObject content, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - JSONArray jsonArray = new JSONArray(); - jsonArray.add(content); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - jsonObject.put("objects", jsonArray); - String topic = String.format(TopicConstant.IR_CODE_REMOVE, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("irCodeRemove onSuccess"); - callBack.onSuccess(""); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 绾㈠瀹濋仴鎺у櫒鍒楄〃鑾峰彇 - */ - public void irDeviceList(JSONObject content, HDLLinkTCallBack<List<LinkIrDeviceBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JSONObject jsonObject = new JSONObject(); - JSONArray jsonArray = new JSONArray(); - jsonArray.add(content); - jsonObject.put("id", IdUtils.getUUId()); - jsonObject.put("time_stamp", time); - jsonObject.put("objects", jsonArray); - String topic = String.format(TopicConstant.IR_DEVICE_LIST, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("irDeviceList onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkIrDeviceBean>>>() { - }.getType(); - List<LinkIrDeviceBean> response = LinkResponseUtils.convertLinkResponse(msg, type); - if (response == null) { - callBack.onSuccess(new ArrayList<>()); - } else { - callBack.onSuccess(response); - } - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 鑾峰彇瀹夐槻鍒楄〃 - */ - public void getSecurityList(HDLLinkTCallBack<List<LinkLogicBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - - String topic = String.format(TopicConstant.SECURITY_LIST_GET, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSecurityList onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkLogicBean>>>() { - }.getType(); - List<LinkLogicBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鑾峰彇鑷姩鍖栬鎯� - */ - public void getSecurityDetail(List<LinkSidStrBean> list, HDLLinkTCallBack<List<LinkCreateLogicBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidStrBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(list); - - String topic = String.format(TopicConstant.SECURITY_GET, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSecurityDetail onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkCreateLogicBean>>>() { - }.getType(); - List<LinkCreateLogicBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鏂板缓瀹夐槻 - */ - public void createSecurity(List<LinkCreateLogicBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkCreateLogicBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SECURITY_EDIT, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("createSecurity onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍒犻櫎瀹夐槻 - */ - public void deleteSecurity(List<LinkSidStrBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidStrBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SECURITY_DELETE, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("deleteSecurity onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 寮�鍚叧闂嚜鍔ㄥ寲 - */ - public void enableSecurity(List<LinkEnableSecurityBean> bean, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkEnableSecurityBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(bean); - String topic = String.format(TopicConstant.SECURITY_STATUS_SET, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("enableSecurity onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 鑾峰彇鍔熻兘鍒楄〃 - */ - public void getFunctionList(HDLLinkTCallBack<List<LinkFunctionBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - - String topic = String.format(TopicConstant.GET_FUNCTION_LIST, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getFunctionList onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkFunctionBean>>>() { - }.getType(); - List<LinkFunctionBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 妯℃嫙浜戠ota - */ - public void otaDeviceUpgradeDown(String oid, String module, HDLLinkTCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkOtaBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - List<LinkOtaBean> bean = new ArrayList<>(); - LinkOtaBean linkOtaBean = new LinkOtaBean(); - linkOtaBean.setOid(oid); - linkOtaBean.setModule(module); - linkOtaBean.setSize(291710); - linkOtaBean.setSign_method("md5"); - linkOtaBean.setSign("05afc42e715b724e01b4ecd0ee2bde5d"); - linkOtaBean.setUrl("https://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/20/2023/05/37886160-375a-4bf0-8a32-4093dac38679.ota"); - linkOtaBean.setVersion("V02.04.16"); - bean.add(linkOtaBean); - data.setObjects(bean); - String topic = String.format(TopicConstant.OTA_UPGRADE_DOWN, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getFunctionList onSuccess"); - if (callBack != null) { - callBack.onSuccess("Success"); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 鏇存敼Sid澶囨敞鍚� - */ - public void editSidName(BaseLocalResponse<List<JsonObject>> data, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); -// LinkReNameGWBean linkReNameGWBean = new LinkReNameGWBean(); -// linkReNameGWBean.setDevice_name(sidName); -// data.setObjects(linkReNameGWBean); - String topic = String.format(TopicConstant.EDIT_FUNCTION_ATTRIBUTE, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("editSidName onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鑾峰彇鍔熻兘灞炴�� - * 鏀寔鎵归噺 - * - * @param sids - * @param callBack - */ - public void getFunctionAttribute(List<String> sids, HDLLinkTCallBack<List<LinkFunctionBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - - final BaseLocalResponse<List<FunctionAttributeRequest>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - List<FunctionAttributeRequest> list = new ArrayList<>(); - for (String s : sids) { - list.add(new FunctionAttributeRequest(s)); - } - data.setObjects(list); - - String topic = String.format(TopicConstant.GET_FUNCTION_ATTRIBUTE, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getFunctionAttribute onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkFunctionBean>>>() { - }.getType(); - List<LinkFunctionBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 璁惧鎺у埗 - * - * @param requestList 鎺у埗鐘舵�佸弬鏁� - * @param callBack 缁撴灉鍥炶皟 - */ - public void propertyDown(List<DeviceControlRequest> requestList, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - - final BaseLocalResponse<List<DeviceControlRequest>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(requestList); - String topic = String.format(TopicConstant.PROPERTY_DOWN, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyDown onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - - } - - /** - * 鏈嶅姟璋冪敤 - * - * @param topic 涓婚 - * @param callBack 鍥炶皟 - */ - public void serviceDown(String topic, JSONArray jsonArray, String ipAddress, boolean encrypt, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<JSONArray> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(jsonArray); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), encrypt); - new HDLConnectHelper(ipAddress, request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyRead onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } - - /** - * 鏈嶅姟璋冪敤 - * - * @param topic 涓婚 - * @param callBack 鍥炶皟 - */ - public void serviceDown(String topic, JSONArray jsonArray, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<JSONArray> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(jsonArray); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyRead onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 鏈嶅姟鐘舵�佽幏鍙� - * - * @param topic 涓婚 - * @param callBack 鍥炶皟 - */ - public void serviceRead(String topic, JSONArray jsonArray, String ipAddress, boolean encrypt, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<JSONArray> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(jsonArray); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), encrypt); - new HDLConnectHelper(ipAddress, request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyRead onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } - - /** - * 鏈嶅姟鐘舵�佽幏鍙� - * - * @param topic 涓婚 - * @param callBack 鍥炶皟 - */ - public void serviceRead(String topic, JSONArray jsonArray, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<JSONArray> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(jsonArray); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyRead onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鑾峰彇姣背娉㈠尯鍩� - * - * @param sid 璇锋眰鍙傛暟 鎸囧畾璇诲彇鐨勮澶噑id - * @param callBack 鍥炶皟 - */ - public void getMillimeterArea(String sid, HDLLinkTCallBack<List<MMWAreaBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<PropertyReadRequest>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - - List<PropertyReadRequest> list = new ArrayList<>(); - list.add(new PropertyReadRequest(sid)); - data.setObjects(list); - - String topic = String.format(TopicConstant.MMW_AREA_GET, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyRead onSuccess"); - Type type = new TypeToken<BaseLocalResponse<List<MMWAreaBean>>>() { - }.getType(); - List<MMWAreaBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 璇诲彇鐘舵�� - * - * @param sids 璇锋眰鍙傛暟 鎸囧畾璇诲彇鐨勮澶噑id鍒楄〃 - * @param callBack 鍥炶皟 - */ - public void propertyRead(List<String> sids, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<PropertyReadRequest>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - - List<PropertyReadRequest> list = new ArrayList<>(); - for (String s : sids) { - list.add(new PropertyReadRequest(s)); - } - data.setObjects(list); - - String topic = String.format(TopicConstant.PROPERTY_READ, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyRead onSuccess"); - Type type = new TypeToken<BaseLocalResponse<String>>() { - }.getType(); - String list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 璇诲彇鐘舵�� - * - * @param sids 璇锋眰鍙傛暟 鎸囧畾璇诲彇鐨勮澶噑id鍒楄〃 - * @param callBack 鍥炶皟 - */ - public void propertyRead(List<String> sids, String gatewayId, String ipAddress, String mac, boolean encrypt, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<PropertyReadRequest>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - - List<PropertyReadRequest> list = new ArrayList<>(); - for (String s : sids) { - list.add(new PropertyReadRequest(s)); - } - data.setObjects(list); - - String topic = String.format(TopicConstant.PROPERTY_READ, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), encrypt); - new HDLConnectHelper(ipAddress, request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("propertyRead onSuccess"); - Type type = new TypeToken<BaseLocalResponse<String>>() { - }.getType(); - String list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true, mac).send(); - } - - /** - * 鑾峰彇鍦烘櫙鍒楄〃 - */ - public void getSceneList(HDLLinkTCallBack<List<LinkSceneBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - - String topic = String.format(TopicConstant.SCENE_LIST_GET, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneList onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkSceneBean>>>() { - }.getType(); - List<LinkSceneBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - public void getSceneListaa(HDLLinkTCallBack<List<LinkSceneBean>> callBack) { - if (null == callBack) { - return; - } - - if (!TextUtils.isEmpty("18FE8588AC73E526")) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - - String topic = String.format(TopicConstant.SCENE_LIST_GET, "18FE8588AC73E526"); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper("192.168.1.100", request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneList onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkSceneBean>>>() { - }.getType(); - List<LinkSceneBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - public void getSceneListAiks(GatewayBean bean, HDLLinkTCallBack<List<LinkSceneBean>> callBack) { - if (null == callBack) { - return; - } - - if (!TextUtils.isEmpty(bean.getDevice_mac())) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - - String topic = String.format(TopicConstant.SCENE_LIST_GET, bean.getDevice_mac()); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), false); - new HDLConnectHelper(bean.getIp_address(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneList onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkSceneBean>>>() { - }.getType(); - List<LinkSceneBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鑾峰彇鍦烘櫙璇︽儏 - */ - public void getSceneDetail(List<LinkSidStrBean> list, HDLLinkTCallBack<List<LinkCreateSceneBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkSidStrBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(list); - String topic = String.format(TopicConstant.SCENE_GET, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneDetail onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkCreateSceneBean>>>() { - }.getType(); - List<LinkCreateSceneBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍦烘櫙鎺у埗 - * - * @param sids 鍦烘櫙sid鍒楄〃 - * @param callBack 鍥炶皟 - */ - public void controlScene(List<String> sids, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<PropertyReadRequest>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - - List<PropertyReadRequest> list = new ArrayList<>(); - for (String s : sids) { - list.add(new PropertyReadRequest(s)); - } - data.setObjects(list); - String topic = String.format(TopicConstant.SCENE_CONTROL, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("controlScene onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍦烘櫙鎺у埗 - * - * @param sids 鍦烘櫙sid鍒楄〃 - * @param callBack 鍥炶皟 - */ - public void controlAiksScene(GatewayBean bean, List<String> sids, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String device_mac = bean.getDevice_mac(); - if (!TextUtils.isEmpty(device_mac)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<PropertyReadRequest>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - - List<PropertyReadRequest> list = new ArrayList<>(); - for (String s : sids) { - list.add(new PropertyReadRequest(s)); - } - data.setObjects(list); - String topic = String.format(TopicConstant.SCENE_CONTROL, device_mac); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), false); - new HDLConnectHelper(bean.getIp_address(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("controlScene onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 缇ゆ帶澧炲垹 - */ - public void groupControlEdit(List<LinkGroupControlCreateBean> list, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkGroupControlCreateBean>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(list); - String topic = String.format(TopicConstant.GROUPCONTROL_EDIT, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneDetail onSuccess"); - if (callBack != null) { - callBack.onSuccess(msg.toString()); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 缇ゆ帶鎺у埗 - */ - public void groupControlControl(JSONObject object, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<JSONObject>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - List<JSONObject> objectList = new ArrayList<>(); - objectList.add(object); - data.setObjects(objectList); - String topic = String.format(TopicConstant.GROUPCONTROL_CONTROL, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneDetail onSuccess"); - if (callBack != null) { - callBack.onSuccess(msg.toString()); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 缇ゆ帶鍒犻櫎 - */ - public void groupControlDelete(JSONObject object, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<JSONObject>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - List<JSONObject> objectList = new ArrayList<>(); - objectList.add(object); - data.setObjects(objectList); - String topic = String.format(TopicConstant.GROUPCONTROL_DELETE, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneDetail onSuccess"); - if (callBack != null) { - callBack.onSuccess(msg.toString()); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - HDLLinkLocalSdk.showToast(hdlLinkCode.getMsg()); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 缇ゆ帶鍒楄〃鑾峰彇 - */ - public void getGroupControlList(List<JSONObject> list, HDLLinkTCallBack<List<LinkGroupControlCreateBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<JSONObject>> data = new BaseLocalResponse<>(); - data.setId(IdUtils.getUUId()); - data.setTime_stamp(time); - data.setObjects(list); - String topic = String.format(TopicConstant.GROUPCONTROL_LIST_GET, gatewayId); - - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(data), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getSceneDetail onSuccess"); - if (callBack != null) { - Type type = new TypeToken<BaseLocalResponse<List<LinkGroupControlCreateBean>>>() { - }.getType(); - List<LinkGroupControlCreateBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 閫氱敤UDP鍙戦�佹寚浠� - * 1绉掓病鍝嶅簲灏辫浠栭噸鏂板彂閫�,閲嶈瘯3娆� - * - * @param topic 鍙戦�佹暟鎹� - * @param bodyStr body鍐呭 - * @param callBack 鍥炶皟 - */ - public void udpSendMsg(String topic, String bodyStr, HDLLinkResponseCallBack callBack) { - HDLUdpConnect.getInstance().udpSendMsg(topic, bodyStr, false, callBack); - } - - /** - * 閫氱敤骞挎挱UDP鍙戦�佹寚浠� - * 1绉掓病鍝嶅簲灏辫浠栭噸鏂板彂閫�,閲嶈瘯3娆� - * - * @param topic 鍙戦�佹暟鎹� - * @param bodyStr body鍐呭 - * @param callBack 鍥炶皟 - */ - public void udpBroadcastSendMsg(String topic, String bodyStr, HDLLinkResponseCallBack callBack) { - HDLUdpConnect.getInstance().udpSendMsg(topic, bodyStr, true, callBack); - } - - /** - * 閫氱敤TCP鍙戦�佹寚浠� - * 1绉掓病鍝嶅簲灏辫浠栭噸鏂板彂閫�,閲嶈瘯3娆� - * - * @param topic 鍙戦�佹暟鎹� - * @param body body鍐呭 - * @param callBack 鍥炶皟 - */ - public void tcpSendMsg(String topic, String body, HDLLinkCallBack callBack) { - - LinkRequest request = new LinkRequest(topic, body, HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("sendMsg onSuccess"); - if (callBack != null) { - callBack.onSuccess(msg.toString()); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } - - /** - * 閫氱敤TCP鍙戦�佹寚浠� 鍙彂涓�娆★紝涓嶇洃鍚洖澶嶏紝涓嶉噸鍙� - * - * @param topic 鍙戦�佹暟鎹� - * @param body 鍥炲鐨勪富棰� - */ - public void tcpSendMsg(String topic, String body) { - LinkRequest request = new LinkRequest(topic, body, HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(1, HDLLinkConfig.getInstance().getIpAddress(), request, true); - } - - /** - * 鍒涙柊缃戝叧鍒楄〃锛岄噸鏂拌鍙� - * - * @param homeId 浣忓畢Id - * @param callBack 鍥炶皟鎵�鏈夎鍙栧埌鐨勭綉鍏冲垪琛� - */ - public void refreshGatewayByHome(String homeId, GatewayCallBack callBack) { - HDLLinkLocalGateway.getInstance().refreshGatewayByHome(homeId, callBack); - } - - /** - * 鍒涙柊缃戝叧鍒楄〃锛岄噸鏂拌鍙� - * - * @param callBack 鍥炶皟鎵�鏈夎鍙栧埌鐨勭綉鍏冲垪琛� - */ - public void refreshGateway(GatewayCallBack callBack) { - HDLLinkLocalGateway.getInstance().refreshGateway(callBack); - } - - public void refreshGateway(GatewayCallBack callBack,List<String> spks) { - HDLLinkLocalGateway.getInstance().refreshGateway(callBack,spks); - } - /** - * 鑾峰彇褰撳墠浣忓畢缂撳瓨鐨勬墍鏈夌綉鍏筹紝涓�鑸槸璋冭瘯杞欢浣跨敤锛屼笁鏂逛笉鐢ㄨ皟璇曟鏂规硶 - * 濡傛灉涔嬪墠杩樻病鏈夎鍙栬繃缃戝叧锛屽厛璋冪敤鏂规硶refreshGatewayByHome璇诲彇涓�娆� - * - * @return - */ - public List<GatewayBean> getGatewayByHome() { - return HDLLinkLocalGateway.getInstance().getGatewayList(); - } - - - /** - * 鑾峰彇鎴块棿鍒楄〃 - * - * @param callBack - */ - public void getRoomList(HDLLinkTCallBack<List<LinkRoomBean>> callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - - String topic = String.format(TopicConstant.ROOM_LIST_GET, gatewayId); - - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getRoomList onSuccess"); - Type type = new TypeToken<BaseLocalResponse<List<LinkRoomBean>>>() { - }.getType(); - List<LinkRoomBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍏ㄩ噺鏇存柊鎴块棿鍒楄〃 - * - * @param list - * @param callBack - */ - public void coverAddRoomList(List<LinkRoomBean> list, HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<List<LinkRoomBean>> senData = new BaseLocalResponse<>(); - senData.setId(IdUtils.getUUId()); - senData.setTime_stamp(time); - senData.setObjects(list); - - String topic = String.format(TopicConstant.ROOM_COVER_ADD, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(senData), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("coverAddRoomList onSuccess"); - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍏ㄩ噺鏇存柊鎴块棿鍒楄〃 - * - * @param callBack - */ - public void getGatewaylist(HDLLinkCallBack callBack) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - final BaseLocalResponse<JSONObject> senData = new BaseLocalResponse<>(); - senData.setId(IdUtils.getUUId()); - senData.setTime_stamp(time); - JSONObject jsonObject = new JSONObject(); - jsonObject.put("device_mac", "0C811A93EA13F1F5"); - senData.setObjects(jsonObject); - String topic = String.format(TopicConstant.GATEWAY_INFO, gatewayId); - LinkRequest request = new LinkRequest(topic, GsonConvert.getGson().toJson(senData), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - callBack.onSuccess(msg.toString()); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /** - * 鑾峰彇鎴块棿缁戝畾鍏崇郴 - */ - public void getRoomBindList(HDLLinkTCallBack<List<LinkRoomBindBean>> callBack, List<String> uidRoomList) { - if (null == callBack) { - return; - } - String gatewayId = HDLLinkConfig.getInstance().getGatewayId(); - - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - JsonArray array = new JsonArray(); - for (String uid : uidRoomList) { - array.add(uid); - } - jsonObject.add("objects", array); - String topic = String.format(TopicConstant.ROOM_BIND_LIST_GET, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getRoomBindList onSuccess"); - Type type = new TypeToken<BaseLocalResponse<List<LinkRoomBindBean>>>() { - }.getType(); - List<LinkRoomBindBean> list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 璇诲彇缃戝叧缁忕含搴� - */ - public void getGatewayLocation(String gatewayId, HDLLinkTCallBack<GatewayLocationBean> callBack) { - if (null == callBack) { - return; - } - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - String topic = String.format(TopicConstant.GATEWAY_LOCATION_GET, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getGatewayLocation onSuccess"); - Type type = new TypeToken<BaseLocalResponse<GatewayLocationBean>>() { - }.getType(); - GatewayLocationBean list = LinkResponseUtils.convertLinkResponse(msg, type); - if (list == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_DATA_PARSING_ERROR)); - } else { - callBack.onSuccess(list); - } - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 璁剧疆缃戝叧缁忕含搴� - */ - public void gatewayLocation(GatewayBean bean, String longitude, String lat, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = bean.getGatewayId(); - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - JsonObject jsonObject1 = new JsonObject(); - jsonObject1.addProperty("longitude", longitude); - jsonObject1.addProperty("latitude", lat); - jsonObject.add("objects", jsonObject1); - String topic = String.format(TopicConstant.GATEWAY_LOCATION_EDIT, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), HDLLinkConfig.getInstance().isLocalEncrypt()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("getRoomBindList onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - /** - * 鍒氬垰缁戝畾缃戝叧鐨勬椂鍊欒缃綉鍏崇粡绾害 涓嶉渶瑕佸姞瀵� - */ - public void gatewayLocation(String mGatewayId, String longitude, String lat, boolean isEncrypt, HDLLinkTCallBack<String> callBack) { - if (null == callBack) { - return; - } - String gatewayId = mGatewayId; - if (!TextUtils.isEmpty(gatewayId)) { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - JsonObject jsonObject1 = new JsonObject(); - jsonObject1.addProperty("longitude", longitude); - jsonObject1.addProperty("latitude", lat); - jsonObject.add("objects", jsonObject1); - String topic = String.format(TopicConstant.GATEWAY_LOCATION_EDIT, gatewayId); - LinkRequest request = new LinkRequest(topic, jsonObject.toString(), isEncrypt); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), request, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (msg instanceof LinkResponse) { - LogUtils.i("gatewayLocation onSuccess"); - callBack.onSuccess("Success"); - } - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - HDLExceptionSubmitUtils.submit(topic, request, HDLLinkCopyException.getErrorWithCode(hdlLinkCode.getCode(), hdlLinkCode.getMsg())); - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - } - }, true).send(); - } else { - if (callBack != null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - } - } - } - - - /*********************** 鏂囦欢浼犺緭 ****************************/ - /** - * 鏂囦欢鐢ㄩ�旈�氱煡 - * - * @param fileId 鏂囦欢Id - * @param fileName 鏂囦欢鍚嶇О - * @param purpose 鐢ㄩ�� 鐢ㄩ�旀灇涓� - * zigbee璁惧閰嶇疆鎭㈠锛� ConfigRecoveryForZigbeeDevices - * 鏁版嵁澶囦唤锛欴ataBackup - * 鏁版嵁鎭㈠锛欴ataRecovery - * @param callBack - */ - public void sendFileUserNotification(String fileId, String fileName, String purpose, HDLLinkCallBack callBack) { - //甯ф牸寮忥細head+鍛戒护瀛�+鏁版嵁闀垮害+浜岃繘鍒舵暟鎹� - String time = String.valueOf(System.currentTimeMillis()); - String data = "hex" + "0001" + fileId + "\r\n" + fileName + "\r\n" + purpose; - byte[] dataBytes = data.getBytes(StandardCharsets.UTF_8); - FileRequest linkRequest = new FileRequest(fileId, 0x0011, dataBytes, HDLLinkConfig.getInstance().isLocalEncrypt()); - linkRequest.setReplyTopic(linkRequest.getAckTopic()); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), linkRequest, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - - } - }, true).send(); - } - - /** - * 鍙戦�佹枃浠剁浉鍏冲懡浠� - */ - public void sendFileCommand(byte[] dataBytes, Integer command, HDLLinkCallBack callBack) { - //甯ф牸寮忥細head+鍛戒护瀛�+鏁版嵁闀垮害+浜岃繘鍒舵暟鎹� - String time = String.valueOf(System.currentTimeMillis()); -// byte []dataBytes=data.getBytes(StandardCharsets.UTF_8); - FileRequest linkRequest = new FileRequest("65531", command, dataBytes, HDLLinkConfig.getInstance().isLocalEncrypt()); - linkRequest.setReplyTopic(linkRequest.getAckTopic()); - linkRequest.setCloudTopic(String.format(TopicConstant.NATIVE_LINK_DOWN, HDLLinkConfig.getInstance().getGatewayId())); - new HDLConnectHelper(HDLLinkConfig.getInstance().getIpAddress(), linkRequest, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - - } - }, true).send(); - } - - - /********************************椹卞姩鍗囩骇***********************************/ - /** - * 鍙戦�佹枃浠剁浉鍏冲懡浠� - */ - public void sendFileCommand(String ipAddress, byte[] dataBytes, String fileId, Integer command, HDLLinkCallBack callBack) { - //甯ф牸寮忥細head+鍛戒护瀛�+鏁版嵁闀垮害+浜岃繘鍒舵暟鎹� - FileRequest linkRequest = new FileRequest(fileId, command, dataBytes, HDLLinkConfig.getInstance().isLocalEncrypt()); - linkRequest.setReplyTopic(linkRequest.getAckTopic()); - new HDLConnectHelper(ipAddress, linkRequest, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - - } - }, true).send(); - } - -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateLogicInputBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateLogicInputBean.java deleted file mode 100644 index 2440999..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateLogicInputBean.java +++ /dev/null @@ -1,213 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/2/16 - * description: - */ -public class LinkCreateLogicInputBean implements Serializable { - private String sid; - /** - * 鏃堕棿鐐规潯浠� 1 - * 鏃堕棿娈垫潯浠� 2 - * 璁惧鐘舵�佸彉鍖栨潯浠� 3 - * 鐜淇℃伅 4 - * 瀹夐槻鏉′欢 5 涓嶅仛 - * 浜戠澶╂皵鏉′欢 6 - * 鏌愪釜閫昏緫/鍦烘櫙鐨勮緭鍑烘潯浠� 7 - * 鍦扮悊鍥存爮 8 涓嶅仛 - */ - private String condition_type; - /** - * 娌℃湁璇ュ瓧娈点�佽鍊兼垨0: 鐘舵�佹娴�(姣忔鏀跺埌鐘舵�佸氨鎴愮珛) - * 1:鍔ㄤ綔妫�娴�(闇�瑕佸垏鎹㈢姸鎬佹墠鎴愮珛) - */ - private String detect_type; - private String identifier; - //true:涓存椂bypass涓�乫alse:鍚敤涓� 鏄惁杩囨护 - private String bypass; - private List<LinkCreateLogicInputConditionBean> condition = new ArrayList<>(); - private String statusDesc; - private String src; - private String omodel; - private String choose; - private String oid; - private String spk; - private String delay; - private String name; - private String online; - private LinkCreateSceneImageBean sceneImage = new LinkCreateSceneImageBean(); - private List<LinkCreateSceneFunctionStatusBean> status = new ArrayList<>(); - private LinkCreateSceneFunctionControlAttrsBean controlAttrs; - private List<LinkCreateSceneFunctionattributesBean> attributes = new ArrayList<>(); - - public String getIdentifier() { - return identifier == null ? "" : identifier; - } - - public void setIdentifier(@NonNull String identifier) { - this.identifier = identifier; - } - - public String getDetect_type() { - return detect_type == null ? "" : detect_type; - } - - public void setDetect_type(@NonNull String detect_type) { - this.detect_type = detect_type; - } - - public String getBypass() { - return bypass == null ? "" : bypass; - } - - public void setBypass(@NonNull String bypass) { - this.bypass = bypass; - } - - public String getStatusDesc() { - return statusDesc == null ? "" : statusDesc; - } - - public void setStatusDesc(@NonNull String statusDesc) { - this.statusDesc = statusDesc; - } - - public String getSrc() { - return src == null ? "" : src; - } - - public void setSrc(@NonNull String src) { - this.src = src; - } - - public String getOmodel() { - return omodel == null ? "" : omodel; - } - - public void setOmodel(@NonNull String omodel) { - this.omodel = omodel; - } - - public String getChoose() { - return choose == null ? "" : choose; - } - - public void setChoose(@NonNull String choose) { - this.choose = choose; - } - - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(@NonNull String oid) { - this.oid = oid; - } - - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(@NonNull String spk) { - this.spk = spk; - } - - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - public String getOnline() { - return online == null ? "" : online; - } - - public void setOnline(@NonNull String online) { - this.online = online; - } - - public LinkCreateSceneImageBean getSceneImage() { - if (sceneImage == null) { - sceneImage = new LinkCreateSceneImageBean("0", "https://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/material/appdebug/scene0.png", "/static/images/scene/scene0.png"); - } - return sceneImage; - } - - public void setSceneImage(@NonNull LinkCreateSceneImageBean sceneImage) { - this.sceneImage = sceneImage; - } - - public List<LinkCreateSceneFunctionStatusBean> getStatus() { - if (status == null) { - return new ArrayList<>(); - } - return status; - } - - public void setStatus(@NonNull List<LinkCreateSceneFunctionStatusBean> status) { - this.status = status; - } - - public LinkCreateSceneFunctionControlAttrsBean getControlAttrs() { - return controlAttrs; - } - - public void setControlAttrs(@NonNull LinkCreateSceneFunctionControlAttrsBean controlAttrs) { - this.controlAttrs = controlAttrs; - } - - public List<LinkCreateSceneFunctionattributesBean> getAttributes() { - if (attributes == null) { - return new ArrayList<>(); - } - return attributes; - } - - public void setAttributes(@NonNull List<LinkCreateSceneFunctionattributesBean> attributes) { - this.attributes = attributes; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - public String getCondition_type() { - return condition_type == null ? "" : condition_type; - } - - public void setCondition_type(@NonNull String condition_type) { - this.condition_type = condition_type; - } - - public List<LinkCreateLogicInputConditionBean> getCondition() { - if (condition == null) { - return new ArrayList<>(); - } - return condition; - } - - public void setCondition(@NonNull List<LinkCreateLogicInputConditionBean> condition) { - this.condition = condition; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateLogicOutputBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateLogicOutputBean.java deleted file mode 100644 index e2010e6..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateLogicOutputBean.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/2/16 - * description: - */ -public class LinkCreateLogicOutputBean implements Serializable { - /** - * 璁惧=1 - * 鍦烘櫙=2 - * 瀹夐槻=3 - */ - private String target_type; - private String delay; - private String sid; - private String name; - private List<LinkCreateLogicOutputStatusBean> status = new ArrayList<>(); - //鍦烘櫙 - private List<LinkCreateSceneBean> detailInfo = new ArrayList<>(); - - //璁惧 - private String statusDesc; - private String src; - private String omodel; - private String choose; - private String oid; - private String spk; - private String online; - private String identifier; - private LinkCreateSceneImageBean sceneImage; - private LinkCreateSceneFunctionControlAttrsBean controlAttrs; - private List<LinkCreateSceneFunctionattributesBean> attributes = new ArrayList<>(); - - public String getIdentifier() { - return identifier == null ? "" : identifier; - } - - public void setIdentifier(@NonNull String identifier) { - this.identifier = identifier; - } - - public String getStatusDesc() { - return statusDesc == null ? "" : statusDesc; - } - - public void setStatusDesc(@NonNull String statusDesc) { - this.statusDesc = statusDesc; - } - - public String getSrc() { - return src == null ? "" : src; - } - - public void setSrc(@NonNull String src) { - this.src = src; - } - - public String getOmodel() { - return omodel == null ? "" : omodel; - } - - public void setOmodel(@NonNull String omodel) { - this.omodel = omodel; - } - - public String getChoose() { - return choose == null ? "" : choose; - } - - public void setChoose(@NonNull String choose) { - this.choose = choose; - } - - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(@NonNull String oid) { - this.oid = oid; - } - - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(@NonNull String spk) { - this.spk = spk; - } - - public String getOnline() { - return online == null ? "" : online; - } - - public void setOnline(@NonNull String online) { - this.online = online; - } - - public LinkCreateSceneImageBean getSceneImage() { - if (sceneImage == null) { - sceneImage = new LinkCreateSceneImageBean("0", "https://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/material/appdebug/scene0.png", "/static/images/scene/scene0.png"); - } - return sceneImage; - } - - public void setSceneImage(@NonNull LinkCreateSceneImageBean sceneImage) { - this.sceneImage = sceneImage; - } - - public LinkCreateSceneFunctionControlAttrsBean getControlAttrs() { - return controlAttrs; - } - - public void setControlAttrs(@NonNull LinkCreateSceneFunctionControlAttrsBean controlAttrs) { - this.controlAttrs = controlAttrs; - } - - public List<LinkCreateSceneFunctionattributesBean> getAttributes() { - if (attributes == null) { - return new ArrayList<>(); - } - return attributes; - } - - public void setAttributes(@NonNull List<LinkCreateSceneFunctionattributesBean> attributes) { - this.attributes = attributes; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - public List<LinkCreateSceneBean> getDetailInfo() { - if (detailInfo == null) { - return new ArrayList<>(); - } - return detailInfo; - } - - public void setDetailInfo(@NonNull List<LinkCreateSceneBean> detailInfo) { - this.detailInfo = detailInfo; - } - - public String getTarget_type() { - return target_type == null ? "" : target_type; - } - - public void setTarget_type(@NonNull String target_type) { - this.target_type = target_type; - } - - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - public List<LinkCreateLogicOutputStatusBean> getStatus() { - if (status == null) { - return new ArrayList<>(); - } - return status; - } - - public void setStatus(@NonNull List<LinkCreateLogicOutputStatusBean> status) { - this.status = status; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateSceneBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateSceneBean.java deleted file mode 100644 index 91f4f18..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateSceneBean.java +++ /dev/null @@ -1,149 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/1/23 - * description: - */ -public class LinkCreateSceneBean implements Serializable { - private String delay; - private String name; - private String sid; - private String group; - private String can_delete; - private String can_edit; - private String gatewayId; - private String image; - private String from; //鏉ユ簮锛屾柟渚跨綉鍏宠瘑鍒� - private String local; - private List<LinkCreateSceneImageToCloudBean> imageBeans = new ArrayList<>(); - private List<String> uids = new ArrayList<>(); - private List<LinkCreateSceneFunctionBean> functions = new ArrayList<>(); - - public String getCan_edit() { - return can_edit == null ? "" : can_edit; - } - - public void setCan_edit(@NonNull String can_edit) { - this.can_edit = can_edit; - } - - public String getLocal() { - return local == null ? "" : local; - } - - public void setLocal(@NonNull String local) { - this.local = local; - } - - public String getFrom() { - return from == null ? "" : from; - } - - public void setFrom(@NonNull String from) { - this.from = from; - } - - public String getGatewayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGatewayId(@NonNull String gatewayId) { - this.gatewayId = gatewayId; - } - - public String getImage() { - return image == null ? "" : image; - } - - public void setImage(@NonNull String image) { - this.image = image; - } - - public String getGroup() { - return group == null ? "" : group; - } - - public void setGroup(@NonNull String group) { - this.group = group; - } - - public List<LinkCreateSceneImageToCloudBean> getImageBeans() { - if (imageBeans == null) { - return imageBeans = new ArrayList<>(); - } - return imageBeans; - } - - public void setImageBeans(@NonNull List<LinkCreateSceneImageToCloudBean> imageBeans) { - this.imageBeans = imageBeans; - } - - public String getGateWayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGateWayId(@NonNull String gateWayId) { - this.gatewayId = gateWayId; - } - - public String getCan_delete() { - return can_delete == null ? "" : can_delete; - } - - public void setCan_delete(@NonNull String can_delete) { - this.can_delete = can_delete; - } - - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - public List<String> getUids() { - if (uids == null) { - return new ArrayList<>(); - } - return uids; - } - - public void setUids(@NonNull List<String> uids) { - this.uids = uids; - } - - public List<LinkCreateSceneFunctionBean> getFunctions() { - if (functions == null) { - return new ArrayList<>(); - } - return functions; - } - - public void setFunctions(@NonNull List<LinkCreateSceneFunctionBean> functions) { - this.functions = functions; - } -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateSceneFunctionBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateSceneFunctionBean.java deleted file mode 100644 index a93a83c..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkCreateSceneFunctionBean.java +++ /dev/null @@ -1,168 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/1/23 - * description: - */ -public class LinkCreateSceneFunctionBean implements Serializable { - private String statusDesc; - private String src; - private String omodel; - private String choose; - private String oid; - private String sid; - private String spk; - private String delay; - private String name; - private String online; - private String type; - private String identifier; - private LinkCreateSceneImageBean sceneImage = new LinkCreateSceneImageBean(); - private List<LinkCreateSceneFunctionStatusBean> status = new ArrayList<>(); - private LinkCreateSceneFunctionControlAttrsBean controlAttrs = new LinkCreateSceneFunctionControlAttrsBean(); - private List<LinkCreateSceneFunctionattributesBean> attributes = new ArrayList<>(); - - public String getIdentifier() { - return identifier == null ? "" : identifier; - } - - public void setIdentifier(@NonNull String identifier) { - this.identifier = identifier; - } - - public LinkCreateSceneImageBean getSceneImage() { - if (sceneImage == null) { - sceneImage = new LinkCreateSceneImageBean("0", "https://hdl-hz-prod.oss-cn-hangzhou.aliyuncs.com/material/appdebug/scene0.png", "/static/images/scene/scene0.png"); - } - return sceneImage; - } - - public String getType() { - return type == null ? "" : type; - } - - public void setType(@NonNull String type) { - this.type = type; - } - - public void setSceneImage(@NonNull LinkCreateSceneImageBean sceneImage) { - this.sceneImage = sceneImage; - } - - public String getStatusDesc() { - return statusDesc == null ? "" : statusDesc; - } - - public void setStatusDesc(@NonNull String statusDesc) { - this.statusDesc = statusDesc; - } - - public String getSrc() { - return src == null ? "" : src; - } - - public void setSrc(@NonNull String src) { - this.src = src; - } - - public String getOmodel() { - return omodel == null ? "" : omodel; - } - - public void setOmodel(@NonNull String omodel) { - this.omodel = omodel; - } - - public String getChoose() { - return choose == null ? "" : choose; - } - - public void setChoose(@NonNull String choose) { - this.choose = choose; - } - - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(@NonNull String oid) { - this.oid = oid; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(@NonNull String spk) { - this.spk = spk; - } - - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - public String getOnline() { - return online == null ? "" : online; - } - - public void setOnline(@NonNull String online) { - this.online = online; - } - - public List<LinkCreateSceneFunctionStatusBean> getStatus() { - if (status == null) { - return new ArrayList<>(); - } - return status; - } - - public void setStatus(@NonNull List<LinkCreateSceneFunctionStatusBean> status) { - this.status = status; - } - - public LinkCreateSceneFunctionControlAttrsBean getControlAttrs() { - return controlAttrs; - } - - public void setControlAttrs(@NonNull LinkCreateSceneFunctionControlAttrsBean controlAttrs) { - this.controlAttrs = controlAttrs; - } - - public List<LinkCreateSceneFunctionattributesBean> getAttributes() { - if (attributes == null) { - return new ArrayList<>(); - } - return attributes; - } - - public void setAttributes(@NonNull List<LinkCreateSceneFunctionattributesBean> attributes) { - this.attributes = attributes; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkGroupControlCreateBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkGroupControlCreateBean.java deleted file mode 100644 index 8f65835..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkGroupControlCreateBean.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/6/30 - * description: - */ -public class LinkGroupControlCreateBean implements Serializable { - private String sid; - private String name; - private String type; - private List<String> uids = new ArrayList<>(); - private List<LinkSidSpkBean> sids = new ArrayList<>(); - /** - * "${宸插畬鎴愭暟}/${鎬绘暟}" - */ - private String progress; - /** - * 1:閰嶇疆涓� - * 2:閰嶇疆澶辫触 - * 3:閰嶇疆鎴愬姛 - * 4:閮ㄥ垎鎴愬姛 - */ - private int state; - /** - * 鐢ㄦ埛寮�鍏宠褰� 鍙互鎺у埗 榛樿off鏄叧 on鏄紑 - */ - private String onoff; - - public LinkGroupControlCreateBean() { - } - - public String getOnoff() { - return onoff == null ? "" : onoff; - } - - public void setOnoff(@NonNull String onoff) { - this.onoff = onoff; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - public String getType() { - return type == null ? "" : type; - } - - public void setType(@NonNull String type) { - this.type = type; - } - - public List<String> getUids() { - if (uids == null) { - return uids = new ArrayList<>(); - } - return uids; - } - - public int getState() { - return state; - } - - public void setState(@NonNull int state) { - this.state = state; - } - - public void setUids(@NonNull List<String> uids) { - this.uids = uids; - } - - public List<LinkSidSpkBean> getSids() { - if (sids == null) { - return sids = new ArrayList<>(); - } - return sids; - } - - public String getProgress() { - return progress == null ? "" : progress; - } - - public void setProgress(@NonNull String progress) { - this.progress = progress; - } - - public void setSids(@NonNull List<LinkSidSpkBean> sids) { - this.sids = sids; - } - - public LinkGroupControlCreateBean(String name, String type) { - this.name = name; - this.type = type; - } - -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkSceneBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkSceneBean.java deleted file mode 100644 index 7cc6785..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkSceneBean.java +++ /dev/null @@ -1,122 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by jlchen on 1/10/22. - */ -public class LinkSceneBean implements Serializable { - - private String sid;//鍦烘櫙sid - private String name;//鍦烘櫙鍚嶅瓧 - private String status;//鐘舵�� - private String group;// - private String delay;//寤惰繜 - private String modify_time;//淇敼鏃堕棿 - private String gatewayId; - private String from; //鏉ユ簮锛屾柟渚跨綉鍏宠瘑鍒� - - private String local; - private LinkCreateSceneBean detailInfo = new LinkCreateSceneBean();//璇︽儏 - /** - * 涓撻棬缁欏満鏅壒閲忔搷浣滃仛澶勭悊 - */ - private boolean isChoose = false; - - public String getLocal() { - return local == null ? "" : local; - } - - public void setLocal(@NonNull String local) { - this.local = local; - } - - public String getFrom() { - return from == null ? "" : from; - } - - public void setFrom(@NonNull String from) { - this.from = from; - } - - public boolean isChoose() { - return isChoose; - } - - public void setChoose(@NonNull boolean choose) { - isChoose = choose; - } - - public String getGateWayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGateWayId(@NonNull String gateWayId) { - this.gatewayId = gateWayId; - } - - @NonNull - public LinkCreateSceneBean getDetailInfo() { - return detailInfo == null ? new LinkCreateSceneBean() : detailInfo; - } - - public void setDetailInfo(@NonNull LinkCreateSceneBean detailInfo) { - this.detailInfo = detailInfo; - } - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - @NonNull - public String getStatus() { - return status == null ? "" : status; - } - - public void setStatus(@NonNull String status) { - this.status = status; - } - - @NonNull - public String getGroup() { - return group == null ? "" : group; - } - - public void setGroup(@NonNull String group) { - this.group = group; - } - - @NonNull - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - @NonNull - public String getModify_time() { - return modify_time == null ? "" : modify_time; - } - - public void setModify_time(@NonNull String modify_time) { - this.modify_time = modify_time; - } -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkSidSpkBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkSidSpkBean.java deleted file mode 100644 index 06648a4..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/LinkSidSpkBean.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/6/30 - * description: - */ -public class LinkSidSpkBean implements Serializable { - private String sid; - private String spk; - /** - * 鍔熻兘sid閰嶇疆鐨勭姸鎬侊紝0琛ㄧず鎴愬姛锛屽叾浠栬〃绀哄け璐� - */ - private int config_state; - private String msg; - - public LinkSidSpkBean() { - } - - public String getMsg() { - return msg == null ? "" : msg; - } - - public void setMsg(@NonNull String msg) { - this.msg = msg; - } - - public int getConfig_state() { - return config_state; - } - - public void setConfig_state(@NonNull int config_state) { - this.config_state = config_state; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(@NonNull String spk) { - this.spk = spk; - } - - public LinkSidSpkBean(String sid, String spk) { - this.sid = sid; - this.spk = spk; - } - -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/MMWAreaBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/MMWAreaBean.java deleted file mode 100644 index 2f5c37f..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/MMWAreaBean.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/11/20 - * description: - */ -public class MMWAreaBean implements Serializable { - private String sid; - private List<MMWAreaSpaceBean> spaces = new ArrayList<>(); - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - public List<MMWAreaSpaceBean> getSpaces() { - if (spaces == null) { - return spaces = new ArrayList<>(); - } - return spaces; - } - - public void setSpaces(@NonNull List<MMWAreaSpaceBean> spaces) { - this.spaces = spaces; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/MMWAreaSpaceBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/MMWAreaSpaceBean.java deleted file mode 100644 index 3dd42e8..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/bean/MMWAreaSpaceBean.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.hdl.sdk.link.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/11/20 - * description: - */ -public class MMWAreaSpaceBean implements Serializable { - private String space_id; - private String space_type; - private String space_color; - private String space_name; - private String x_s; - private String x_e; - private String y_s; - private String y_e; - - public String getSpace_id() { - return space_id == null ? "" : space_id; - } - - public void setSpace_id(@NonNull String space_id) { - this.space_id = space_id; - } - - public String getSpace_type() { - return space_type == null ? "" : space_type; - } - - public void setSpace_type(@NonNull String space_type) { - this.space_type = space_type; - } - - public String getSpace_color() { - return space_color == null ? "" : space_color; - } - - public void setSpace_color(@NonNull String space_color) { - this.space_color = space_color; - } - - public String getSpace_name() { - return space_name == null ? "" : space_name; - } - - public void setSpace_name(@NonNull String space_name) { - this.space_name = space_name; - } - - public String getX_s() { - return x_s == null ? "" : x_s; - } - - public void setX_s(@NonNull String x_s) { - this.x_s = x_s; - } - - public String getX_e() { - return x_e == null ? "" : x_e; - } - - public void setX_e(@NonNull String x_e) { - this.x_e = x_e; - } - - public String getY_s() { - return y_s == null ? "" : y_s; - } - - public void setY_s(@NonNull String y_s) { - this.y_s = y_s; - } - - public String getY_e() { - return y_e == null ? "" : y_e; - } - - public void setY_e(@NonNull String y_e) { - this.y_e = y_e; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/config/TopicConstant.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/config/TopicConstant.java deleted file mode 100644 index a480450..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/config/TopicConstant.java +++ /dev/null @@ -1,339 +0,0 @@ -package com.hdl.sdk.link.common.config; - -/** - * Created by Tong on 2021/9/22. - */ -public class TopicConstant { - - - /* - *閫氱煡鍒犻櫎骞堕��缃戝瓙璁惧鎷撴墤鍏崇郴 - *鍒犻櫎浠庣綉鍏� - * */ - public static final String DELETING_GATEWAY_SLAVE="/base/%s/thing/topo/delete/notify"; - - /* - *缃戝叧鐗╃悊閫�缃戝悗涓婃姤鍒犻櫎(閫�缃�)瀛愯澶� - * */ - public static final String DELETING_GATEWAY_SLAVE_RESULT="/base/%s/thing/topo/delete/up"; - - - - /* - 缃戝叧鏁版嵁澶囦唤杩樺師 - * */ - public static final String GATEWAY_BACKUP_RESTORE_DOWN = "/base/%s/device/backup/restore/down"; - - /* - 璋冭瘯浜哄憳涓诲姩閫氱煡缃戝叧澶囦唤鏁版嵁 - * */ - public static final String GATEWAY_BACKUP_NOTICE_DOWN = "/base/%s/device/backup/notice/down"; - /* - 澶囦唤杩樺師杩涘害鑾峰彇 - * */ - public static final String GATEWAY_BACKUP_PROGRESS_GET = "/base/%s/device/backup/restore/progress/get"; - - /* - * 缃戝叧缂栬緫鍛戒护 - * 鍐欒繙绋嬩俊鎭殑锛屼緥濡傛湇鍔″櫒鍦板潃銆丠omeId銆佸瘑閽ヤ箣绫� - * 涓庢湇鍔″櫒鐩稿叧鐨� - * */ - public static final String GATEWAY_EDIT_REMOTE = "/user/%s/custom/gateway/remote/edit"; - - /* - * 缃戝叧鎭㈠鍑哄満璁剧疆鍛戒护 - * */ - public static final String GATEWAY_INITIALIZE_REMOTE = "/user/%s/custom/gateway/initialize"; - public static final String GATEWAY_FIND_REMOTE = "/base/%s/thing/service/mmv_device_find/down"; - - /** - * 绾㈠瀹濈殑瀹氫綅 - */ - public static final String IR_FIND_REMOTE = "/base/%s/thing/service/irDeviceFind/down"; - /** - * 绾㈠瀹濊瘯鐮� - */ - public static final String IR_CODE_TEST = "/base/%s/thing/service/irCodeTest/down"; - /** - * 绾㈠瀹濋仴鎺у櫒娣诲姞 - */ - public static final String IR_DEVICE_ADD = "/base/%s/thing/service/irDeviceAdd/down"; - /** - * 绾㈠瀹濋仴鎺у櫒鍒楄〃鑾峰彇 - */ - public static final String IR_DEVICE_LIST = "/base/%s/thing/service/irDeviceListGet/down"; - /** - * 绾㈠瀹濊嚜瀛︾爜 - * */ - public static final String IR_CODE_STUDY = "/base/%s/thing/service/irCodeStudy/down"; - /** - * 绾㈠瀹濊嚜瀛︾爜鍒犻櫎 - * */ - public static final String IR_CODE_REMOVE = "/base/%s/thing/service/irCodeRemove/down"; - - - /* - * 缃戝叧缂栬緫鍛戒护 - * 涓庢湇鍔″櫒鏃犲叧鐨� - * */ - public static final String GATEWAY_EDIT_LOCAL = "/user/%s/custom/gateway/edit"; - - /** - * 璁剧疆缃戝叧鍏ョ綉妯″紡 - * 鍏ョ綉浠庢満璁惧浣跨敤 - * 浠庣綉鍏炽�佺孩澶栧疂绛夌綉缁滆澶� - */ - public static final String GATEWAY_AUTH = "/user/%s/custom/device/auth_gateway"; - //鑾峰彇缃戝叧淇℃伅 - public static final String GATEWAY_GET = "/user/%s/custom/gateway/remote/get"; - - //缃戝叧骞挎挱鍏ョ綉鎸囦护 - public static final String GATEWAY_AUTH_BROADCAST = "/user/all/custom/device/network_access/broadcast"; - - //璁惧鍏ョ綉鍜岃璇� - public static final String DEIVCE_AUTH_REQUEST = "/user/all/custom/device/network_access/request"; - - //璁惧鍏ョ綉鍜岃璇佸搷搴� - public static final String DEIVCE_AUTH_REQUEST_REPLY = "/user/all/custom/device/network_access/request_reply"; - - /** - * 鎼滅储缃戝叧 - */ - public static final String GATEWAY_SEARCH = "/user/all/custom/gateway/search"; - - /** - * 鎼滅储缃戝叧鍝嶅簲 - */ - public static final String GATEWAY_SEARCH_REPLY = "/user/all/custom/gateway/search_reply"; - - //缃戝叧璇︾粏淇℃伅鑾峰彇s=gw_id - public static final String GATEWAY_INFO = "/user/%s/custom/gateway/get"; - - //鑾峰彇鐗╃悊璁惧鍒楄〃 - public static final String GET_DEVICE_LIST = "/user/%s/custom/device/list/get"; - - //鑾峰彇鐗╃悊璁惧鍒楄〃鍝嶅簲 - public static final String GET_DEVICE_LIST_REPLY = "/user/%s/custom/device/list/get_reply"; - - //鑾峰彇鍔熻兘鍒楄〃 - public static final String GET_FUNCTION_LIST = "/user/%s/custom/function/list/get"; - - //妯℃嫙浜戠ota - public static final String OTA_UPGRADE_DOWN = "/base/%s/ota/device/upgrade/down"; - - /** - * 缂栬緫sid - */ - public static final String EDIT_FUNCTION = "/user/%s/custom/function/attribute/edit"; - - //鑾峰彇鍔熻兘鍝嶅簲 - public static final String GET_FUNCTION_LIST_REPLY = "/user/%s/custom/function/list/get_reply"; - - //鍔熻兘灞炴�ц鍙� - public static final String GET_FUNCTION_ATTRIBUTE = "/user/%s/custom/function/attribute/get"; - //鍔熻兘灞炴�х紪杈� - public static final String EDIT_FUNCTION_ATTRIBUTE = "/user/%s/custom/function/attribute/edit"; - - //鍔熻兘灞炴�у搷搴� - public static final String GET_FUNCTION_ATTRIBUTE_REPLY = "/user/%s/custom/function/attribute/get_reply"; - - //鎺у埗 - public static final String PROPERTY_DOWN = "/base/%s/thing/property/down"; - - //鎺у埗鍝嶅簲 - public static final String PROPERTY_DOWN_REPLY = "/base/%s/thing/property/down_reply"; - - //鐘舵�佷笂鎶� - public static final String PROPERTY_UP = "/base/%s/thing/property/up"; - - //鐘舵�佷笂鎶ュ搷搴� - public static final String PROPERTY_UP_REPLY = "/base/%s/thing/property/up_reply"; - - //璇诲彇鐘舵�� - public static final String PROPERTY_READ = "/base/%s/thing/property/read"; - - //鑾峰彇姣背娉㈠尯鍩� - public static final String MMW_AREA_GET = "/base/%s/thing/service/sub_space_config_get/down"; - - //璇诲彇鐘舵�佸搷搴� - public static final String PROPERTY_READ_REPLY = "/base/%s/thing/property/read_reply"; - - //鏇存敼缃戝叧澶囨敞鍚� - public static final String GATEWAY_RENAME = "/user/%s/custom/gateway/edit"; - - //8.1鑾峰彇鍦烘櫙鍒楄〃 - public static final String SCENE_LIST_GET = "/user/%s/custom/scene/list/get"; - - //8.2鑾峰彇鍦烘櫙 - public static final String SCENE_GET = "/user/%s/custom/scene/get"; - - //8.3鎵ц鍦烘櫙 - public static final String SCENE_CONTROL = "/user/%s/custom/scene/execute"; - - //8.4鍦烘櫙澧炲姞 - public static final String CREATE_SCENE = "/user/%s/custom/scene/add"; - - //8.5鍦烘櫙缂栬緫 - public static final String SCENE_EDIT = "/user/%s/custom/scene/edit"; - - //8.6鍦烘櫙鍒犻櫎 - public static final String SCENE_DELETE = "/user/%s/custom/scene/delete"; - - //9.1 鎴块棿淇℃伅鍒楄〃鑾峰彇 - public static final String ROOM_LIST_GET = "/user/%s/custom/room/list/get"; - - //9.2 鎴块棿淇℃伅娣诲姞锛堝閲忥級 - public static final String ROOM_ADD = "/user/%s/custom/room/add"; - - //9.2.1 鎴块棿淇℃伅娣诲姞锛堝叏閲忥級 - public static final String ROOM_COVER_ADD = "/user/%s/custom/room/cover/add"; - - //9.3 鎴块棿淇℃伅缂栬緫 - public static final String ROOM_EDIT = "/user/%s/custom/room/edit"; - - //9.4 鎴块棿淇℃伅鍒犻櫎 - public static final String ROOM_DELETE = "/user/%s/custom/room/delete"; - - //9.5 鎴块棿缁戝畾鍏崇郴鍒楄〃鑾峰彇 - public static final String ROOM_BIND_LIST_GET = "/user/%s/custom/room/bind/list/get"; - - //9.6 鎴块棿缁戝畾鍏崇郴娣诲姞锛堝閲忥級 - public static final String ROOM_BIND_ADD = "/user/%s/custom/room/bind/add"; - - //9.6.1 鎴块棿缁戝畾鍏崇郴娣诲姞(鍏ㄩ噺) - public static final String ROOM_BIND_COVER_ADD = "/user/%s/custom/room/bind/cover/add"; - - //9.7 鎴块棿缁戝畾鍏崇郴鍒犻櫎 - public static final String ROOM_BIND_DELETE = "/user/%s/custom/room/bind/delete"; - - //10.1 鑷姩鍖栧垪琛ㄨ幏鍙� - public static final String LOGIC_LIST_GET = "/user/%s/custom/logic/list/get"; - - //10.2 鑷姩鍖栨墜鍔ㄦ墽琛� - public static final String LOGIC_execute = "/user/%s/custom/logic/execute"; - - //10.3 鑷姩鍖栬幏鍙� 鍒楄〃涓�娆℃�ц鍏� - public static final String LOGIC_GET = "/user/%s/custom/logic/get"; - - //10.4 鑷姩鍖栨柊澧�/缂栬緫 - public static final String LOGIC_EDIT = "/user/%s/custom/logic/edit"; - - //10.5 鑷姩鍖栧垹闄� - public static final String LOGIC_DELETE = "/user/%s/custom/logic/delete"; - - //10.6 鑷姩鍖栧惎鐢ㄧ鐢� - public static final String LOGIC_ENABLE_EDIT = "/user/%s/custom/logic/enable/edit"; - - //10.7 鑷姩鍖栫姸鎬佷笂鎶� 鎵ц缁撴灉銆佹湰鍦板惎鐢ㄧ鐢ㄧ姸鎬佷笂鎶� - public static final String LOGIC_STATUS_UP = "/user/%s/custom/logic/status/up"; - - //11.1 瀹夐槻鍒楄〃鑾峰彇 - public static final String SECURITY_LIST_GET = "/user/%s/custom/security/list/get"; - - //11.2 瀹夐槻鑾峰彇 - public static final String SECURITY_GET = "/user/%s/custom/security/get"; - - //11.3 瀹夐槻鏂板/缂栬緫 - public static final String SECURITY_EDIT= "/user/%s/custom/security/edit"; - - //11.4 瀹夐槻鍒犻櫎 - public static final String SECURITY_DELETE = "/user/%s/custom/security/delete"; - - //11.5 甯冮槻璁剧疆 - public static final String SECURITY_STATUS_SET = "/user/%s/custom/security/status/set"; - - //11.6 瀹夐槻闃插尯鐘舵�佽鍙� - public static final String SECURITY_STATUS_GET = "/user/%s/custom/security/status/get"; - - //11.7 瀹夐槻闃插尯鎶ヨ鐘舵�佷笂鎶� - public static final String SECURITY_STATUS_UP = "/user/%s/custom/security/status/up"; - - //11.8 瀹夐槻Bypass璇诲彇 - public static final String SECURITY_BYPASS_GET = "/user/%s/custom/security/bypass/get"; - - //11.9 瀹夐槻Bypass璁剧疆 - public static final String SECURITY_BYPASS_SET = "/user/%s/custom/security/bypass/set"; - - /** - * 璁惧杩炴帴TCP涔嬪墠骞挎挱 - */ - public static final String BROADCAST="/user/all/custom/gateway/broadcast"; - - /** - * 涓荤綉鍏冲洖澶� - */ - public static final String BROADCAST_REPLY="/user/all/custom/gateway/broadcast_reply"; - - /** - * sid缁戝畾鎴块棿 - */ - public static final String SID_BIND_ROOM = "/user/%s/custom/room/bind/add"; - - /** - * sid瑙g粦鎴块棿 - */ - public static final String SID_DELETE_ROOM = "/user/%s/custom/room/bind/delete"; - - /** - * 蹇冭烦妫�娴� - */ - public static final String HEARTBEAT="/user/%s/custom/gateway/heartbeat"; -// public static final String HEARTBEAT="/user/%s/custom/gateway1/qqheartbeat"; - /** - * 蹇冭烦妫�娴嬪洖澶� - */ - public static final String HEARTBEAT_REPLY="/user/%s/custom/gateway/heartbeat_reply"; - - public static final String NATIVE_ZIGBEE_DOWN ="/user/%s/custom/native/zigbee/down"; - - public static final String NATIVE_ZIGBEE_DOWN_REPLY ="/user/%s/custom/native/zigbee/down_reply"; - - public static final String NATIVE_ZIGBEE_UP ="/user/%s/custom/native/zigbee/up"; - - public static final String NATIVE_ZIGBEE_DOWN_SLAVE ="/user/%s/custom/native/zigbee/down/slaveoid/%s"; - - public static final String NATIVE_ZIGBEE_DOWN_SLAVE_REPLY ="/user/%s/custom/native/zigbee/down_reply/slaveoid/%s"; - - public static final String NATIVE_ZIGBEE_UP_SLAVE ="/user/%s/custom/native/zigbee/up/slaveoid/%s"; - - public static final String NATIVE_LINK_DOWN ="/user/%s/custom/native/a/down"; - - public static final String NATIVE_LINK_DOWN_REPLY ="/user/%s/custom/native/a/down_reply"; - - public static final String NATIVE_LINK_UP ="/user/%s/custom/native/a/up"; - - public static final String NATIVE_LINK_DOWN_SLAVE ="/user/%s/custom/native/a/down/slaveoid/%s"; - - public static final String NATIVE_LINK_DOWN_SLAVE_REPLY ="/user/%s/custom/native/a/down_reply/slaveoid/%s"; - - public static final String NATIVE_LINK_UP_SLAVE ="/user/%s/custom/native/a/up/slaveoid/%s"; - - public static final String GATEWAY_LOCATION_EDIT ="/user/%s/custom/gateway/location/edit"; - - public static final String GATEWAY_LOCATION_GET ="/user/%s/custom/gateway/location/get"; - - public static final String NATIVE_MODBUS_DOWN ="/user/%s/custom/native/inverter/down"; - public static final String NATIVE_MODBUS_UP ="/user/%s/custom/native/inverter/up"; - public static final String NATIVE_MODBUS_DOWN_REPLY ="/user/%s/custom/native/inverter/down_reply"; - /** - * 缇ゆ帶澧炴敼 - */ - public static final String GROUPCONTROL_EDIT ="/user/%s/custom/device/group/control/edit"; - - /** - * 缇ゆ帶鍒楄〃 - */ - public static final String GROUPCONTROL_LIST_GET ="/user/%s/custom/device/group/control/list"; - public static final String NATIVE_MODBUS_DOWN_SLAVE ="/user/%s/custom/native/inverter/down/slaveoid/%s"; - public static final String NATIVE_MODBUS_DOWN_SLAVE_REPLY ="/user/%s/custom/native/inverter/down_reply/slaveoid/%s"; - /** - * 缇ゆ帶鍒犻櫎 - */ - public static final String GROUPCONTROL_DELETE ="/user/%s/custom/device/group/control/delete"; - - /** - * 缇ゆ帶鎺у埗 - */ - public static final String GROUPCONTROL_CONTROL ="/user/%s/custom/device/group/control/down"; - -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/event/EventDispatcher.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/event/EventDispatcher.java deleted file mode 100644 index 37f8b50..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/event/EventDispatcher.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.hdl.sdk.link.common.event; - -import androidx.annotation.NonNull; -import androidx.collection.ArrayMap; - - -import com.hdl.sdk.link.common.utils.LockArrayMap; -import com.hdl.sdk.link.common.utils.LockList; -import com.hdl.sdk.link.common.utils.LogUtils; -import com.hdl.sdk.link.common.utils.ThreadToolUtils; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ExecutorService; - - -/** - * Created by Tong on 2021/9/22. - * 浜嬩欢鍒嗗彂 - */ -public class EventDispatcher { - - private static final LockList<EventListener> ALL_TOPICS_EVENT = new LockList<EventListener>();//鎵�鏈変富棰樻秷鎭� - -// private static final ArrayMap<String, List<EventListener>> EVENT = new ArrayMap<>(); - private static final LockArrayMap<String, List<EventListener>> EVENT = new LockArrayMap<String, List<EventListener>>(); - - private static final ExecutorService ioThread = ThreadToolUtils.getInstance().newFixedThreadPool(2); - - private EventDispatcher() { - } - - private static class SingletonInstance { - private static final EventDispatcher INSTANCE = new EventDispatcher(); - } - - public static EventDispatcher getInstance() { - return SingletonInstance.INSTANCE; - } - - public synchronized void register(String tag, EventListener listener) { - try { - if (!EVENT.containsKey(tag)) { - EVENT.put(tag, new ArrayList<>()); - } - List<EventListener> events = EVENT.get(tag); - if (events != null && !events.contains(listener)) { - events.add(listener); - LogUtils.i(String.format("澧炲姞璁㈤槄涓婚:%s,褰撳墠鍥炶皟鏁伴噺:%s", tag, events.size())); - } - } catch (Exception e) { - LogUtils.e(e.getMessage()); - } - } - - public synchronized void registerIo(String tag, EventListener listener) { - try { - if (!EVENT.containsKey(tag)) { - EVENT.put(tag, new ArrayList<>()); - } - List<EventListener> events = EVENT.get(tag); - if (events != null && !events.contains(listener)) { - events.add(listener); - } - } catch (Exception e) { - LogUtils.e(e.getMessage()); - } - } - - public synchronized void remove(Object tag) { - ioThread.execute(new Runnable() { - @Override - public void run() { - try { - if (EVENT.containsKey(tag)) { -// List<EventListener> list = EVENT.get(tag); -// for (EventListener eventListener : list) { -// TYPE.remove(eventListener); -// } - EVENT.remove(tag); - } - } catch (Exception e) { - LogUtils.e(e.getMessage()); - } - - } - }); - } - - public synchronized void remove(Object tag, EventListener listener) { - ioThread.execute(new Runnable() { - @Override - public void run() { - try { - if (EVENT.containsKey(tag)) { - List<EventListener> ev = EVENT.get(tag); - if (ev != null && !ev.isEmpty()) { -// TYPE.remove(listener); - ev.remove(listener); - LogUtils.i(String.format("绉婚櫎璁㈤槄涓婚:%s,褰撳墠鍥炶皟鏁伴噺:%s",tag,ev.size())); - } - } - } catch (Exception e) { - LogUtils.e(e.getMessage()); - } - - } - }); - } - - /** - * 涓や釜涓婚鏄惁鍖归厤 - * @param desString 瀛楀吀涓殑涓婚 - * @param sourceString 鎺ユ敹鍒扮殑涓婚 - * @return - */ - boolean isMatch(String desString,String sourceString) { - String[] des = desString.split("/"); - String[] source = sourceString.split("/"); - if (des.length != source.length) { - return false; - } - for (int i = 0; i < des.length; i++) { - if (!(des[i].equals(source[i]) || des[i].equals("+"))) { - if (i != 2) { - //缃戝叧id涓嶅垽鏂紝鍙兘鏄疧id,涔熷彲鑳芥槸mac - return false; - } - } - } - return true; - } - - /** - * 浜嬩欢鍒嗗彂鍣紝鍒嗗彂鎵�鏈夊湪鎺ュ彛鍒楄〃涓殑浜嬩欢 - * @param topicTag - * @param o - */ - public synchronized void post(String topicTag, @NonNull Object o) { - try { - for (String key : EVENT.keySet()) { - if (!isMatch(key, topicTag)) { - continue; - } - List<EventListener> list = EVENT.get(key); - if (list != null && !list.isEmpty()) { - for (EventListener listener : list) { - ThreadToolUtils.getInstance().runOnUiThread(new Runnable() { - @Override - public void run() { - try { - if (listener != null) { - listener.onMessage(o); - } - } catch (Exception e) { - LogUtils.e("post鏁版嵁寮傚父", o + " " + e.getMessage()); - } - } - }); - } - } - } - //鎵�鏈変富棰樼殑Listener閫氱煡 - if (ALL_TOPICS_EVENT == null || ALL_TOPICS_EVENT.isEmpty()) { - return; - } - //寮�鍙戝垎鍙戜簨浠� - for (EventListener listener : ALL_TOPICS_EVENT) { - ThreadToolUtils.getInstance().runOnUiThread(new Runnable() { - @Override - public void run() { - if (listener != null) { - listener.onMessage(o); - } - } - }); - } - }catch (Exception e){ - LogUtils.e(e.getMessage()); - } - - } - - /** - * 鏂囦欢鍙戦�侀�氱煡 wxr 2022-03-08 15:38:59 - */ - public synchronized void filePost() { - //TODO - } - /** - * 娉ㄥ唽鎵�鏈変富棰樻秷鎭殑鐩戝惉 - * @param listener - */ - public synchronized void registerAllTopicsListener(EventListener listener) { - try { - if (ALL_TOPICS_EVENT != null && !ALL_TOPICS_EVENT.contains(listener)) { - ALL_TOPICS_EVENT.add(listener); - } -// TYPE.put(listener, MAIN_TYPE); - } catch (Exception e) { - LogUtils.e(e.getMessage()); - } - } - - /** - * 鍙栨秷鎵�鏈変富棰樻秷鎭殑鐩戝惉 - * @param listener - */ - public synchronized void removeAllTopicsListener(EventListener listener) { - ioThread.execute(new Runnable() { - @Override - public void run() { - try { - if (ALL_TOPICS_EVENT != null && !ALL_TOPICS_EVENT.isEmpty()) { -// TYPE.remove(listener); - ALL_TOPICS_EVENT.remove(listener); - } - } catch (Exception e) { - LogUtils.e(e.getMessage()); - } - } - }); - } - - public synchronized void clear() { - ALL_TOPICS_EVENT.clear(); - EVENT.clear(); -// TYPE.clear(); - } - - public synchronized void release() { - clear(); - ioThread.shutdownNow(); - } - - -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/exception/HDLLinkCode.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/exception/HDLLinkCode.java deleted file mode 100644 index 2597fa7..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/exception/HDLLinkCode.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.hdl.sdk.link.common.exception; - -import android.annotation.SuppressLint; -import android.content.Context; - -import com.hdl.sdk.link.HDLLinkLocalSdk; -import com.hdl.sdk.link.R; - -import java.util.HashMap; - -/** - * Created by jlchen on 11/15/21. - * - * @Description : HDLError - */ -public class HDLLinkCode { - public static final HDLLinkCode HDL_UNKOWN_CODE=new HDLLinkCode(-1000,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_UNKOWN_CODE)); - public static final HDLLinkCode HDL_DATA_ERROR =new HDLLinkCode(-2000, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_DATA_ERROR)) ; - public static final HDLLinkCode HDL_DATA_NULL_ERROR=new HDLLinkCode(-2001, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_DATA_NULL_ERROR)); - public static final HDLLinkCode HDL_AUTH_ERROR=new HDLLinkCode(2002,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_AUTH_ERROR) ); - public static final HDLLinkCode HDL_SEND_ERROR=new HDLLinkCode(2003, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_SEND_ERROR)); - public static final HDLLinkCode HDL_TIMEOUT_ERROR=new HDLLinkCode(2004, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_TIMEOUT_ERROR)); - public static final HDLLinkCode HDL_UNAUTHORIZED_ERROR=new HDLLinkCode(-2005,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_UNAUTHORIZED_ERROR)); - public static final HDLLinkCode HDL_AUTH_ERROR_GATEWAY_NOT_REGISTERED=new HDLLinkCode(-2006, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_AUTH_ERROR_GATEWAY_NOT_REGISTERED)); - public static final HDLLinkCode HDL_SEARCH_GATEWAY_TIMEOUT_ERROR=new HDLLinkCode(-2007, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_SEARCH_GATEWAY_TIMEOUT_ERROR)); - public static final HDLLinkCode HDL_AUTH_MAC_KEY_ERROR=new HDLLinkCode(-2008, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_AUTH_MAC_KEY_ERROR)); - public static final HDLLinkCode HDL_DATA_PARSING_ERROR=new HDLLinkCode(-2009, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_DATA_PARSING_ERROR)); - public static final HDLLinkCode HDL_GET_DEVICE_LIST_ERROR=new HDLLinkCode(-2100, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_GET_DEVICE_LIST_ERROR)); - public static final HDLLinkCode HDL_GET_FUNCTION_LIST_ERROR=new HDLLinkCode(-2101, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_GET_FUNCTION_LIST_ERROR)); - public static final HDLLinkCode HDL_GET_FUNCTION_PROPERTIES_ERROR=new HDLLinkCode(-2102, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_GET_FUNCTION_PROPERTIES_ERROR)); - public static final HDLLinkCode HDL_CONTROL_FAILURE_ERROR=new HDLLinkCode(-2103, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_CONTROL_FAILURE_ERROR)); - public static final HDLLinkCode HDL_GET_GATEWAY_FAILURE_ERROR=new HDLLinkCode(-2104, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_GET_GATEWAY_FAILURE_ERROR)); - public static final HDLLinkCode HDL_GET_Zigbee_FAILURE_ERROR=new HDLLinkCode(-2105, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_GET_Zigbee_FAILURE_ERROR)); - public static final HDLLinkCode HDL_GATEWAY_NOT_EXIST=new HDLLinkCode(-2106,HDLLinkLocalSdk.getInstance().getContext().getString( R.string.HDL_GATEWAY_NOT_EXIST)); - public static final HDLLinkCode HDL_GET_Zigbee_DEVICE_LIST_FAILURE_ERROR=new HDLLinkCode(-2107, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_GET_Zigbee_DEVICE_LIST_FAILURE_ERROR)); - public static final HDLLinkCode HDL_MILLIMETER_NOT_EXIST=new HDLLinkCode(-2108, HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_MILLIMETER_NOT_EXIST)); - public static final HDLLinkCode HDL_APPLICATION_CODE=new HDLLinkCode(-2109,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_APPLICATION_EXCEPTION)); - public static final HDLLinkCode HDL_TOPIC_NOT_RIGHT=new HDLLinkCode(-2110,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_TOPIC_NOT_RIGHT)); - public static final HDLLinkCode HDL_OBJECT_NOT_SUPPORT=new HDLLinkCode(-2111,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_OBJECT_NOT_SUPPORT)); - public static final HDLLinkCode HDL_GATEWAY_REMOTE_NOT_RESPONSE=new HDLLinkCode(-2112,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.HDL_GATEWAY_REMOTE_NOT_RESPONSE)); - public static final HDLLinkCode HDL_SUCCESS=new HDLLinkCode(0,HDLLinkLocalSdk.getInstance().getContext().getString(R.string.SUCCESS)); - private String msg; - private int code; - - public HDLLinkCode(int code, String msg) { - this.msg = msg; - this.code = code; - } - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java deleted file mode 100644 index e4f6a9d..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/ByteUtils.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.hdl.sdk.link.common.utils; - -import java.io.UnsupportedEncodingException; -import java.nio.ByteBuffer; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.Key; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.crypto.BadPaddingException; -import javax.crypto.Cipher; -import javax.crypto.IllegalBlockSizeException; -import javax.crypto.NoSuchPaddingException; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.SecretKeySpec; - -/** - * Created by Tong on 2021/9/23. - */ -public class ByteUtils { - - public static byte[] toByteArray(List<Byte> list) { - Byte[] temps = list.toArray(new Byte[0]); - byte[] result = new byte[temps.length]; - for (int i = 0; i < result.length; i++) { - result[i] = temps[i]; - } - return result; - - } - - - public static List<Byte> toByteList(byte[] bytes) { - final List<Byte> list = new ArrayList<>(); - for (byte aByte : bytes) { - list.add(aByte); - } - return list; - - } - - public static byte[] getRangeBytes(List<Byte> list, int start, int end) { - Byte[] temps = Arrays.copyOfRange(list.toArray(new Byte[0]), start, end); - byte[] result = new byte[temps.length]; - for (int i = 0; i < temps.length; i++) { - result[i] = temps[i]; - } - return result; - - } - - public static byte[] copyBytes(byte bytes[], int index, int length) { - byte[] result = new byte[length]; - for (int i = 0; i < result.length; i++) { - result[i] = bytes[index + i]; - } - return result; - } - - /** - * 鎷兼帴byte - */ - public static byte[] concatBytes(byte[] bt1, byte[] bt2) { - if (bt1 == null) { - return bt2; - } - if (bt2 == null) { - return bt1; - } - byte[] bt3 = new byte[bt1.length + bt2.length]; - System.arraycopy(bt1, 0, bt3, 0, bt1.length); - System.arraycopy(bt2, 0, bt3, bt1.length, bt2.length); - return bt3; - } - - - public boolean endWith(Byte[] src, byte[] target) { - if (src.length < target.length) { - return false; - } - for (int i = 0; i < target.length; i++) { - if (target[target.length - i - 1] != src[src.length - i - 1]) { - return false; - } - } - return true; - } - - - public static int byteIndexOf(byte[] searched, byte[] find, int start) { - boolean matched; - int end = find.length - 1; - int skip = 0; - for (int index = start; index <= searched.length - find.length; ++index) { - matched = true; - if (find[0] != searched[index] || find[end] != searched[index + end]) continue; - else skip++; - if (end > 10) - if (find[skip] != searched[index + skip] || find[end - skip] != searched[index + end - skip]) - continue; - else skip++; - for (int subIndex = skip; subIndex < find.length - skip; ++subIndex) { - if (find[subIndex] != searched[index + subIndex]) { - matched = false; - break; - } - } - if (matched) { - return index; - } - } - return -1; - - } - - public static int getByteIndexOf(byte[] sources, byte[] src) { - return getByteIndexOf(sources, src, 0, sources.length); - } - - //鍒ゆ柇涓�涓猙yte鏁板�煎湪鍙﹀涓�涓猙yte鏁扮粍涓搴旂殑娓告爣鍊� - public static int getByteIndexOf(byte[] sources, byte[] src, int startIndex) { - return getByteIndexOf(sources, src, startIndex, sources.length); - } - - - //鍒ゆ柇涓�涓猙yte鏁板�煎湪鍙﹀涓�涓猙yte鏁扮粍涓搴旂殑娓告爣鍊硷紝鎸囧畾寮�濮嬬殑娓告爣鍜岀粨鏉熺殑娓告爣浣嶇疆 - public static int getByteIndexOf(byte[] sources, byte[] src, int startIndex, int endIndex) { - - if (sources == null || src == null || sources.length == 0 || src.length == 0) { - return -1; - } - - if (endIndex > sources.length) { - endIndex = sources.length; - } - - int i, j; - for (i = startIndex; i < endIndex; i++) { - if (sources[i] == src[0] && i + src.length < endIndex) { - for (j = 1; j < src.length; j++) { - if (sources[i + j] != src[j]) { - break; - } - } - - if (j == src.length) { - return i; - } - } - } - return -1; - } - - /** - * 瀛楃涓瞭o Bytes - * - * @param str 瀛楃涓� - * @return - */ - public static byte[] stringToBytes(String str) { - try { - // 浣跨敤鎸囧畾鐨勫瓧绗﹂泦灏嗘瀛楃涓茬紪鐮佷负byte搴忓垪骞跺瓨鍒颁竴涓猙yte鏁扮粍涓� - return str.getBytes("utf-8"); - } catch (UnsupportedEncodingException e) { - e.printStackTrace(); - } - return new byte[]{}; - } - - public static String byte2hex(byte[] bytes) { - StringBuilder sb = new StringBuilder(); - String tmp = null; - for (byte b : bytes) { - //灏嗘瘡涓瓧鑺備笌0xFF杩涜涓庤繍绠楋紝鐒跺悗杞寲涓�10杩涘埗锛岀劧鍚庡�熷姪浜嶪nteger鍐嶈浆鍖栦负16杩涘埗 - tmp = Integer.toHexString(0xFF & b); - if (tmp.length() == 1) { - tmp = "0" + tmp; - } - sb.append(tmp + " "); - } - return sb.toString(); - } - - - public static int bytes2int(byte[] bytes) { - return bytes[3] & 0xFF | // - (bytes[2] & 0xFF) << 8 | // - (bytes[1] & 0xFF) << 16 | // - (bytes[0] & 0xFF) << 24; // - } - - - public static byte[] intToByteArray(int i) { - byte[] result = new byte[4]; - result[0] = (byte) ((i >> 24) & 0xFF); - result[1] = (byte) ((i >> 16) & 0xFF); - result[2] = (byte) ((i >> 8) & 0xFF); - result[3] = (byte) (i & 0xFF); - return result; - } - - public static int byteArrayToInt(byte[] b) { - int i = (b[0] & 0xFF) * 256 * 256 * 256 + (b[1] & 0xFF) * 256 * 256 + (b[2] & 0xFF) * 256 + (b[3] & 0xFF); - return i; - } - - /** - * 瑙e瘑 - * - * @param contentByte 寰呰В瀵嗗緟瀛楃涓瞙exStr - * @param contentByte 瀵嗛挜 - * @return - */ - public static byte[] decrypt(byte[] contentByte) { - try { - //KEY杞崲 - Key key = new SecretKeySpec("HDLRDCENTER1985.".getBytes(), "AES"); - //瑙e瘑 - Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); - IvParameterSpec ivps = new IvParameterSpec("HDLRDCENTER1985.".getBytes()); - cipher.init(Cipher.DECRYPT_MODE, key, ivps); - byte[] result = cipher.doFinal(contentByte); - return result; - } catch (NoSuchAlgorithmException e) { - LogUtils.e(e.getMessage()); - } catch (InvalidKeyException e) { - LogUtils.e(e.getMessage()); - } catch (NoSuchPaddingException e) { - LogUtils.e(e.getMessage()); - } catch (BadPaddingException e) { - LogUtils.e(e.getMessage()); - } catch (IllegalBlockSizeException e) { - LogUtils.e(e.getMessage()); - } catch (InvalidAlgorithmParameterException e) { - LogUtils.e(e.getMessage()); - } - return null; - } - -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/LinkRequest.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/LinkRequest.java deleted file mode 100644 index 2f8e8d7..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/LinkRequest.java +++ /dev/null @@ -1,150 +0,0 @@ -package com.hdl.sdk.link.core.bean; - -import android.text.TextUtils; - -import com.hdl.sdk.link.common.utils.ByteUtils; - - -/** - * Created by Tong on 2021/9/29. - */ -public class LinkRequest { - private String topic; - private String replyTopic; - protected byte []data; - private int length=0; - - private boolean encrypt; - - public String getCloudTopic() { - if(TextUtils.isEmpty(cloudTopic)){ - return topic; - } - return cloudTopic; - } - - /** - * 骞冲彴topic - * @param cloudTopic - */ - public void setCloudTopic(String cloudTopic) { - this.cloudTopic = cloudTopic; - } - - private String cloudTopic; - - - public LinkRequest(String topic,String replyTopic, String data, boolean encrypt) { - this.topic = topic; - this.replyTopic=replyTopic; - setData(data); - this.encrypt = encrypt; - } - - public LinkRequest(String topic, String data, boolean encrypt) { - this(topic,null,data,encrypt); - } - public LinkRequest(String topic, byte []data, boolean encrypt) { - this.topic = topic; - setData(data); - this.encrypt = encrypt; - } - - protected LinkRequest(){} - - public String getTopic() { - return topic; - } - - public void setTopic(String topic) { - this.topic = topic; - } - - public byte[] getData() { - return data; - } - - public void setData(String data) { - if (!TextUtils.isEmpty(data)) { - this.data = ByteUtils.stringToBytes(data); - setLength(this.data.length); - } - } - - public void setData(byte []data) { - this.data = data; - if(data!=null){ - setLength(data.length); - } - } - - public int getLength() { - return length; - } - - private void setLength(int length) { - this.length = length; - } - - /** - * 鍔犲瘑鏍囪瘑 - * - * @return - */ - public boolean isEncrypt() { - return encrypt; - } - - /** - * 鍔犲瘑鏍囪瘑 - * - * @param encrypt - */ - public void setEncrypt(boolean encrypt) { - this.encrypt = encrypt; - } - - public String getReplyTopic() { - if(TextUtils.isEmpty(replyTopic)){ - return topic+"_reply"; - } - return replyTopic; - } - - public void setReplyTopic(String replyTopic) { - this.replyTopic = replyTopic; - } - - public byte [] getSendBytes() { - try { - String header = "Topic:" + - getTopic() + - "\r\n" + - "Length:" + - getLength() + - "\r\n\r\n"; - return ByteUtils.concatBytes(header.getBytes("utf-8"), getData()); - } catch (Exception e) { - return new byte[]{}; - } - } - - public byte [] getCloudSendBytes() { - try { - //link閫忎紶鍛戒护锛屽唴瀹归渶瑕佸寘鍚富棰橈紝闀垮害 - if(getCloudTopic().contains("/native/a/down/slaveoid/")){ - return getSendBytes(); - }else { - return getData(); - } - } catch (Exception e) { - return new byte[]{}; - } - } - - - private int getBytesLength(String str) { - return ByteUtils.stringToBytes(str).length; - } - -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/LinkResponse.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/LinkResponse.java deleted file mode 100644 index ad2f655..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/LinkResponse.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.hdl.sdk.link.core.bean; - -import android.text.TextUtils; - -import androidx.annotation.NonNull; - -import com.hdl.sdk.link.common.utils.gson.GsonConvert; - -import java.io.Serializable; - -/** - * Created by Tong on 2021/9/27. - */ -public class LinkResponse implements Serializable { - - private String topic; - private String data; - private int length; - private byte []byteData; - private int code; - private int msg; - - public String getTopic() { - return topic; - } - - public void setTopic(String topic) { - this.topic = topic; - } - - public String getData() { - return data; - } - - public void setByteData(byte []data) { - this.byteData = data; - this.data = new String(data); - this.length=data.length; - } - - public byte []getByteData() { - return byteData; - } - - public void setData(String data) { - this.data = data; - if (!TextUtils.isEmpty(data)) { - this.byteData = data.getBytes(); - setLength(data.length()); - } else { - setLength(0); - } - - } - - public int getLength() { - return length; - } - - private void setLength(int length) { - this.length = length; - } - - @NonNull - @Override - public String toString() { - return GsonConvert.getGson().toJson(this); - } - - /** - * 鍝嶅簲鐘舵�佺爜 - * @return - */ - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - /** - * 鍝嶅簲娑堟伅 - * @return - */ - public int getMsg() { - return msg; - } - - public void setMsg(int msg) { - this.msg = msg; - } -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAddAIMillimeterZTSuccessInfo.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAddAIMillimeterZTSuccessInfo.java deleted file mode 100644 index 5daca20..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAddAIMillimeterZTSuccessInfo.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hdl.sdk.link.core.bean.eventbus; - -import java.io.Serializable; - -/** - * Created by Zoro - * Created on 2023/9/18 - * description: - */ -public class EventNotifyAddAIMillimeterZTSuccessInfo implements Serializable { - public EventNotifyAddAIMillimeterZTSuccessInfo() { - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAddSlaveGatewaySuccessInfo.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAddSlaveGatewaySuccessInfo.java deleted file mode 100644 index c0b93ce..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAddSlaveGatewaySuccessInfo.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.hdl.sdk.link.core.bean.eventbus; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/6/29 - * description: - */ -public class EventNotifyAddSlaveGatewaySuccessInfo implements Serializable { - - private String mac; - private String auth_code; - private String result; - private String message; - - public EventNotifyAddSlaveGatewaySuccessInfo(String mac, String auth_code, String result, String message) { - this.mac = mac; - this.auth_code = auth_code; - this.result = result; - this.message = message; - } - - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - - public String getAuth_code() { - return auth_code == null ? "" : auth_code; - } - - public void setAuth_code(@NonNull String auth_code) { - this.auth_code = auth_code; - } - - public String getResult() { - return result == null ? "" : result; - } - - public void setResult(@NonNull String result) { - this.result = result; - } - - public String getMessage() { - return message == null ? "" : message; - } - - public void setMessage(@NonNull String message) { - this.message = message; - } - - public EventNotifyAddSlaveGatewaySuccessInfo() { - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAiMillimeterZTMacInfo.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAiMillimeterZTMacInfo.java deleted file mode 100644 index a0004af..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/eventbus/EventNotifyAiMillimeterZTMacInfo.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hdl.sdk.link.core.bean.eventbus; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/10/19 - * description: - */ -public class EventNotifyAiMillimeterZTMacInfo implements Serializable { - private String mac; - - public EventNotifyAiMillimeterZTMacInfo(String mac) { - this.mac = mac; - } - - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/DeviceRemoteInfo.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/DeviceRemoteInfo.java deleted file mode 100644 index 465809b..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/DeviceRemoteInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.hdl.sdk.link.core.bean.gateway; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/10/25 - * description: - */ -public class DeviceRemoteInfo implements Serializable { - - private String gatewayId; - private boolean encrypt;//鏄惁鍔犲瘑 - private int algorithmType;//0.SM4 1.AES 2.涓嶅姞瀵� - private String spk; - private String mac;//璁惧mac - private String secret;//绉侀挜 - - public String getGatewayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGatewayId(@NonNull String gatewayId) { - this.gatewayId = gatewayId; - } - - public boolean isEncrypt() { - return encrypt; - } - - public void setEncrypt(@NonNull boolean encrypt) { - this.encrypt = encrypt; - } - - public int getAlgorithmType() { - return algorithmType; - } - - public void setAlgorithmType(@NonNull int algorithmType) { - this.algorithmType = algorithmType; - } - - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(@NonNull String spk) { - this.spk = spk; - } - - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - - public String getSecret() { - return secret == null ? "" : secret; - } - - public void setSecret(@NonNull String secret) { - this.secret = secret; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/GatewayBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/GatewayBean.java deleted file mode 100644 index a16c7fd..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/GatewayBean.java +++ /dev/null @@ -1,478 +0,0 @@ -package com.hdl.sdk.link.core.bean.gateway; - -import android.text.TextUtils; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by hxb on 2021/12/15. - * 缃戝叧瀵硅薄 - */ -public class GatewayBean implements Serializable { - - - /** - * true-鍦ㄧ嚎 - * false-绂荤嚎 - */ - private boolean online = true; - /** - * 缃戝叧鍨嬪彿 - */ - private String device_model; - /** - * 缃戝叧澶囨敞 - */ - private String device_name; - /** - * 缃戝叧Mac - */ - private String device_mac; - /** - * 缃戝叧Id - */ - private String gatewayId; - /** - * 缃戝叧绫诲瀷 - */ - private String gatewayType; - private String gateway_type; - /** - * 缃戝叧oid - */ - private String oid; - /** - * IP鍦板潃 - */ - private String ip_address; - /** - * 杩炴帴鐨勭綉鍏崇被鍨� LAN WIFI - */ - private String access_mode; - /** - * 鏄惁涓荤綉鍏� true false - */ - private String master; - /** - * 鏄惁鍔犲瘑 - */ - private boolean isLocalEncrypt; - /** - * 鏄惁鏈湴缃戝叧 - */ - private boolean isLocalGateWay; - /** - * 浣忓畢Id - */ - private String homeId; - - /** - * 浣跨敤mqtt鐨勬椂鍊欓渶瑕佽В瀵� - */ - private String aesKey; - private String deviceId; - - /** - * 姣背娉id - */ - private String sid; - - - - private String spk = "energy.hdl_inverter"; - - - private String systemStatusDesc;//浜戠-鐘舵�� - - - private String hwVersion;//浜戠-杞欢鐗堟湰鍙� - private String categorySecondName;//浜戠-璁惧绫诲瀷(浜у搧浜岀骇鍒嗙被鍚嶇О) - - /** - * 璁惧鏉ユ簮(鑷畾涔�:0=琛ㄧず缃戝叧;1=琛ㄧず骞冲彴) - */ - private String src; - - //瀛愮綉鍙�/璁惧鍙� - private String addresses; - - //缃戝叧鐘舵��:1:寰呮満,2:杩炴帴涓�,3:鏁呴殰,4:杩愯,5:绂荤嚎 - private int deviceStatus; - - private String powerPvNow;//鍙戠數鍔熺巼 - private String totalElectricityPvToday;//浠婃棩鍙戠數閲� - - /** - * 鎴块棿褰掑睘 - */ - private List<String> uids = new ArrayList<>(); - - public List<String> getUids() { - return uids; - } - - public void setUids(List<String> uids) { - this.uids = uids; - } - - public String getSrc() { - return src == null ? "" : this.src; - } - - public void setSrc(String src) { - this.src = src; - } - - public String getAesKey() { - return aesKey == null ? "" : aesKey; - } - - public void setAesKey(@NonNull String aesKey) { - this.aesKey = aesKey; - } - - public String getDeviceId() { - return deviceId == null ? "" : deviceId; - } - - public void setDeviceId(@NonNull String deviceId) { - this.deviceId = deviceId; - } - - public boolean getOnline() { - return online; - } - - public void setOnline(boolean online) { - this.online = online; - } - - /** - * 缃戝叧鍨嬪彿 - */ - public String getDevice_model() { - return device_model == null ? "" : device_model; - } - - /** - * 缃戝叧鍨嬪彿 - */ - public void setDevice_model(String device_model) { - this.device_model = device_model; - } - - /** - * 缃戝叧澶囨敞 - */ - public String getDevice_name() { - if (TextUtils.isEmpty(device_name)) { - return getDevice_model(); - } else { - - } - return device_name; - } - - /** - * 妯℃澘鍖归厤鏍囪 wxr 鑷畾涔� 2022-02-23 16:09:44 - */ - private boolean templateSettingFlag = false; - - public boolean isTemplateSettingFlag() { - return templateSettingFlag; - } - - public void setTemplateSettingFlag(boolean templateSettingFlag) { - this.templateSettingFlag = templateSettingFlag; - } - - private String templateAddr; - - public String getTemplateAddr() { - return templateAddr == null ? "" : templateAddr; - } - - public void setTemplateAddr(String templateAddr) { - this.templateAddr = templateAddr; - } - - - /** - * 缃戝叧澶囨敞 - */ - public void setDevice_name(String device_name) { - this.device_name = device_name; - } - - /** - * 缃戝叧Mac - * - * @return - */ - @NonNull - public String getDevice_mac() { - return TextUtils.isEmpty(device_mac) ? "" : device_mac; - } - - /** - * 缃戝叧Mac - */ - public void setDevice_mac(String device_mac) { - this.device_mac = device_mac; - } - - /** - * 缃戝叧Id - */ - @NonNull - public String getGatewayId() { - return TextUtils.isEmpty(gatewayId) ? getOid() : gatewayId; - } - - /** - * 缃戝叧Id - */ - public void setGatewayId(String gatewayId) { - this.gatewayId = gatewayId; - } - - /** - * 缃戝叧绫诲瀷 - */ - @NonNull - public String getGatewayType() { - return gatewayType == null ? gateway_type == null ? "" : gateway_type : gatewayType; - } - - /** - * 缃戝叧绫诲瀷 - */ - public void setGatewayType(String gatewayType) { - this.gatewayType = gatewayType; - } - - @NonNull - public String getGateway_type() { - return gateway_type == null ? "" : gateway_type; - } - - public void setGateway_type(String gateway_type) { - this.gateway_type = gateway_type; - } - - /** - * 缃戝叧Oid - */ - @NonNull - public String getOid() { - return TextUtils.isEmpty(oid) ? getDevice_mac() : oid; - } - - /** - * 缃戝叧Oid - */ - public void setOid(String oid) { - this.oid = oid; - } - - /** - * IP鍦板潃 - */ - @NonNull - public String getIp_address() { - return ip_address == null ? "" : ip_address; - } - - /** - * IP鍦板潃 - */ - public void setIp_address(String ip_address) { - this.ip_address = ip_address; - } - - /** - * 杩炴帴鐨勭綉鍏崇被鍨� LAN WIFI - */ - @NonNull - public String getAccess_mode() { - return access_mode == null ? "" : access_mode; - } - - /** - * 杩炴帴鐨勭綉鍏崇被鍨� LAN WIFI - */ - public void setAccess_mode(String access_mode) { - this.access_mode = access_mode; - } - - /** - * 鏄惁涓荤綉鍏� true false - */ - public String getMaster() { - return master == null ? "" : master; - } - - /** - * 鏄惁涓荤綉鍏� true false no_config - */ - public void setMaster(String master) { - this.master = master; - } - - /** - * 鏄惁鍔犲瘑 - */ - public boolean getIsLocalEncrypt() { - return isLocalEncrypt; - } - - /** - * 鏄惁鍔犲瘑 - */ - public void setIsLocalEncrypt(boolean localEncrypt) { - isLocalEncrypt = localEncrypt; - } - - /** - * 鑾峰彇浣忓畢Id - */ - @NonNull - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - /** - * 璁剧疆浣忓畢Id - */ - public void setHomeId(String homeId) { - this.homeId = homeId; - } - - /** - * 鑾峰彇姣背娉id - * - * @return sid - */ - public String getSid() { - return sid == null ? "" : this.sid; - } - - /** - * 璁剧疆姣背娉id - */ - public void setSid(String sid) { - this.sid = sid; - } - - /** - * 鏄惁鏈湴缃戝叧 true false - */ - public void setIsLocalGateWay(boolean isLocalGateWay) { - this.isLocalGateWay = isLocalGateWay; - } - - /** - * 鑾峰彇缃戝叧鏄惁鏈湴缃戝叧 - */ - public boolean getIsLocalGateway() { - return this.isLocalGateWay; - } - - - /* - * 妯℃澘鏍囪 wxr - * */ - private boolean templateFlag = false; - - public boolean isLocalEncrypt() { - return isLocalEncrypt; - } - - public void setLocalEncrypt(boolean localEncrypt) { - isLocalEncrypt = localEncrypt; - } - - - - public String getSystemStatusDesc() { - return systemStatusDesc == null ? "" : systemStatusDesc; - } - - - public void setSystemStatusDesc(String systemStatusDesc) { - this.systemStatusDesc = systemStatusDesc; - } - - - public String getHwVersion() { - return hwVersion == null ? "" : hwVersion; - } - - - public void setHwVersion(String hwVersion) { - this.hwVersion = hwVersion; - } - - - public String getCategorySecondName() { - return categorySecondName == null ? "" : categorySecondName; - } - - public void setCategorySecondName(String categorySecondName) { - this.categorySecondName = categorySecondName; - } - - - public String getAddresses() { - return addresses == null ? "" : addresses; - } - - - public void setAddresses(String addresses) { - this.addresses = addresses; - } - - - public int getDeviceStatus() { - return deviceStatus; - } - - - public void setDeviceStatus(int deviceStatus) { - this.deviceStatus = deviceStatus; - } - - - public String getPowerPvNow() { - return powerPvNow == null ? "" : powerPvNow; - } - - - public void setPowerPvNow(String powerPvNow) { - this.powerPvNow = powerPvNow; - } - - - public String getTotalElectricityPvToday() { - return totalElectricityPvToday == null ? "" : totalElectricityPvToday; - } - - - public void setTotalElectricityPvToday(String totalElectricityPvToday) { - this.totalElectricityPvToday = totalElectricityPvToday; - } - - - public String getSpk() { - return spk == null ? "" : spk; - } - - - public void setSpk(String spk) { - this.spk = spk; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/SlaveGatewayJoinAllBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/SlaveGatewayJoinAllBean.java deleted file mode 100644 index e707f63..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/SlaveGatewayJoinAllBean.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.hdl.sdk.link.core.bean.gateway; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/10/24 - * description: - */ -public class SlaveGatewayJoinAllBean implements Serializable { - private String id; - private String time_stamp; - private List<SlaveGatewayJoinBean> objects = new ArrayList<>(); - - public String getId() { - return id == null ? "" : id; - } - - public void setId(@NonNull String id) { - this.id = id; - } - - public String getTime_stamp() { - return time_stamp == null ? "" : time_stamp; - } - - public void setTime_stamp(@NonNull String time_stamp) { - this.time_stamp = time_stamp; - } - - public List<SlaveGatewayJoinBean> getObjects() { - if (objects == null) { - return objects = new ArrayList<>(); - } - return objects; - } - - public void setObjects(@NonNull List<SlaveGatewayJoinBean> objects) { - this.objects = objects; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/SlaveGatewayJoinBean.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/SlaveGatewayJoinBean.java deleted file mode 100644 index 0bccc53..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/bean/gateway/SlaveGatewayJoinBean.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.hdl.sdk.link.core.bean.gateway; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/10/24 - * description: - */ -public class SlaveGatewayJoinBean implements Serializable { - private String mac; - private String auth_code; - private String result; - private String message; - - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - - public String getAuth_code() { - return auth_code == null ? "" : auth_code; - } - - public void setAuth_code(@NonNull String auth_code) { - this.auth_code = auth_code; - } - - public String getResult() { - return result == null ? "" : result; - } - - public void setResult(@NonNull String result) { - this.result = result; - } - - public String getMessage() { - return message == null ? "" : message; - } - - public void setMessage(@NonNull String message) { - this.message = message; - } -} \ No newline at end of file diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/callback/HDLLinkCallBack.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/callback/HDLLinkCallBack.java deleted file mode 100644 index 4bdf82f..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/callback/HDLLinkCallBack.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.hdl.sdk.link.core.callback; - -/** - * Created by jlchen on 11/16/21. - * - * @Description : HDLLinkCallBack - */ -public interface HDLLinkCallBack extends BaseCallBack{ - void onSuccess(String msg); -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java deleted file mode 100644 index 8bdc067..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/connect/HDLConnectHelper.java +++ /dev/null @@ -1,493 +0,0 @@ -package com.hdl.sdk.link.core.connect; - -import android.text.TextUtils; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.hdl.sdk.link.common.event.EventDispatcher; -import com.hdl.sdk.link.common.event.EventListener; -import com.hdl.sdk.link.common.exception.HDLLinkCode; -import com.hdl.sdk.link.common.utils.ErrorUtils; -import com.hdl.sdk.link.common.utils.LogUtils; -import com.hdl.sdk.link.common.utils.ThreadToolUtils; -import com.hdl.sdk.link.core.bean.LinkRequest; -import com.hdl.sdk.link.core.bean.LinkResponse; -import com.hdl.sdk.link.core.bean.ModbusResponse; -import com.hdl.sdk.link.core.bean.ZigbeeResponse; -import com.hdl.sdk.link.core.bean.gateway.GatewayBean; -import com.hdl.sdk.link.core.config.HDLLinkConfig; -import com.hdl.sdk.link.core.utils.EncryptUtil; -import com.hdl.sdk.link.core.utils.mqtt.MqttRecvClient; -import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Created by Tong on 2021/11/11. - */ -public class HDLConnectHelper { - - private static final Long DEF_SEND_TIMEOUT = 8000L; - private static final int DEF_MAX_RETRY = 1;//鏈�澶ч噸鍙戞暟 - private static final int DEF_SEND_ONE = 1; - private static final int TCP_PORT = 8586; - private static final int UDP_PORT = 8585; - - private final Long sendAwaitTime; - private final int maxRetry; - - /** - * 鏄惁tcp鍙戦�佺被鍨� - */ - private boolean isTcp; - /** - * 璁惧mac - */ - private String mac; - /** - * 鍙戦�佺殑鐩爣IP - */ - private String ipAddress; - /** - * 鍙戦�佺殑鐩爣鍦板潃 - */ - private int port; - private final LinkRequest linkRequest; - private final EventListener eventListener; - - private final AtomicInteger sendNumber = new AtomicInteger(0); - - private final AtomicBoolean isSend = new AtomicBoolean(false); - - private HdlSocketListener listener; - - private ScheduledExecutorService sendThread; - - private String replyTopic; - - public interface HdlSocketListener { - void onSucceed(Object msg); - - void onFailure(HDLLinkCode hdlLinkCode); - } - - /** - * 鍙戦�乁DP鎴栬�匱CP鏁版嵁 - * - * @param sendAwaitTime 姣忔鍙戦�佺瓑寰呮椂闂� - * @param maxRetry 閲嶈瘯娆℃暟 - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param port 鍙戦�佺洰鏍囩鍙� - * @param linkRequest 鍙戦�佸璞� - * @param listener 鍥炶皟 - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(Long sendAwaitTime, int maxRetry, String ipAddress, int port, - LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp) { - this.sendAwaitTime = sendAwaitTime; - this.maxRetry = maxRetry; - this.ipAddress = ipAddress; - this.port = port; - this.linkRequest = linkRequest; - this.replyTopic = linkRequest.getReplyTopic(); - this.listener = listener; - this.isTcp = isTcp; - - - eventListener = new EventListener() { - @Override - public void onMessage(Object msg) { - isSend.set(true); - try { - if (msg instanceof LinkResponse) { - LinkResponse linkResponse = (LinkResponse) msg; - JSONObject jsonObject = JSON.parseObject(linkResponse.getData()); - String id = jsonObject.getString("id"); - Integer code = jsonObject.getInteger("code"); - /** - * 鍙兘杩斿洖code灞炴�у彲鑳芥病鏈� 娌℃湁鐨勮瘽鐩存帴鎴愬姛 鏈夌殑璇濆彧鏈�200鎵嶄細鎴愬姛 - */ - if (code == null || code.intValue() == 200 || code.intValue() == 0) { - notifySucceed(msg); - } else { - notifyFailure(ErrorUtils.getByCode(code)); - } - } else if (msg instanceof ZigbeeResponse) { - ZigbeeResponse linkResponse = (ZigbeeResponse) msg; - //TODO 濡傛灉閰嶇疆浠庣綉鍏崇殑淇℃伅锛岄�氳繃涓荤綉鍏宠浆杈撅紝杩欓噷oid瑕佸垽鏂笅 - if (replyTopic.equals(linkResponse.getTopic())) { - notifySucceed(linkResponse.getData()); - } else { - notifyFailure(HDLLinkCode.HDL_TOPIC_NOT_RIGHT); - } - } else if (msg instanceof ModbusResponse) { - ModbusResponse response = (ModbusResponse) msg; - if (replyTopic.equals(response.getTopic())) { - notifySucceed(response.getData()); - } else { - notifyFailure(HDLLinkCode.HDL_TOPIC_NOT_RIGHT); - } - } else { - notifyFailure(new HDLLinkCode(HDLLinkCode.HDL_OBJECT_NOT_SUPPORT.getCode(), "Object Name:" + msg)); - } - } catch (Exception e) { - notifyFailure(new HDLLinkCode(HDLLinkCode.HDL_APPLICATION_CODE.getCode(), e.getMessage())); - } - } - }; - //娉ㄥ唽鐩戝惉 - registerListener(); - } - - /** - * 鍙戦�乁DP鎴栬�匱CP鏁版嵁(鍙傛暟鏈塵ac) - * - * @param sendAwaitTime 姣忔鍙戦�佺瓑寰呮椂闂� - * @param maxRetry 閲嶈瘯娆℃暟 - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param port 鍙戦�佺洰鏍囩鍙� - * @param linkRequest 鍙戦�佸璞� - * @param listener 鍥炶皟 - * @param isTcp 鏄惁TCP - * @param mac 璁惧mac - */ - public HDLConnectHelper(Long sendAwaitTime, int maxRetry, String ipAddress, int port, - LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp, String mac) { - this(sendAwaitTime, maxRetry, ipAddress, port, linkRequest, listener, isTcp); - this.mac = mac; - } - - /** - * 鎸夌収鎸囧畾娆℃暟鍙戯紝鍥炶皟 - * - * @param maxRetry 閲嶈瘯娆℃暟 - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param port 鍙戦�佺洰鏍囩鍙� - * @param linkRequest 鍙戦�佸璞� - * @param listener 鍥炶皟 - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(int maxRetry, String ipAddress, int port, - LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp) { - this(DEF_SEND_TIMEOUT, maxRetry, ipAddress, port, linkRequest, listener, isTcp); - } - - /** - * 鎸夌収鎸囧畾娆℃暟鍙戯紝鍥炶皟 - * - * @param maxRetry 閲嶈瘯娆℃暟 - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param linkRequest 鍙戦�佸璞� - * @param listener 鍥炶皟 - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(int maxRetry, String ipAddress, - LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp) { - this(maxRetry, ipAddress, isTcp ? TCP_PORT : UDP_PORT, linkRequest, listener, isTcp); - } - - /** - * 鎸夌収鎸囧畾娆℃暟鍙戯紝涓嶅洖璋� - * - * @param maxRetry 閲嶈瘯娆℃暟 - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param linkRequest 鍙戦�佸璞� - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(int maxRetry, String ipAddress, - LinkRequest linkRequest, boolean isTcp) { - this(maxRetry, ipAddress, linkRequest, null, isTcp); - } - - /** - * 鎸夌収榛樿閲嶅彂鏈哄埗鍙戦�� - * - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param port 鍙戦�佺洰鏍囩鍙� - * @param linkRequest 鍙戦�佸璞� - * @param listener 鍥炶皟 - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(String ipAddress, int port, - LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp) { - this(DEF_MAX_RETRY, ipAddress, port, linkRequest, listener, isTcp); - } - - /** - * 榛樿绔彛鍙戦�� - * - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param linkRequest 鍙戦�佸璞� - * @param listener 鍥炶皟 - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(String ipAddress, - LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp) { - this(DEF_SEND_TIMEOUT, DEF_MAX_RETRY, ipAddress, isTcp ? TCP_PORT : UDP_PORT, linkRequest, listener, isTcp); - } - - /** - * 榛樿绔彛鍙戦��(鍙傛暟鏈塵ac) - * - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param linkRequest 鍙戦�佸璞� - * @param listener 鍥炶皟 - * @param isTcp 鏄惁TCP - * @param mac 璁惧mac - */ - public HDLConnectHelper(String ipAddress, - LinkRequest linkRequest, HdlSocketListener listener, boolean isTcp, String mac) { - this(DEF_SEND_TIMEOUT, DEF_MAX_RETRY, ipAddress, isTcp ? TCP_PORT : UDP_PORT, linkRequest, listener, isTcp, mac); - } - - - /** - * 鍙戦�佷竴娆� - * - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param linkRequest 鍙戦�佸璞� - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(String ipAddress, LinkRequest linkRequest, boolean isTcp) { - this(DEF_SEND_TIMEOUT, DEF_SEND_ONE, ipAddress, isTcp ? TCP_PORT : UDP_PORT, linkRequest, null, isTcp); - } - - /** - * 鍙戦�佷竴娆� - * - * @param ipAddress 鍙戦�佺洰鏍嘔P - * @param linkRequest 鍙戦�佸璞� - * @param isTcp 鏄惁TCP - */ - public HDLConnectHelper(Long timeout, String ipAddress, LinkRequest linkRequest, boolean isTcp) { - this(timeout, DEF_SEND_ONE, ipAddress, isTcp ? TCP_PORT : UDP_PORT, linkRequest, null, isTcp); - } - - - /** - * 娉ㄥ唽鐩戝惉 - */ - private void registerListener() { - if (!TextUtils.isEmpty(replyTopic) && null != listener) { - EventDispatcher.getInstance().register(replyTopic, eventListener); - } - } - - /** - * 绉婚櫎鐩戝惉 - */ - private void removeListener() { - if (!TextUtils.isEmpty(replyTopic)) { - EventDispatcher.getInstance().remove(replyTopic, eventListener); - } - } - - public static boolean isLocal() { - String ip = HDLLinkConfig.getInstance().getIpAddress(); - if (ip == null) { - //濡傛槸鏈湴鏄彲浠ユ悳绱㈠埌ip鐨� - return false; - } - - //鏈湴鏄彲浠ヨ繙绋嬫垚鍔熺殑 - return HDLTcpConnect.getTcpSocketBoot(ip).isConnected(); - } - - public void send() { - - getSendThread().scheduleWithFixedDelay(new Runnable() { - @Override - public void run() { - //鍙戦�佹鏁板皬浜庨噸鍙戞鏁� - if ((sendNumber.get() < maxRetry)) { - try { - - //杩樻病鏈夋敹鍒板洖澶嶏紝鍐嶅彂閫� - if (!isSend.get()) { - sendNumber.set(sendNumber.get() + 1); - - //濡傛槸tcp鎴栬�卪qtt - if (isTcp) { - //mqtt - if (TextUtils.isEmpty(ipAddress) || !HDLTcpConnect.getTcpSocketBoot(ipAddress).isConnected()) { - if (!linkRequest.getTopic().endsWith("heartbeat")) {//蹇冭烦涓婚鏁版嵁杩囧锛岃繃婊や笅 - //LogUtils.i("蹇冭烦鍖呭彂閫佹暟鎹細\r\n" + new String(linkRequest.getCloudSendBytes())); - } else { - return;//浜戠鎯呭喌涓嬶紝蹇冭烦鍙互涓嶇敤 - } - String requestTopic = linkRequest.getCloudTopic(); - byte[] encryBytes = null; - GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getLocalGateway(mac); - if (gatewayBean != null && getMillimeterTypeList().contains(gatewayBean.getGatewayType())) { - /** - * 姣背娉㈣繖杈硅幏鍙栨暟鎹殑鏃跺�� 宸茬粡璁剧疆浜嗕富浠庡瘑閽ヨ繘鍘讳簡 杩欒竟涓嶄綔澶勭悊 - */ - encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), gatewayBean.getAesKey()); - } else { - encryBytes = EncryptUtil.encryBytes(linkRequest.getCloudSendBytes(), HDLLinkConfig.getInstance().getAesKey()); - } - if (MqttRecvClient.getInstance() != null) { - MqttRecvClient.getInstance().send(requestTopic, encryBytes); - if (HDLConnectHelper.isInverterTopic(linkRequest.getCloudTopic())) { - LogUtils.i("杩滅▼鍙戦�佹暟鎹細" + linkRequest.getCloudTopic() + "\r\n" + Arrays.toString(byteArrayConvertIntArray(linkRequest.getCloudSendBytes()))); - } else { - LogUtils.i("杩滅▼鍙戦�佹暟鎹細" + linkRequest.getCloudTopic() + "\r\n" + new String(linkRequest.getCloudSendBytes())); - } - } - } - //鏈湴TCP - else { - linkRequest.setEncrypt(false);// 2024骞�01鏈�31鏃�16:34:22 榛樿鏄庢枃閫氳,鍥犱负鍒涘缓鐢电珯,缁戝畾閫嗗彉鍣ㄦ椂锛岄渶瑕佽缃弬鏁扮粰閫嗗彉鍣�,杩欐椂鍊欒繕娌℃湁绉橀挜; - if (!linkRequest.getTopic().endsWith("heartbeat")) {//蹇冭烦涓婚鏁版嵁杩囧锛岃繃婊や笅 - LogUtils.i("鏈湴鍙戦�佹暟鎹細\r\n" + new String(linkRequest.getSendBytes())); - } - HDLTcpConnect.getTcpSocketBoot(ipAddress).sendMsg(EncryptUtil.getEncryBytes(linkRequest)); - } - } else { - //濡傛灉鏄痷dp - LogUtils.i("鏈湴鍙戦�佹暟鎹甎DP锛�" + new String(linkRequest.getSendBytes())); - HDLUdpConnect.getInstance().getUdpBoot().sendMsg(ipAddress, port, EncryptUtil.getEncryBytes(linkRequest)); - } - } - } catch (Exception e) { - LogUtils.e("鏁版嵁鍙戦�佸紓甯革細", e.getMessage()); - } - } else { - //瓒呭嚭閲嶅彂娆℃暟骞舵病鏈夋敹鍒板洖澶� - if (!isSend.get()) { - if (linkRequest.getTopic().endsWith("heartbeat")) {//蹇冭烦涓婚鍏堜笉閫氱煡 - notifyFailure(null); - } else { - if (!TextUtils.isEmpty(replyTopic) && null != listener) {//闇�瑕佹墦鍗板嚭澶辫触鐨勬棩蹇� - LogUtils.e("鍙戦�佸け璐ユ暟鎹富棰�:" + linkRequest.getTopic()); - } - if (isTcp) { - //mqtt - if (TextUtils.isEmpty(ipAddress) || !HDLTcpConnect.getTcpSocketBoot(ipAddress).isConnected()) { - notifyFailure(HDLLinkCode.HDL_GATEWAY_REMOTE_NOT_RESPONSE); - } - //鏈湴TCP锛屽苟鏄繛鎺ョ姸鎬� - else { - notifyFailure(HDLLinkCode.HDL_TIMEOUT_ERROR); - } - } else { - notifyFailure(HDLLinkCode.HDL_TIMEOUT_ERROR); - } - } - } - } - } - }, 0, sendAwaitTime, TimeUnit.MILLISECONDS); - //initialdelay - 棣栨鎵ц鐨勫欢杩熸椂闂� 0 - //delay - 涓�娆℃墽琛岀粓姝㈠拰涓嬩竴娆℃墽琛屽紑濮嬩箣闂寸殑寤惰繜 - } - - /** - * 鑾峰彇鍙戦�佺嚎绋� - * - * @return 杩斿洖鑾峰彇鍒扮殑绾跨▼ - */ - private ScheduledExecutorService getSendThread() { - if (sendThread == null) { - sendThread = ThreadToolUtils.getInstance().newScheduledThreadPool(1); - } - return sendThread; - } - - /** - * 鍙戦�佸け璐� - */ - private void notifyFailure(HDLLinkCode hdlLinkCode) { - //绉婚櫎鐩戝惉 - removeListener(); - if (sendThread != null) { - sendThread.shutdownNow(); - sendThread = null; - } - if (listener != null && hdlLinkCode != null) { - listener.onFailure(hdlLinkCode); - listener = null; - } - } - - - - /** - * 鏀寔姣背绫诲瀷 - * - * @return 绫诲瀷鍒楄〃 - */ - public static List<String> getGatewayTypeList() { - List<String> typeList = new ArrayList<>(); -// typeList.add("sensor.mmv_sleep");//鐫$湢姣背娉pk -// typeList.add("sensor.mmv_pose");//濮挎�佹绫虫尝spk - typeList.add("energy.hdl_inverter");//閫嗗彉鍣╯pk - typeList.add("sensor.mmv_sleep");//鐫$湢姣背娉pk - typeList.add("sensor.mmv_pose");//濮挎�佹绫虫尝spk - typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰 - return typeList; - } - - public static List<String> getMillimeterTypeList() { - List<String> typeList = new ArrayList<>(); -// typeList.add("AGATEWAY");//缃戝叧 - typeList.add("sensor.mmv_sleep");//鐫$湢姣背娉pk - typeList.add("sensor.mmv_pose");//濮挎�佹绫虫尝spk - typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰 - return typeList; - } - - public static List<String> getNewMillimeterTypeList() { - List<String> typeList = new ArrayList<>(); - typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰 - return typeList; - } - - private void notifySucceed(Object msg) { - //绉婚櫎鐩戝惉 - removeListener(); - if (sendThread != null) { - sendThread.shutdownNow(); - sendThread = null; - } - if (listener != null) { - listener.onSucceed(msg); - listener = null; - } - } - - - - public static boolean isInverterTopic(String topic) { - if (TextUtils.isEmpty(topic)) { - return false; - } - return topic.endsWith("custom/native/inverter/down_reply") - || topic.endsWith("custom/native/inverter/down") - || topic.endsWith("custom/native/inverter/up"); - } - - /** - * byte鏁扮粍杞崲鎴恑nt鏁扮粍(涓轰簡鎵撳嵃鍑烘棤绗﹀彿鐨刡tye鏁扮粍鏁版嵁) - * - * @param bytes 鏁扮粍 - * @return - */ - public static Integer[] byteArrayConvertIntArray(byte[] bytes) { - if (bytes == null || bytes.length == 0) { - return new Integer[]{}; - } - Integer[] arr = new Integer[bytes.length]; - for (int i = 0; i < bytes.length; i++) { - arr[i] = bytes[i] & 0xff; - } - return arr; - } -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/utils/QueueUtils.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/utils/QueueUtils.java deleted file mode 100644 index 1ec7160..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/utils/QueueUtils.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.hdl.sdk.link.core.utils; - -import com.hdl.sdk.link.common.event.EventDispatcher; -import com.hdl.sdk.link.common.utils.LogUtils; -import com.hdl.sdk.link.common.utils.ThreadToolUtils; -import com.hdl.sdk.link.core.bean.LinkPacket; -import com.hdl.sdk.link.core.bean.LinkResponse; -import com.hdl.sdk.link.core.config.HDLLinkConfig; -import com.hdl.sdk.link.core.connect.HDLConnectHelper; - -import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.LinkedList; -import java.util.Queue; -import java.util.concurrent.ExecutorService; - -/** - * Created by hxb on 2022/8/4. - */ -public class QueueUtils { - - //杩樻病瑙e瘑鐨勬暟鎹寘 - private final Queue<LinkPacket> linkPackets; - private final ExecutorService executorService; - //鏄惁宸茬粡鍚姩 - private boolean started; - /** - * instance - */ - private volatile static QueueUtils instance; - - private QueueUtils() { - linkPackets = new LinkedList<>(); - executorService = ThreadToolUtils.getInstance().newFixedThreadPool(1); - } - - /** - * getInstance - * - * @return AuthenticateConfig - */ - public static synchronized QueueUtils getInstance() { - if (instance == null) { - synchronized (QueueUtils.class) { - if (instance == null) { - instance = new QueueUtils(); - } - } - } - return instance; - } - - /** - * 澧炲姞鎺ユ敹鍒扮殑姣忔潯鏁版嵁 - * - * @param linkPacket - */ - public void add(LinkPacket linkPacket) { - synchronized (linkPackets) { - linkPackets.add(linkPacket); - } - } - - public LinkPacket poll() { - synchronized (linkPackets) { - return linkPackets.poll(); - } - } - - /** - * 鍚姩澶勭悊鎺ユ敹鍒扮殑鏁版嵁 - */ - public synchronized void start() { - if (started) { - return; - } - started = true; - executorService.execute(new Runnable() { - @Override - public void run() { - while (true) { - try { - LinkPacket linkPacket = poll(); - if (linkPacket == null) { - Thread.sleep(10); - continue; - } - manager(linkPacket); - } catch (Exception e) { - LogUtils.e("澶勭悊鎺ユ敹鍒扮殑鏁版嵁寮傚父:\r\n" + e.getMessage()); - } - } - } - }); - } - - private void manager(LinkPacket linkPacket) throws UnsupportedEncodingException { - - LinkResponse response = new LinkResponse(); - response.setTopic(linkPacket.getTopic()); -// GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getGatewayByIpAddress(linkPacket.isIpAddress()); -// boolean isEncrypt = false; -// if (gatewayBean != null) { -// isEncrypt = gatewayBean.getIsLocalEncrypt(); -// } -// if (EncryptUtil.ifNeedEncrypt(response.getTopic(), isEncrypt)) { -// if (gatewayBean != null && gatewayBean.getIsLocalEncrypt() && encrypt(linkPacket.getBody())) { - if (!linkPacket.isCloudPacket() && encrypt(linkPacket.getBody())) { - //闇�瑕佽В瀵� - byte[] bodyBytes = AesUtil.aesDecrypt(linkPacket.getBody(), HDLLinkConfig.getInstance().getLocalSecret()); - if (bodyBytes != null) { - response.setData(new String(bodyBytes, StandardCharsets.UTF_8)); - response.setByteData(bodyBytes); - } else { - LogUtils.e("瑙e瘑澶辫触\r\n" + linkPacket.getTopic() + "\r\n" + ByteUtils.encodeHexString(linkPacket.getBody())); - response.setByteData(linkPacket.getBody()); - response.setData(new String(linkPacket.getBody(), "utf-8")); - } - } else { - response.setByteData(linkPacket.getBody()); - response.setData(new String(linkPacket.getBody(), "utf-8")); - } - - if (!linkPacket.isCloudPacket()) { - if (HDLConnectHelper.isInverterTopic(response.getTopic())) { - LogUtils.i("鏈湴鎺ユ敹鍒版暟鎹�:\r\n" + response.getTopic() + "\r\n" + Arrays.toString(HDLConnectHelper.byteArrayConvertIntArray(response.getByteData()))); - } else { - LogUtils.i("鏈湴鎺ユ敹鍒版暟鎹�:\r\n" + response.getTopic() + "\r\n" + response.getData()); - } -// if (!"/user/all/custom/gateway/broadcast".equals(response.getTopic())) { -// LogUtils.i("鏈湴鎺ユ敹鍒版暟鎹�:\r\n" + response.getTopic() + "\r\n" + response.getData()); -// } -// if(response.getTopic().contains("/custom/scene/list/get_reply")){ -// response.setData(response.getData()+"\":1}"); -// } -// LogUtils.i("鏈湴鎺ユ敹鍒版暟鎹�:\r\n" + response.getTopic() + "\r\n" + response.getData()+ "\r\n" + response.getData().length()); - } - if (response.getTopic().contains("/user/all/custom/gateway/")) { -// LogUtils.i("鏈湴鎺ユ敹鍒版暟鎹�:\r\n" + response.getTopic() + "\r\n" + response.getData() + "\r\n" + response.getData().length()); - } else if (response.getTopic().contains("thing/property/up")) { -// LogUtils.i("鏈湴鎺ユ敹鍒版暟鎹�:\r\n" + response.getTopic() + "\r\n" + response.getData() + "\r\n" + response.getData().length()); - } else { - LogUtils.i("鏈湴鎺ユ敹鍒版暟鎹�:\r\n" + response.getTopic() + "\r\n" + response.getData() + "\r\n" + response.getData().length()); - } - //瑙f瀽瀹屾垚,topic鍙戦�佷竴娆� - EventDispatcher.getInstance().post(response.getTopic(), response); - } - - //鏄惁鍔犲瘑 - private boolean encrypt(byte[] bytes) { - if (bytes[0] == '{' && bytes[bytes.length - 1] == '}' || (bytes[0] == '[' && bytes[bytes.length - 1] == ']')) { - return false; - } - return true; - } -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/utils/mqtt/MqttRecvClient.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/utils/mqtt/MqttRecvClient.java deleted file mode 100644 index 09cc1e0..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/core/utils/mqtt/MqttRecvClient.java +++ /dev/null @@ -1,431 +0,0 @@ -package com.hdl.sdk.link.core.utils.mqtt; - -import android.content.Context; -import android.text.TextUtils; - -import com.alibaba.fastjson.JSON; - -import com.hdl.sdk.link.common.utils.LogUtils; -import com.hdl.sdk.link.core.bean.LinkPacket; -import com.hdl.sdk.link.core.bean.eventbus.BaseEventBus; -import com.hdl.sdk.link.core.bean.eventbus.EventBindMiniRemoteSuccessInfo; -import com.hdl.sdk.link.core.bean.eventbus.EventNotifyRefreshGatewayAesKeyInfo; -import com.hdl.sdk.link.core.bean.gateway.GatewayBean; -import com.hdl.sdk.link.core.config.HDLLinkConfig; -import com.hdl.sdk.link.core.connect.HDLConnectHelper; -import com.hdl.sdk.link.core.protocol.LinkMessageDecoder; -import com.hdl.sdk.link.core.utils.AesUtil; -import com.hdl.sdk.link.core.utils.QueueUtils; -import com.hdl.sdk.link.gateway.HDLLinkLocalGateway; -import com.hdl.sdk.link.socket.bean.Packet; - -import org.eclipse.paho.client.mqttv3.IMqttActionListener; -import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken; -import org.eclipse.paho.client.mqttv3.IMqttToken; -import org.eclipse.paho.client.mqttv3.MqttAsyncClient; -import org.eclipse.paho.client.mqttv3.MqttCallbackExtended; -import org.eclipse.paho.client.mqttv3.MqttConnectOptions; -import org.eclipse.paho.client.mqttv3.MqttException; -import org.eclipse.paho.client.mqttv3.MqttMessage; -import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; -import org.greenrobot.eventbus.EventBus; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Created by Zoro on 2018/8/1. - * desc:2019/7/24 杩炴帴鎴愬姛浠ュ悗鍐嶈闃� 涓嶉渶瑕佸彂閫佸績璺� 涓嶉渶瑕佽嚜宸卞鐞嗛噸杩� - */ - -public class MqttRecvClient { - private static String mBroker; - private MemoryPersistence persistence = new MemoryPersistence(); - private MqttAsyncClient sampleClient; - private MqttConnectOptions connOpts = new MqttConnectOptions(); - private MqttThread mqttThread; - private static volatile MqttRecvClient mqttRecvClient; - private final String TAG = "MqttRecvClient"; - private static final String[] ignoreTopics = new String[]{"/thing/topo/found", "/ota/device/progress/up"}; - /** - * 涓婃鐨勪富棰橀渶瑕佽褰� 鏇存敼涓婚鐨勬椂鍊欓渶瑕佸彇娑堣闃� - */ - private static List<String> lastTopicFilters = new ArrayList<>(); - private static String mClientId; - private static String mUserName; - private static String mPassWord; - private final int[] qos = {0}; - - private MqttRecvClient() { - if (mqttThread == null) { - mqttThread = new MqttThread(); - } - if (TextUtils.isEmpty(mUserName) || TextUtils.isEmpty(mPassWord)) { - return; - } - mqttThread.start(); - } - - public static void init(Context context, String broker1, String deviceId, String userName, String pwd) { - mClientId = deviceId; - mBroker = broker1; - mUserName = userName; - mPassWord = pwd; - MqttRecvClient.create(); - } - - public void send(String topic, byte[] bytes) { - try { - if (TextUtils.isEmpty(topic)) { - LogUtils.e("璇锋眰涓婚涓簄ull"); - return; - } - checkAndsubscribeAllTopics(topic); - publish(topic, bytes); - } catch (MqttException e) { - e.printStackTrace(); - } - } - - /** - * 鍙戝竷 - * - * @param topic 涓婚 - * @param bytes 鍐呭 - * @throws MqttException - */ - public void publish(String topic, byte[] bytes) throws MqttException { - //鍥炲鏃讹紝mqtt涓婚涓殑鏂瑰悜瑕佸彉鍖栵紝瑕佸仛鏂瑰悜鏇挎崲 - mqttRecvClient.sampleClient.publish(topic, bytes, 1, false, null, new IMqttActionListener() { - @Override - public void onSuccess(IMqttToken asyncActionToken) { - LogUtils.d(TAG, topic); - } - - @Override - public void onFailure(IMqttToken asyncActionToken, Throwable exception) { - } - }); - } - - public static void create() { - if (mqttRecvClient == null) { - mqttRecvClient = new MqttRecvClient(); - } - } - - /** - * 浣跨敤鐨勬椂鍊欓渶瑕佸垽鏂潪绌� - */ - public static MqttRecvClient getInstance() { - if (null == mqttRecvClient) { - synchronized (MqttRecvClient.class) { - if (null == mqttRecvClient) { - mqttRecvClient = new MqttRecvClient(); - } - return mqttRecvClient; - } - } - return mqttRecvClient; - } - - class MqttThread extends Thread { - @Override - public void run() { - super.run(); - connect(); - } - } - - private void connect() { - try { - if (sampleClient != null) { - sampleClient.close(); - } - sampleClient = new MqttAsyncClient(mBroker, mClientId, persistence); - connOpts.setUserName(mUserName); -// connOpts.setServerURIs(new String[]{mBroker}); - connOpts.setPassword(mPassWord.toCharArray()); - connOpts.setCleanSession(true); - connOpts.setKeepAliveInterval(10); - connOpts.setAutomaticReconnect(true); - connOpts.setConnectionTimeout(60); - connOpts.setMqttVersion(MqttConnectOptions.MQTT_VERSION_3_1_1); - sampleClient.setCallback(new MqttCallbackExtended() { - public void connectComplete(boolean reconnect, String serverURI) { - LogUtils.d(TAG, "connect success"); - checkAndsubscribeAllTopics(""); - } - - public void connectionLost(Throwable throwable) { - LogUtils.d(TAG, "杩炴帴鏂紑"); - lastTopicFilters.clear(); - } - - public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { - managerMqttMsg(topic, mqttMessage); - } - - public void deliveryComplete(IMqttDeliveryToken iMqttDeliveryToken) { - } - }); - sampleClient.connect(connOpts); - - } catch (Exception me) { - me.printStackTrace(); - } - } - - /** - * 澶勭悊鎺ユ敹鐨刴qtt鏁版嵁 - * - * @param topic 鎺ユ敹涓婚 - * @param mqttMessage 鎺ユ敹鏁版嵁 - * @throws Exception - */ - public void managerMqttMsg(String topic, MqttMessage mqttMessage) throws Exception { - LogUtils.d(TAG, "\r\n" + "mqtt->杩滅▼鍥炲涓婚" + topic); - if (HDLConnectHelper.isLocal()) { - boolean needReturn = true; - //濡傛灉鏄湰鍦版ā寮忥紝浜戠涓嬫潵鐨勭綉鍏虫暟鎹儴鍒嗘暟鎹笉鎺ユ敹(濡傦細ota鍗囩骇鍙嶉杩涘害) - for (String ignoreTopic : ignoreTopics) { - if (topic.endsWith(ignoreTopic)) { - needReturn = false; - break; - } - } - if (needReturn) { - return; - } - } - if (topic.contains("/custom/mqtt/secret/change")) { - /** - * 缃戝叧閲嶈繛mqtt 闇�瑕佹洿鎹esKey 涓嶇劧缃戝叧鏃犳硶瑙e瘑 閫氱煡鍒锋柊缃戝叧鍒楄〃骞朵笖鏇存柊涓荤綉鍏崇殑aesKey - */ - String[] topics = topic.split("/"); - //闈炲綋鍓嶄綇瀹呯綉鍏崇殑鏁版嵁杩斿洖 - if (topics.length < 3) { - return; - } - LogUtils.d(TAG, "缃戝叧閲嶈繛mqtt绉橀挜鏇存柊閫氱煡->" + topic); - - BaseEventBus baseEventBus=new BaseEventBus(); - baseEventBus.setTopic(topic); - EventBus.getDefault().post(baseEventBus); - - EventNotifyRefreshGatewayAesKeyInfo eventNotifyRefreshGatewayAesKeyInfo = new EventNotifyRefreshGatewayAesKeyInfo(); - eventNotifyRefreshGatewayAesKeyInfo.setGatewayId(topics[2]); - EventBus.getDefault().post(eventNotifyRefreshGatewayAesKeyInfo); - return; - } - - String[] topics = topic.split("/"); - //闈炲綋鍓嶄綇瀹呯綉鍏崇殑鏁版嵁杩斿洖 - if (topics.length < 3) { - return; - } - String aes = null; - String cloudsGatewayId = topics[2];//浜戠涓奊atewayId - GatewayBean gatewayBean = HDLLinkLocalGateway.getInstance().getGatewayByOidOrGatewayId(cloudsGatewayId); - if (cloudsGatewayId.equals(HDLLinkConfig.getInstance().getHomeId())) { - aes = getHomeAES(); - } - else if (gatewayBean != null && HDLConnectHelper.getGatewayTypeList().contains(gatewayBean.getGatewayType())) { - //姣背娉qtt涓撶敤绉橀挜銆侀�嗗彉鍣╩qtt涓撶敤绉橀挜 - aes = gatewayBean.getAesKey(); - } else { - aes = HDLLinkConfig.getInstance().getAesKey(); - } - if (TextUtils.isEmpty(aes)) { - return; - } - - byte[] bytes = AesUtil.aesDecrypt(mqttMessage.getPayload(), aes); - if (null == bytes) { - LogUtils.d(TAG, "\r\n" + "mqtt->杩滅▼鍥炲鏁版嵁 瀵嗛挜瑙e瘑澶辫触"); - return; - } - String bodyStr = new String(bytes); - if (HDLConnectHelper.isInverterTopic(topic)) { - LogUtils.d(TAG, "\r\n" + "mqtt->杩滅▼鍥炲鏁版嵁" + Arrays.toString(HDLConnectHelper.byteArrayConvertIntArray(bytes))); - } else { - LogUtils.d(TAG, "\r\n" + "mqtt->杩滅▼鍥炲鏁版嵁" + bodyStr); - } - /** - * 绾㈠瀹濊澶囬�氳繃/thing/topo/found涓婚 涓婃姤绾㈠瀹濊澶囧凡缁忓叆缃戜簡 鐒跺悗鐩存帴return 涓嶉渶瑕佸啀涓嬭浜� - */ - if (topic.endsWith("/thing/topo/found")) { - /** - * {"id":"0000016E","time_stamp":"366574","objects":[{"sid":"010105D370451908110100000000", - * "name":"Mini鏅鸿兘閬ユ帶鍣�","spk":"ir.module","oid":"010105D370451908","omodel":"MIR01R-LK.10", - * "online":"true","attributes":[],"status":[],"from":"010105D370451908","src":"010105D370451908"}]} - */ - if (bodyStr.contains("ir.module")) { - EventBus.getDefault().post(new EventBindMiniRemoteSuccessInfo()); - return; - } - } - //Link浠庣綉鍏抽�忎紶鐗规畩澶勭悊 - if (topic.contains("/native/a/") && topic.contains("/slaveoid/")) { - LinkMessageDecoder.getInstance().read(new Packet(bytes)); - } else { - byte[] topBytes = new byte[3]; - if (bytes.length > 2) { - topBytes[0] = bytes[0]; - topBytes[1] = bytes[1]; - topBytes[2] = bytes[2]; - } - if (new String(topBytes).equals("hex")) {//link鍘熺敓鏁版嵁锛屽垽鏂槸鍚︽槸鏂囦欢澶勭悊閫氱煡 - LinkMessageDecoder.getInstance().read(new Packet(bytes)); - } else { - QueueUtils.getInstance().add(new LinkPacket(topic, bytes, true)); - } - } - } - - /** - * 妫�鏌ヤ富棰樻槸鍚﹀凡璁㈤槄锛屾病鏈夎闃呭氨璁㈤槄 - * - * @param sendTopic 璇锋眰涓婚 - */ - public synchronized void checkAndsubscribeAllTopics(String sendTopic) { - if (null == sampleClient) { - return; - } - if (null != sampleClient && sampleClient.isConnected() == false) { - return; - } - try { - for (String topic : nativeAndLinkTopic(sendTopic)) { - if (lastTopicFilters.contains(topic)) { - continue; - } - LogUtils.d(TAG, "璁㈤槄涓婚" + topic); - - sampleClient.subscribe(topic, 0, null, new IMqttActionListener() { - @Override - public void onSuccess(IMqttToken asyncActionToken) { - if (!lastTopicFilters.contains(topic)) { - lastTopicFilters.add(topic); - } - } - - @Override - public void onFailure(IMqttToken asyncActionToken, Throwable exception) { - - } - }); - } - - } catch (MqttException e) { - e.printStackTrace(); - } - } - - /** - * 璁㈤槄骞冲彴涓嬫潵鐨勪富棰� - * - * @return string鏁扮粍 - */ - private String[] nativeAndLinkTopic(String sendTopic) { - String[] topicArray = sendTopic.split("/"); - //闈炲綋鍓嶄綇瀹呯綉鍏崇殑鏁版嵁杩斿洖 - if (topicArray.length < 3) { - return new String[]{ - String.format("/user/%s/#", HDLLinkConfig.getInstance().getGatewayId()), - String.format("/base/%s/#", HDLLinkConfig.getInstance().getGatewayId())}; - } - - String gatewayId = topicArray[2];//浜戠涓奊atewayId - String[] topics = { - String.format("/user/%s/#", HDLLinkConfig.getInstance().getGatewayId()), - String.format("/base/%s/#", HDLLinkConfig.getInstance().getGatewayId()), - String.format("/user/%s/#", gatewayId), - String.format("/base/%s/#", gatewayId), - }; - return topics; - } - - - /** - * APP璁㈤槄浜戠涓婚瑙e瘑瀵嗘枃鐨勭閽�(杩欎釜瀵嗛挜鍙兘鐢ㄤ簬璁㈤槄浜戠涓婚锛岃闃呯綉鍏充富棰樺彟澶栦竴涓瘑閽�) - * - * @return -杩斿洖瑙e瘑瀵嗘枃鐨勭閽� - */ - private String getHomeAES() { - String homeId = HDLLinkConfig.getInstance().getHomeId(); - if (TextUtils.isEmpty(homeId)) { - return null; - } - //瑙e瘑瀵嗛挜瑙勫垯锛氬凡鐜版湁鐨勪綇瀹匢D涓哄熀鍑�,浠庡彸杈逛竴涓�鑾峰彇鍊�,鏈�鍚庡鏋滀笉澶�16浣�,鍒欏線鍙宠ˉ闆� - StringBuilder aesKey = new StringBuilder(); - for (int i = homeId.length() - 1; i >= 0; i--) { - aesKey.append(homeId.charAt(i)); - if (aesKey.length() == 16) { - break; - } - } - return this.PadRight(aesKey.toString(), 16, "0"); - } - - /** - * 浠庡彸杈规坊鍔犵┖鏍兼垨鍏跺畠瀛楃 - * - * @param currentValueStr 褰撳墠鍊� - * @param count 鎬婚暱鏁� - * @param others 鍏跺畠瀛楃(鑷畾涔�) - * @return 鎬婚暱搴� - */ - private String PadRight(String currentValueStr, int count, String others) { - if (count > currentValueStr.length()) { - StringBuilder stringBuilder = new StringBuilder(); - int subLen = count - currentValueStr.length(); - for (int i = 0; i < subLen; i++) { - stringBuilder.append(others); - } - currentValueStr = currentValueStr + stringBuilder; - } - return currentValueStr; - - } - - /** - * 鍒囨崲浣忓畢鐨勬椂鍊欒闃呰鍏ㄩ儴鍙栨秷 - */ - public void removeAllTopic() { - if (null == sampleClient) { - return; - } - if (null != sampleClient && sampleClient.isConnected() == false) { - return; - } - try { - if (lastTopicFilters.size() == 0) { - return; - } - LogUtils.d(TAG, "绉婚櫎涓婚:\r\n" + JSON.toJSONString(lastTopicFilters)); - sampleClient.unsubscribe(lastTopicFilters.toArray(new String[lastTopicFilters.size()])); - lastTopicFilters.clear(); - } catch (MqttException e) { - e.printStackTrace(); - } - } - - public void stop() { - if (mqttRecvClient != null) { - try { - if (mqttRecvClient.sampleClient != null) { - mqttRecvClient.sampleClient.disconnect(); - mqttRecvClient.sampleClient.close(); - mqttRecvClient = null; - lastTopicFilters.clear(); - } - } catch (MqttException e) { - e.printStackTrace(); - } - } - } - - -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/gateway/HDLLinkLocalGateway.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/gateway/HDLLinkLocalGateway.java deleted file mode 100644 index 408ed2a..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/gateway/HDLLinkLocalGateway.java +++ /dev/null @@ -1,1156 +0,0 @@ -package com.hdl.sdk.link.gateway; - -import android.text.TextUtils; - -import com.google.gson.Gson; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.reflect.TypeToken; -import com.hdl.sdk.link.HDLLinkLocalSdk; -import com.hdl.sdk.link.R; -import com.hdl.sdk.link.common.config.TopicConstant; -import com.hdl.sdk.link.common.event.EventDispatcher; -import com.hdl.sdk.link.common.event.EventListener; -import com.hdl.sdk.link.common.exception.HDLLinkCode; -import com.hdl.sdk.link.common.exception.HDLLinkException; -import com.hdl.sdk.link.common.utils.IdUtils; -import com.hdl.sdk.link.common.utils.IpUtils; -import com.hdl.sdk.link.common.utils.LogUtils; -import com.hdl.sdk.link.common.utils.SPUtils; -import com.hdl.sdk.link.common.utils.ThreadToolUtils; -import com.hdl.sdk.link.common.utils.gson.GsonConvert; - -import com.hdl.sdk.link.core.bean.LinkRequest; -import com.hdl.sdk.link.core.bean.LinkResponse; -import com.hdl.sdk.link.core.bean.gateway.GatewayBean; -import com.hdl.sdk.link.core.bean.response.BaseLocalResponse; -import com.hdl.sdk.link.core.callback.GatewayCallBack; -import com.hdl.sdk.link.core.callback.HDLLinkCallBack; -import com.hdl.sdk.link.core.callback.HDLLinkTCallBack; -import com.hdl.sdk.link.core.config.HDLLinkConfig; -import com.hdl.sdk.link.core.connect.HDLConnectHelper; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by hxb on 2021/12/23. - */ -public class HDLLinkLocalGateway { - //instance - private volatile static HDLLinkLocalGateway instance; - - //getInstance - public static synchronized HDLLinkLocalGateway getInstance() { - if (instance == null) { - synchronized (HDLLinkLocalGateway.class) { - if (instance == null) { - instance = new HDLLinkLocalGateway(); - } - } - } - return instance; - } - - /** - * 缃戝叧鍒楄〃锛岃褰曟墍鏈夋悳绱㈠埌鐨勭綉鍏筹紝鍙兘鍖呭惈鏂嚎鐨勭綉鍏� - */ - private final List<GatewayBean> gatewayBeanList = new ArrayList(); - - /** - * 鑾峰彇缂撳瓨鐨勭綉鍏冲垪琛紝鍙兘鍖呭惈鏂嚎鐨勭綉鍏� - * - * @return 缃戝叧鍒楄〃 - */ - public List<GatewayBean> getGatewayList() { - return gatewayBeanList; - } - - /** - * 閫氳繃oid鎴栬�呯綉鍏矷D鎴栬�匒MC鑾峰彇鍐呭瓨涓殑缃戝叧锛屾敞鎰忥紝濡傛灉鏄繙绋嬮�氳锛実atewayBeanList瑕佸钩鍙颁笂缁戝畾鐨勪富缃戝叧鍙婁粠缃戝叧杩涘幓锛岃涓嶈幏鍙栦笉鍒扮綉鍏充俊鎭� - * - * @param oidOrGatewayId - * @return - */ - public GatewayBean getGatewayByOidOrGatewayId(String oidOrGatewayId) { - if (TextUtils.isEmpty(oidOrGatewayId)) { - return null; - } - for (GatewayBean gatewayBean : gatewayBeanList) { - if (oidOrGatewayId.equals(gatewayBean.getOid()) - || oidOrGatewayId.equals(gatewayBean.getGatewayId()) - || oidOrGatewayId.equals(gatewayBean.getDevice_mac()) - || oidOrGatewayId.equals(gatewayBean.getIp_address()) - ) - return gatewayBean; - } - return null; - } - - /** - * 閫氳繃IP鑾峰彇缃戝叧淇℃伅 - * - * @param ipAddress - * @return - */ - public GatewayBean getGatewayByIpAddress(String ipAddress) { - if (TextUtils.isEmpty(ipAddress)) { - return null; - } - for (GatewayBean gatewayBean : gatewayBeanList) { - if (ipAddress.equals(gatewayBean.getIp_address())) - return gatewayBean; - } - return null; - } - - /** - * 閫氳繃spk鑾峰彇缃戝叧锛岃繖涓篃鏀寔鑾峰彇姣背娉� - * - * @param spkList 闆嗗悎 - * @return 杩斿洖缃戝叧鍒楄〃 - */ - public List<GatewayBean> getGatewayBySpk(List<String> spkList) { - if (spkList.size() == 0) { - return this.getGatewayList(); - } - List<GatewayBean> gatewayBeanList = new ArrayList<>(); - for (GatewayBean gatewayBean : this.getGatewayList()) { - if (spkList.contains(gatewayBean.getGatewayType())) - gatewayBeanList.add(gatewayBean); - } - return gatewayBeanList; - } - - /** - * 鑾峰彇缃戝叧鍒楄〃 鍘绘帀绾㈠瀹濊繖绉嶈澶� - * - * @param spkList 闆嗗悎 - * @return 杩斿洖缃戝叧鍒楄〃 - */ - public List<GatewayBean> getGatewayByGatewayType(List<String> spkList) { - if (spkList.size() == 0) { - return this.getGatewayList(); - } - List<GatewayBean> gatewayBeanList = new ArrayList<>(); - for (GatewayBean gatewayBean : this.getGatewayList()) { - if ((spkList.contains(gatewayBean.getGatewayType())) - && !"MIR01R-LK.10".equals(gatewayBean.getDevice_model()) - && !"MSMWP-LK.30".equals(gatewayBean.getDevice_model())) - gatewayBeanList.add(gatewayBean); - } - return gatewayBeanList; - } - - /** - * 鑾峰彇鏈湴缃戝叧瀵硅薄(鍖呮嫭姣背娉�) - * - * @param macAndSid 璁惧mac - * @return 鎵惧埌杩斿洖GatewayBean, 鏈壘鍒拌繑鍥瀗ull. - */ - public GatewayBean getLocalGateway(String macAndSid) { - if (TextUtils.isEmpty(macAndSid)) { - return null; - } - for (GatewayBean gatewayBean : this.getGatewayList()) { - if (macAndSid.equals(gatewayBean.getDevice_mac()) - || macAndSid.equals(gatewayBean.getSid())) { - return gatewayBean; - } - } - return null; - } - - /** - * 鑾峰彇褰撳墠浣忓畢鐨勪富缃戝叧; - * - * @param homeId 浣忓畢id - * @return 鎵惧埌杩斿洖GatewayBean, 鏈壘鍒拌繑鍥瀗ull. - */ - public GatewayBean findMainGateway(String homeId) { - for (GatewayBean gatewayBean : this.getGatewayList()) { - if (gatewayBean.getMaster().equals("true") - && gatewayBean.getHomeId().equals(homeId) - && gatewayBean.getGatewayType().equals("AGATEWAY")) { - return gatewayBean; - } - } - return null; - } - - /** - * 鍒ゆ柇浣忓畢鏄惁鏈変富缃戝叧 - * - * @param homeId - * @return - */ - public boolean hasMainGateway(String homeId) { - boolean hasMain = false; - for (GatewayBean gatewayBean : this.getGatewayList()) { - if (gatewayBean.getMaster().equals("true") - && gatewayBean.getHomeId().equals(homeId) - && gatewayBean.getGatewayType().equals("AGATEWAY")) { - hasMain = true; - } - } - return hasMain; - } - - /** - * 鎼滅储缃戝叧锛屽彧鍙戜竴娆★紝娌℃湁鍥炶皟 - */ - public void serchGatewayOneTime() { - String time = String.valueOf(System.currentTimeMillis()); - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty("id", IdUtils.getUUId()); - jsonObject.addProperty("time_stamp", time); - LinkRequest message = new LinkRequest(TopicConstant.GATEWAY_SEARCH, - jsonObject.toString(), false); - - String ipAddress = IpUtils.getBroadcastAddress(); - new HDLConnectHelper(1, ipAddress, message, false).send(); - } - - - /** - * 鍒涙柊鎵�鏈夊湪绾跨殑缃戝叧锛屽寘鎷綋鍓嶄綇瀹呯殑鍙婃病鏈夌粦瀹氳繃鐨勭綉鍏� - * - * @param callBack 鍥炶皟 - */ - public void refreshGatewayByHome(String homeId, GatewayCallBack callBack) { - refreshGatewayByHome(homeId, true, callBack); - } - - /** - * 鏍规嵁浣忓畢id鑾峰彇缃戝叧 - * - * @param homeId 杩囨护鐨勪綇瀹卛d - * @param needEmptyHomeIdGateway 缃戝叧鐨勪綇瀹卛d涓虹┖鏃讹紝鏄惁鍙互鍔犲叆缃戝叧鍒楄〃 - * @param callBack 鍥炶皟鏂规硶 - */ - public void refreshGatewayByHome(String homeId, boolean needEmptyHomeIdGateway, GatewayCallBack callBack) { - refreshGatewayByHomeIdAndSpk(homeId, this.getGatewayTypeList(), needEmptyHomeIdGateway, callBack); - } - - /** - * 鏍规嵁浣忓畢id鑾峰彇缃戝叧 - * - * @param homeId 杩囨护鐨勪綇瀹卛d - * @param needEmptyHomeIdGateway 缃戝叧鐨勪綇瀹卛d涓虹┖鏃讹紝鏄惁鍙互鍔犲叆缃戝叧鍒楄〃 - * @param callBack 鍥炶皟鏂规硶 - */ - public void refreshWifiMillimeterZT(boolean needEmptyHomeIdGateway, GatewayCallBack callBack) { - refreshGatewayBySpk(this.getWifiMillimeterZTTypeList(), needEmptyHomeIdGateway, callBack); - } - - /** - * 鑾峰彇缃戠粶璁惧锛屽寘鎷綉鍏冲強姣背娉㈢瓑缃戠粶璁惧 - * - * @param spk 缃戠粶璁惧spk - * @param needEmptyHomeIdGateway 鏄惁闇�瑕佺┖浣忓畢Id璁惧 - * @param callBack 鍥炶皟 - */ - public void refreshGatewayBySpk(List<String> spk, boolean needEmptyHomeIdGateway, GatewayCallBack callBack) { - String topicReply = TopicConstant.GATEWAY_SEARCH_REPLY; - final List<GatewayBean> tempGatewayBeanList = new ArrayList<>(); - EventListener eventListener = getSearchGatewayEvent(spk, needEmptyHomeIdGateway, tempGatewayBeanList); - EventDispatcher.getInstance().register(topicReply, eventListener); - - ThreadToolUtils.getInstance().newFixedThreadPool(1).execute(new Runnable() { - @Override - public void run() { - int count = 5; - while (0 < count--) { - try { - //鎼滅储缃戝叧 - serchGatewayOneTime(); - Thread.sleep(300L); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - //瓒呭嚭娆℃暟鍚庣Щ闄ょ洃鍚簨浠� - EventDispatcher.getInstance().remove(topicReply, eventListener); - if (callBack != null) { - if (tempGatewayBeanList.size() == 0) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GET_GATEWAY_FAILURE_ERROR)); - } else { - callBack.onSuccess(tempGatewayBeanList); - } - } - } - }); - } - - /** - * 鑾峰彇缃戠粶璁惧锛屽寘鎷綉鍏冲強姣背娉㈢瓑缃戠粶璁惧 - * - * @param homeId 浣忓畢Id - * @param spk 缃戠粶璁惧spk - * @param needEmptyHomeIdGateway 鏄惁闇�瑕佺┖浣忓畢Id璁惧 - * @param callBack 鍥炶皟 - */ - public void refreshGatewayByHomeIdAndSpk(String homeId, List<String> spk, boolean needEmptyHomeIdGateway, GatewayCallBack callBack) { - String topicReply = TopicConstant.GATEWAY_SEARCH_REPLY; - final List<GatewayBean> tempGatewayBeanList = new ArrayList<>(); - EventListener eventListener = getSearchGatewayEvent(homeId, spk, needEmptyHomeIdGateway, tempGatewayBeanList); - EventDispatcher.getInstance().register(topicReply, eventListener); - - ThreadToolUtils.getInstance().newFixedThreadPool(1).execute(new Runnable() { - @Override - public void run() { - int count = 5; - while (0 < count--) { - try { - //鎼滅储缃戝叧 - serchGatewayOneTime(); - Thread.sleep(300L); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - //瓒呭嚭娆℃暟鍚庣Щ闄ょ洃鍚簨浠� - EventDispatcher.getInstance().remove(topicReply, eventListener); - if (callBack != null) { - if (tempGatewayBeanList.size() == 0) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GET_GATEWAY_FAILURE_ERROR)); - } else { - callBack.onSuccess(tempGatewayBeanList); - } - } - } - }); - } - - /** - * 鍒涙柊鎵�鏈夊湪绾跨殑缃戝叧锛屽寘鎷綋鍓嶄綇瀹呯殑鍙婃病鏈夌粦瀹氳繃鐨勭綉鍏� - * - * @param callBack 鍥炶皟 - */ - public void refreshGateway(GatewayCallBack callBack) { - refreshGateway(callBack,this.getGatewayTypeList()); - } - - - public void refreshGateway(GatewayCallBack callBack, List<String> spks) { - String topicReply = TopicConstant.GATEWAY_SEARCH_REPLY; - final List<GatewayBean> tempGatewayBeanList = new ArrayList<>(); - EventListener eventListener = getSearchGatewayEvent(spks, tempGatewayBeanList); - EventDispatcher.getInstance().register(topicReply, eventListener); - ThreadToolUtils.getInstance().newFixedThreadPool(1).execute(new Runnable() { - @Override - public void run() { - int count = 5; - while (0 < count--) { - try { - //鎼滅储缃戝叧 - serchGatewayOneTime(); - Thread.sleep(300L); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - - //瓒呭嚭娆℃暟鍚庣Щ闄ょ洃鍚簨浠� - EventDispatcher.getInstance().remove(topicReply, eventListener); - if (callBack != null) { - if (tempGatewayBeanList.size() == 0) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GET_GATEWAY_FAILURE_ERROR)); - } else { - - callBack.onSuccess(tempGatewayBeanList); - } - } - } - }); - } - -// /** -// * 鑾峰彇鎼滅储缃戝叧浜嬩欢 -// * -// * @param homeId -// * @return -// */ -// private EventListener getSearchGatewayEvent(String homeId, final List<GatewayBean> tempGatewayBeanList) { -// return getSearchGatewayEvent(homeId,true,tempGatewayBeanList); -// } - - -// /** -// * 鑾峰彇鎼滅储缃戝叧浜嬩欢 -// * -// * @param homeId -// * @return -// */ -// private EventListener getSearchGatewayEvent(String homeId, boolean needEmptyHomeIdGateway, final List<GatewayBean> tempGatewayBeanList) { -// //娉ㄥ唽鎼滅储缃戝叧鐩戝惉 -// return new EventListener() { -// @Override -// public void onMessage(Object msg) { -// if (!(msg instanceof LinkResponse)) { -// return; -// } -// GatewayBean gateway = getGatewayBeanByResponse((LinkResponse) msg); -// if (gateway == null) { -// return; -// } -// gateway.setOnline(true); -// gateway.setIsLocalGateWay(true);//鏈湴鎼滅储鍒扮殑缃戝叧鏍囪瘑涓烘湰鍦扮綉鍏� -// -// //鍙姞杞戒綇瀹呬竴鏍风殑鎴栬�呯綉鍏宠繕娌℃湁閰嶇疆杩囩殑锛屾垨鑰呬笉闇�瑕佷綇瀹卛d涓虹┖鐨勭綉鍏� -// if (homeId.equals(gateway.getHomeId()) || (needEmptyHomeIdGateway == true && TextUtils.isEmpty(gateway.getHomeId()))) { -// //鏇存柊缂撳瓨缃戝叧锛屼細璁板綍鎵�鏈夋敹鍒扮殑缃戝叧锛屼互涓轰簡淇濆瓨缃戝叧鐨処P淇℃伅 -// updateGatewayList(gatewayBeanList, gateway); -// //鏇存柊褰撳墠璇诲彇缃戝叧鐨勫垪琛紝杩欎釜鍒楄〃姣忔閮芥槸娓呯┖鍐嶈鍙� -// updateGatewayList(tempGatewayBeanList, gateway); -// } -// } -// }; -// } - - /** - * 鑾峰彇鎼滅储缃戝叧浜嬩欢 - * - * @return - */ - private EventListener getSearchGatewayEvent(List<String> spk, boolean needEmptyHomeIdGateway, final List<GatewayBean> tempGatewayBeanList) { - //娉ㄥ唽鎼滅储缃戝叧鐩戝惉 - return new EventListener() { - @Override - public void onMessage(Object msg) { - if (!(msg instanceof LinkResponse)) { - return; - } - GatewayBean gateway = getGatewayBeanByResponse((LinkResponse) msg); - if (gateway == null) { - return; - } - gateway.setOnline(true); - gateway.setIsLocalGateWay(true);//鏈湴鎼滅储鍒扮殑缃戝叧鏍囪瘑涓烘湰鍦扮綉鍏� - if ("av.zk.aiks".equals(gateway.getGatewayType())) { - /** 灏嗕富缃戝叧鐨刪omeid璁剧疆鍒板焹鍏嬫柉涓绘満 - */ -// gateway.setHomeId(homeId); - } - //鍙姞杞戒綇瀹呬竴鏍风殑鎴栬�呯綉鍏宠繕娌℃湁閰嶇疆杩囩殑锛屾垨鑰呬笉闇�瑕佷綇瀹卛d涓虹┖鐨勭綉鍏� - //鏇存柊缂撳瓨缃戝叧锛屼細璁板綍鎵�鏈夋敹鍒扮殑缃戝叧锛屼互涓轰簡淇濆瓨缃戝叧鐨処P淇℃伅 - updateGatewayList(gatewayBeanList, gateway); - //闈炴悳绱㈢殑缃戝叧绫讳技杩斿洖 - if (spk.contains(gateway.getGatewayType())) { - //鏇存柊褰撳墠璇诲彇缃戝叧鐨勫垪琛紝杩欎釜鍒楄〃姣忔閮芥槸娓呯┖鍐嶈鍙� - updateGatewayList(tempGatewayBeanList, gateway); - } - } - }; - } - - /** - * 鑾峰彇鎼滅储缃戝叧浜嬩欢 - * - * @param homeId - * @return - */ - private EventListener getSearchGatewayEvent(String homeId, List<String> spk, boolean needEmptyHomeIdGateway, final List<GatewayBean> tempGatewayBeanList) { - //娉ㄥ唽鎼滅储缃戝叧鐩戝惉 - return new EventListener() { - @Override - public void onMessage(Object msg) { - if (!(msg instanceof LinkResponse)) { - return; - } - GatewayBean gateway = getGatewayBeanByResponse((LinkResponse) msg); - if (gateway == null) { - return; - } - gateway.setOnline(true); - gateway.setIsLocalGateWay(true);//鏈湴鎼滅储鍒扮殑缃戝叧鏍囪瘑涓烘湰鍦扮綉鍏� - if ("av.zk.aiks".equals(gateway.getGatewayType())) { - /** 灏嗕富缃戝叧鐨刪omeid璁剧疆鍒板焹鍏嬫柉涓绘満 - */ -// gateway.setHomeId(homeId); - } - //鍙姞杞戒綇瀹呬竴鏍风殑鎴栬�呯綉鍏宠繕娌℃湁閰嶇疆杩囩殑锛屾垨鑰呬笉闇�瑕佷綇瀹卛d涓虹┖鐨勭綉鍏� - if (homeId.equals(gateway.getHomeId()) || (needEmptyHomeIdGateway == true && TextUtils.isEmpty(gateway.getHomeId()))) { - //鏇存柊缂撳瓨缃戝叧锛屼細璁板綍鎵�鏈夋敹鍒扮殑缃戝叧锛屼互涓轰簡淇濆瓨缃戝叧鐨処P淇℃伅 - updateGatewayList(gatewayBeanList, gateway); - //闈炴悳绱㈢殑缃戝叧绫诲瀷杩斿洖 - if (spk.contains(gateway.getGatewayType())) { - //鏇存柊褰撳墠璇诲彇缃戝叧鐨勫垪琛紝杩欎釜鍒楄〃姣忔閮芥槸娓呯┖鍐嶈鍙� - updateGatewayList(tempGatewayBeanList, gateway); - } - } - } - }; - } - - /** - * 鑾峰彇鎼滅储缃戝叧浜嬩欢 杩欒竟涓嶈繃婊omeId - * - * @return - */ - private EventListener getSearchGatewayEvent(List<String> spk, final List<GatewayBean> tempGatewayBeanList) { - //娉ㄥ唽鎼滅储缃戝叧鐩戝惉 - return new EventListener() { - @Override - public void onMessage(Object msg) { - if (!(msg instanceof LinkResponse)) { - return; - } - GatewayBean gateway = getGatewayBeanByResponse((LinkResponse) msg); - if (gateway == null) { - return; - } - gateway.setIsLocalGateWay(true);//鏈湴鎼滅储鍒扮殑缃戝叧鏍囪瘑涓烘湰鍦扮綉鍏� - //鍗囩骇缃戝叧椹卞姩 闇�瑕佹樉绀烘墍鏈夌綉鍏� - //鈿狅笍杩欒竟涓嶉渶瑕佹坊鍔犲埌gatewayBeanList 鍥犱负杩欎釜鏄綉鍏崇绾垮崌绾х殑鏃跺�欑殑鍔熻兘 -// updateGatewayList(gatewayBeanList, gateway); - //鏇存柊褰撳墠璇诲彇缃戝叧鐨勫垪琛紝杩欎釜鍒楄〃姣忔閮芥槸娓呯┖鍐嶈鍙� - if (spk.contains(gateway.getGatewayType())) { - //鏇存柊褰撳墠璇诲彇缃戝叧鐨勫垪琛紝杩欎釜鍒楄〃姣忔閮芥槸娓呯┖鍐嶈鍙� - updateGatewayList(tempGatewayBeanList, gateway); - } - } - }; - } - - /** - * 鏇存柊鏀跺埌鐨勭綉鍏冲埌鍒楄〃 - * - * @param gatewayBeans - * @param gateway 褰撳墠鏀跺埌鐨勭綉鍏� - */ - synchronized void updateGatewayList(final List<GatewayBean> gatewayBeans, GatewayBean gateway) { - - if (TextUtils.isEmpty(gateway.getOid()) || TextUtils.isEmpty(gateway.getDevice_mac())) { - LogUtils.e("缃戝叧Mac鎴栬�匫id涓虹┖锛屾棤鏁堢綉鍏�"); - return; - } - - boolean isFound = false;//鏄惁鍦ㄥ唴瀛樹腑鎵惧埌缃戝叧瀵硅薄 - //鎵惧嚭mac涓�鏍风殑缃戝叧鏇存柊鏈�鏂版暟鎹� - for (int i = 0; i < gatewayBeans.size(); i++) { - GatewayBean tempGatewayBean = gatewayBeans.get(i); - if (tempGatewayBean.getDevice_mac().equals(gateway.getDevice_mac())) { - /** - * 濡傛灉宸茬粡鏈塽id 闇�瑕佽缃� - */ - if(null!=tempGatewayBean.getUids()&&tempGatewayBean.getUids().size()>0){ - gateway.setUids(tempGatewayBean.getUids()); - } - isFound = true; - gatewayBeans.set(i, gateway); - gateway.setAesKey(tempGatewayBean.getAesKey());//淇濈暀浜戠鑾峰彇鐨刟eskey - -// break; - } - } - - //娓呴櫎oid涓�鏍凤紝mac涓嶄竴鏍风殑缃戝叧缂撳瓨銆備竴鑸槸鍦ㄧ綉鍏虫浛鎹㈢殑鎯呭喌绌洪棿鍑虹幇 - for (int i = 0; i < gatewayBeans.size(); i++) { - if (gatewayBeans.get(i).getDevice_mac().equals(gateway.getDevice_mac()) && !gatewayBeans.get(i).getOid().equals(gateway.getOid())) { - gatewayBeans.remove(i--); - } - } - - //娌℃湁鎵惧埌灏辨坊鍔� - if (!isFound) { - gatewayBeans.add(gateway); - } - } - - - /** - * 鑾峰彇缃戝叧瀵硅薄 - * - * @param linkResponse - * @return - */ - private GatewayBean getGatewayBeanByResponse(LinkResponse linkResponse) { - String data = linkResponse.getData(); - if (!TextUtils.isEmpty(data)) { - final BaseLocalResponse<GatewayBean> response = GsonConvert.getGson().fromJson(data, new TypeToken<BaseLocalResponse<GatewayBean>>() { - }.getType()); - return response.getObjects(); - } - return null; - } - - - /* - * 缁戝畾缃戝叧 - * */ - public void SetGatewayRemoteInfo(String master, String mac, String regionUrl, String ip, boolean isEncrypt, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_EDIT_REMOTE, mac); - - JsonObject jObject = new JsonObject(); - if (master.equals("true")) { - jObject.addProperty("server_addr", regionUrl); - jObject.addProperty("remote", "true"); - } else { - jObject.addProperty("server_addr", ""); - jObject.addProperty("remote", "false"); - } - - JsonObject sendJsonObj = new JsonObject(); - sendJsonObj.add("objects", jObject); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - String sendStr = sendJsonObj.toString(); - - LinkRequest message = new LinkRequest(topic, sendStr, isEncrypt); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - callBack.onSuccess("1"); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /* - * 缁戝畾缃戝叧 - * */ - public void SetGatewayRemoteInfo(String homeId, String master, String mac, String regionUrl, String ip, boolean isEncrypt, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_EDIT_REMOTE, mac); - - JsonObject jObject = new JsonObject(); - if (master.equals("true")) { - jObject.addProperty("server_addr", regionUrl); - jObject.addProperty("remote", "true"); - } else { - jObject.addProperty("server_addr", ""); - jObject.addProperty("remote", "false"); - } - jObject.addProperty("homeId", homeId); - JsonObject sendJsonObj = new JsonObject(); - sendJsonObj.add("objects", jObject); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - String sendStr = sendJsonObj.toString(); - - LinkRequest message = new LinkRequest(topic, sendStr, isEncrypt); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - callBack.onSuccess("1"); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /* - * 缁戝畾缃戝叧 - * 缂栬緫homeId缁欑綉鍏� - * */ - public void bindGateway(String master, String mac, String homeId, String regionUrl, String ip, boolean isEncrypt, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_EDIT_REMOTE, mac); - - JsonObject jObject = new JsonObject(); - jObject.addProperty("homeId", homeId); -// if(master.equals("true")) { -// jObject.addProperty("server_addr", regionUrl); -// jObject.addProperty("remote", "true"); -// }else { -// jObject.addProperty("server_addr", ""); -// jObject.addProperty("remote", "false"); -// } - - JsonObject sendJsonObj = new JsonObject(); - sendJsonObj.add("objects", jObject); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - String sendStr = sendJsonObj.toString(); - - LinkRequest message = new LinkRequest(topic, sendStr, isEncrypt); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - callBack.onSuccess("1"); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /* - * 缁戝畾姣背娉� - * 缂栬緫homeId缁欐绫虫尝 - * */ - public void bindMillimeterGateway(String homeId, String regionUrl, String ip, String mac, String master, boolean isEncrypt, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_EDIT_LOCAL, mac); - - JsonObject jObject = new JsonObject(); - jObject.addProperty("master", master); - - JsonObject sendJsonObj = new JsonObject(); - sendJsonObj.add("objects", jObject); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - String sendStr = sendJsonObj.toString(); - - LinkRequest message = new LinkRequest(topic, sendStr, isEncrypt); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if ("true".equals(master)) { - String longStr1 = SPUtils.getString("longitude"); - String latStr1 = SPUtils.getString("latitude"); - if (!TextUtils.isEmpty(longStr1) && !TextUtils.isEmpty(latStr1)) { - HDLLinkLocalSdk.getInstance().gatewayLocation(mac, longStr1, latStr1, isEncrypt, new HDLLinkTCallBack<String>() { - @Override - public void onSuccess(String data) { - } - - @Override - public void onError(HDLLinkException e) { - } - }); - } - } - if (callBack == null) return; - callBack.onSuccess("1"); - SetGatewayRemoteInfo(homeId, master, mac, regionUrl, ip, isEncrypt, new HDLLinkCallBack() { - @Override - public void onSuccess(String msg) { - - } - - @Override - public void onError(HDLLinkException e) { - - } - }); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /* - * 鍒濆鍖栫綉鍏� - * */ - public void initializeGateway(String mac, String oid, String ip, boolean isEncrypt, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_INITIALIZE_REMOTE, oid); - - JsonObject sendJsonObj = new JsonObject(); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - JsonObject jObject = new JsonObject(); - jObject.addProperty("device_mac", mac); - sendJsonObj.add("objects", jObject); - String sendStr = sendJsonObj.toString(); - - LinkRequest message = new LinkRequest(topic, sendStr, isEncrypt); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - callBack.onSuccess("1"); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /* - * 璁剧疆涓讳粠缃戝叧鏍囪 - * */ - public void setMasterGateway(String regionUrl, String ip, String mac, String master, boolean isEncrypt, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_EDIT_LOCAL, mac); - - JsonObject jObject = new JsonObject(); - jObject.addProperty("master", master); - - JsonObject sendJsonObj = new JsonObject(); - sendJsonObj.add("objects", jObject); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - String sendStr = sendJsonObj.toString(); - - LinkRequest message = new LinkRequest(topic, sendStr, isEncrypt); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if ("true".equals(master)) { - String longStr1 = SPUtils.getString("longitude"); - String latStr1 = SPUtils.getString("latitude"); - if (!TextUtils.isEmpty(longStr1) && !TextUtils.isEmpty(latStr1)) { - HDLLinkLocalSdk.getInstance().gatewayLocation(mac, longStr1, latStr1, isEncrypt, new HDLLinkTCallBack<String>() { - @Override - public void onSuccess(String data) { - } - - @Override - public void onError(HDLLinkException e) { - } - }); - } - } - if (callBack == null) return; - callBack.onSuccess("1"); - SetGatewayRemoteInfo(master, mac, regionUrl, ip, isEncrypt, new HDLLinkCallBack() { - @Override - public void onSuccess(String msg) { - - } - - @Override - public void onError(HDLLinkException e) { - - } - }); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /** - * 璁剧疆缃戝叧鍏ョ綉浠庢満妯″紡 - */ - public void AuthGateway(String ip, String mac, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_AUTH, mac); - - JsonObject sendJsonObj = new JsonObject(); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - JsonObject jObject = new JsonObject(); - jObject.addProperty("spk", "LINKDEVICE"); - jObject.addProperty("time", "120"); - sendJsonObj.add("objects", jObject); - - - String sendStr = sendJsonObj.toString(); - LinkRequest message = new LinkRequest(topic, sendStr, false); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - callBack.onSuccess(""); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /** - * 璁剧疆缃戝叧鍏ョ綉浠庢満妯″紡 - */ - public void AuthGateway(String ip, String mac) { - String topic = String.format(TopicConstant.GATEWAY_AUTH, mac); - - JsonObject sendJsonObj = new JsonObject(); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - JsonObject jObject = new JsonObject(); - jObject.addProperty("spk", "LINKDEVICE"); - jObject.addProperty("time", "120"); - sendJsonObj.add("objects", jObject); - - - String sendStr = sendJsonObj.toString(); - LinkRequest message = new LinkRequest(topic, sendStr, false); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - } - }, true).send(); - } - - /** - * 璁剧疆缃戝叧鍏ョ綉浠庢満妯″紡 缃戝叧338鍙互浣跨敤 - */ - public void AuthGatewayNewVersion(String ip, String mac, String slaveMac, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_AUTH, mac); - - JsonObject sendJsonObj = new JsonObject(); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - JsonObject jObject = new JsonObject(); - jObject.addProperty("spk", "LINKDEVICE"); - jObject.addProperty("mac", slaveMac); - jObject.addProperty("time", "120"); - sendJsonObj.add("objects", jObject); - - - String sendStr = sendJsonObj.toString(); - LinkRequest message = new LinkRequest(topic, sendStr, false); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - callBack.onSuccess(""); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - /* - * 鑾峰彇缃戝叧淇℃伅 - * */ - public void getGatewayInfo(String ip, String mac, boolean isEncrypt, HDLLinkCallBack callBack) { - String topic = String.format(TopicConstant.GATEWAY_GET, mac); - - JsonObject sendJsonObj = new JsonObject(); - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - String sendStr = sendJsonObj.toString(); - - LinkRequest message = new LinkRequest(topic, sendStr, isEncrypt); - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - callBack.onSuccess("1"); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); - } - }, true).send(); - } - - - /** - * 鍙戦�佹暟鎹埌Link缃戝叧 - * - * @param ip 缃戝叧IP - * @param mac 缃戝叧mac - * @param isEncrypt 鏄惁鍔犲瘑 - * @param topic 璇锋眰涓婚 - * @param jObject 璐熻浇鏁版嵁<娌℃湁濉玭ull></> - * @param sendPath 鍙戦�佽矾寰�<绫诲悕+鏂规硶鍚�>class->methodName</> - */ - public void sendDataToLinkGateway(String ip, String mac, boolean isEncrypt, - String topic, Object jObject, String sendPath, HDLLinkCallBack callBack) { - String topicSend = topic.replace("%s", mac); - //缁勮闇�瑕佸彂閫佺殑鏁版嵁 - String sendStr = createSendData(jObject); -// LogUtils.i("sendDataToLinkGateway->" + sendPath + "->鏈湴鍙戦�乗r\n" + topicSend + "\r\n" + sendStr); - LinkRequest message = new LinkRequest(topicSend, sendStr, isEncrypt); - GatewayBean gatewayBean = this.getLocalGateway(mac); - if (gatewayBean != null) { - message.setCloudTopic(topic.replace("%s", gatewayBean.getGatewayId())); - } - new HDLConnectHelper(ip, message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - try { - JSONObject jsonObject = new JSONObject(new Gson().toJson(msg)); - if (jsonObject.has("data")) { - callBack.onSuccess(jsonObject.getString("data")); - } - } catch (Exception e) { - callBack.onSuccess(e.getMessage()); - } -// LogUtils.i("sendDataToLinkGateway->"+sendPath+"->鏈湴鎺ユ敹鏁版嵁\r\n"+msg.toString()); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); -// LogUtils.i("sendDataToLinkGateway->" + sendPath + "->鏈湴鎺ユ敹鏁版嵁->澶辫触(-200)"); - } - }, true, mac).send(); - } - - /** - * 鍙戦�佹暟鎹埌Link缃戝叧 - * - * @param mac 缃戝叧mac - * @param isEncrypt 鏄惁鍔犲瘑 - * @param topic 璇锋眰涓婚 - * @param jObject 璐熻浇鏁版嵁<娌℃湁濉玭ull></> - * @param sendPath 鍙戦�佽矾寰�<绫诲悕+鏂规硶鍚�>class->methodName</> - */ - public void sendDataToLinkGateway(String mac, boolean isEncrypt, - String topic, Object jObject, String sendPath, HDLLinkCallBack callBack) { - GatewayBean gatewayBean = this.getLocalGateway(mac); - if (gatewayBean == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - return; - } - String topicSend = topic.replace("%s", mac); - //缁勮闇�瑕佸彂閫佺殑鏁版嵁 - String sendStr = createSendData(jObject); -// LogUtils.i("sendDataToLinkGateway->" + sendPath + "->鏈湴鍙戦�乗r\n" + topicSend + "\r\n" + sendStr); - LinkRequest message = new LinkRequest(topicSend, sendStr, isEncrypt); - message.setCloudTopic(topic.replace("%s", gatewayBean.getGatewayId())); - new HDLConnectHelper(gatewayBean.getIp_address(), message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - try { - JSONObject jsonObject = new JSONObject(new Gson().toJson(msg)); - if (jsonObject.has("data")) { - callBack.onSuccess(jsonObject.getString("data")); - } - } catch (Exception e) { - callBack.onSuccess(e.getMessage()); - } -// LogUtils.i("sendDataToLinkGateway->"+sendPath+"->鏈湴鎺ユ敹鏁版嵁\r\n"+msg.toString()); - } - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); -// LogUtils.i("sendDataToLinkGateway->" + sendPath + "->鏈湴鎺ユ敹鏁版嵁->澶辫触(-200)"); - } - }, true, mac).send(); - } - - - /** - * 鍙戦�佹暟鎹埌Link缃戝叧 - * - * @param mac 缃戝叧mac - * @param topic 璇锋眰涓婚 - * @param jObject 璐熻浇鏁版嵁<娌℃湁濉玭ull></> - * @param sendPath 鍙戦�佽矾寰�<绫诲悕+鏂规硶鍚�>class->methodName</> - */ - public void sendDataToLinkGateway(String mac, - String topic, Object jObject, String sendPath, HDLLinkCallBack callBack) { - GatewayBean gatewayBean = this.getLocalGateway(mac); - if (gatewayBean == null) { - callBack.onError(HDLLinkException.getErrorWithCode(HDLLinkCode.HDL_GATEWAY_NOT_EXIST)); - return; - } - String topicSend = topic.replace("%s", gatewayBean.getOid()); - //缁勮闇�瑕佸彂閫佺殑鏁版嵁 - String sendStr = createSendData(jObject); -// LogUtils.i("sendDataToLinkGateway->" + sendPath + "->鏈湴鍙戦�乗r\n" + topicSend + "\r\n" + sendStr); - LinkRequest message = new LinkRequest(topicSend, sendStr, gatewayBean.getIsLocalEncrypt()); - message.setCloudTopic(topic.replace("%s", gatewayBean.getGatewayId())); - new HDLConnectHelper(gatewayBean.getIp_address(), message, new HDLConnectHelper.HdlSocketListener() { - @Override - public void onSucceed(Object msg) { - if (callBack == null) return; - try { - JSONObject jsonObject = new JSONObject(new Gson().toJson(msg)); - if (jsonObject.has("data")) { - callBack.onSuccess(jsonObject.getString("data")); - } - } catch (Exception e) { - callBack.onSuccess(e.getMessage()); - } -// LogUtils.i("sendDataToLinkGateway->"+sendPath+"->鏈湴鎺ユ敹鏁版嵁\r\n"+msg.toString()); - } - - - @Override - public void onFailure(HDLLinkCode hdlLinkCode) { - if (callBack == null) return; - callBack.onError(HDLLinkException.getErrorWithCode(hdlLinkCode)); -// LogUtils.i("sendDataToLinkGateway->" + sendPath + "->鏈湴鎺ユ敹鏁版嵁->澶辫触(-200)"); - } - }, true, mac).send(); - } - - - /** - * 缁勮闇�瑕佸彂閫佺殑鏁版嵁 - * - * @param jObject 璐熻浇鏁版嵁<娌℃湁濉玭ull> - * @return 杩斿洖json瀛楃涓� - */ - private String createSendData(Object jObject) { - //topic = String.format(TopicConstant.GATEWAY_EDIT_LOCAL, mac); - JsonObject sendJsonObj = new JsonObject(); - if (jObject != null) { - if (jObject instanceof JsonObject) { - sendJsonObj.add("objects", (JsonObject) jObject); - } else if (jObject instanceof JsonArray) { - sendJsonObj.add("objects", (JsonArray) jObject); - } else if (jObject instanceof JSONArray) { - JsonArray array = GsonConvert.getGson().fromJson(jObject.toString(), new TypeToken<JsonArray>() { - }.getType()); - sendJsonObj.add("objects", array); - } - } - String time = String.valueOf(System.currentTimeMillis()); - sendJsonObj.addProperty("time_stamp", time); - sendJsonObj.addProperty("id", IdUtils.getUUId()); - return sendJsonObj.toString(); - } - - /** - * 鏀寔缃戝叧绫诲瀷 - * - * @return 绫诲瀷鍒楄〃 - */ - private List<String> getGatewayTypeList() { - List<String> typeList = new ArrayList<>(); - typeList.add("AGATEWAY");//缃戝叧 - typeList.add("av.zk.aiks");//鍩冨厠鏂奖闊充富鏈� - typeList.add("sensor.mmv_sleep");//姣背娉pk - typeList.add("sensor.mmv_pose");//姣背娉pk - typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰spk - return typeList; - } - - private List<String> getWifiMillimeterZTTypeList() { - List<String> typeList = new ArrayList<>(); - typeList.add("sensor.hdl_mmw_pose");//Wi-Fi姣背娉T鐗堟湰spk - return typeList; - } -} diff --git a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java b/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java deleted file mode 100644 index d721eea..0000000 --- a/HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/socket/TcpSocketBoot.java +++ /dev/null @@ -1,309 +0,0 @@ -package com.hdl.sdk.link.socket; - -import android.text.TextUtils; - -import androidx.collection.ArrayMap; - -import com.hdl.sdk.link.common.utils.LogUtils; -import com.hdl.sdk.link.common.utils.ThreadToolUtils; -import com.hdl.sdk.link.socket.client.IClient; -import com.hdl.sdk.link.socket.client.IHeartbeat; -import com.hdl.sdk.link.socket.listener.SendListener; -import com.hdl.sdk.link.socket.annotation.ConnectStatus; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.LinkedBlockingDeque; - -/** - * Created by Tong on 2021/9/26. - * Tcp/Udp 鍚姩鍣� - */ -public class TcpSocketBoot { - - private ExecutorService connectThread; - private ExecutorService sendThread; - private ExecutorService receiveThread; - private ExecutorService heartbeatThread; - - private final IClient client; - private IHeartbeat iHeartbeat; - public void SetHeartbeat(IHeartbeat iHeartbeat){ - this.iHeartbeat=iHeartbeat; - } - /** - * 褰撳墠鎺ユ敹鍒版暟鎹殑鏃堕棿 - */ - private long time=System.currentTimeMillis(); - /** - * tcp鏄惁宸茬粡杩炴帴 - */ - private boolean connected=false; - - public IClient getClient() { - return client; - } - - public boolean isConnected() { - return connected; - } - - private final BlockingQueue<SocketRequest> mMessageQueue = new LinkedBlockingDeque<>(); - - private final ArrayMap<String, SendListener> sendMap = new ArrayMap<>(); - - public TcpSocketBoot(IClient client) { - TCP_SOCKET_BOOT_LIST.add(this); - this.client = client; - initConnectThread(); - initReceiveThread(); - initSendThread(); - initHeartbeat(); - } - - /** - * 璁板綍鎵�鏈塖ocketBoot - */ - final static List<TcpSocketBoot> TCP_SOCKET_BOOT_LIST = new ArrayList(); - - /** - * 鏍规嵁IP鍦板潃鍙婄鍙h幏鍙栧綋鍓峴ocketBoot - * @param ipAddress - * @param port - * @return - */ - public static TcpSocketBoot getByEndPoint(String ipAddress, int port){ - if(ipAddress==null){ - return null; - } - for(TcpSocketBoot tcpSocketBoot : TCP_SOCKET_BOOT_LIST){ - if(ipAddress.equals(tcpSocketBoot.getClient().getOptions().getIp())&& tcpSocketBoot.getClient().getOptions().getPort()==port) - { - return tcpSocketBoot; - } - } - return null; - } - - /** - * 杩炴帴tcp锛屽唴閮ㄧ淮鎶ゆ帀锛屽彲浠ヤ笉鐢ㄥ紑鏀惧閮紝鏍规嵁杩欎釜涓氬姟鎴戠壒鎬у鐞嗗ソ - */ - private synchronized void connect() { - try { - LogUtils.i("TCP杩炴帴锛�"+this.getClient().getOptions().getIp()); - client.onConnectStatus(ConnectStatus.CONNECTING); -// Thread.sleep(700); - client.connect(); - LogUtils.i("TCP杩炴帴鎴愬姛锛�"+this.getClient().getOptions().getIp()); - connected=true; - client.onConnectStatus(ConnectStatus.CONNECTED); - }catch(Exception e) { - LogUtils.e(e.getMessage()); - } - } - - - /** - * 鍒濆鍖栧彂閫佺嚎绋嬶紝鍙渶瑕佸垵濮嬪寲涓�娆� - */ - private void initSendThread() { - if (sendThread == null) { - sendThread = ThreadToolUtils.getInstance().newFixedThreadPool(1); - sendThread.execute(new Runnable() { - @Override - public void run() { - while (true) { - try { - if(connected==false){ - Thread.sleep(100); - continue; - } - SocketRequest socketRequest = mMessageQueue.take(); - final String action = socketRequest.getAction(); - try { - client.sendMsg(socketRequest.getData()); - if (!TextUtils.isEmpty(action)) { - SendListener sendListener = sendMap.get(action); - if (sendListener != null) { - sendListener.onSucceed(); - } - } - } catch (Exception e) { - connected = false; - LogUtils.e("鍙戦�佸け璐�:" + e.getMessage()); - if (!TextUtils.isEmpty(action)) { - SendListener sendListener = sendMap.get(action); - if (sendListener != null) { - sendListener.onError(); - } - } - } - } catch (Exception e) { - LogUtils.e("鍙戦�佸け璐�1:" + e.getMessage()); - } - } - } - }); - } - } - - /** - * 鍒濆鍖栨帴鏀剁嚎绋嬶紝鍙渶瑕佸垵濮嬪寲涓�娆� - */ - public void initReceiveThread() { - if (receiveThread == null) { - receiveThread = ThreadToolUtils.getInstance().newFixedThreadPool(1); - receiveThread.execute(new Runnable() { - @Override - public void run() { - while (true) { - try { - if (connected) { - //璇诲彇鏁版嵁 - client.onHandleResponse(); - time= System.currentTimeMillis(); - } else { - try { - Thread.sleep(1000); - } catch (Exception ee) { - - } - } - } catch (Exception e) { - connected = false; - LogUtils.e("鎺ユ敹鏁版嵁绾跨▼寮傚父" + e.getMessage()); - } - } - } - }); - } - } - - /** - * 鍒濆鍖栭噸鏂拌繛鎺ョ嚎绋� - */ - private void initConnectThread() { - if (connectThread == null) { - connectThread = ThreadToolUtils.getInstance().newFixedThreadPool(1); - //涓�瀹氭椂闂存娴嬩竴娆¤繛鎺ユ儏鍐碉紝娌℃湁杩炴帴灏辨墽琛岃繛鎺ワ紝杩炴帴缁熶竴鐢辫繖閲岀淮鎶� - connectThread.execute(new Runnable() { - @Override - public void run() { - while (true) { - try { - if (!connected) { - reconect(); - } - Thread.sleep(5*1000); - } catch (Exception e) { - - LogUtils.e("瀹氭椂杩炴帴绾跨▼寮傚父:" + e.getMessage()); - } - } - } - }); - } - } - - /** - * 鍒濆鍖栭噸鏂板績璺崇嚎绋� - */ - private void initHeartbeat() { - if (heartbeatThread == null) { - heartbeatThread = ThreadToolUtils.getInstance().newFixedThreadPool(1); - heartbeatThread.execute(new Runnable() { - @Override - public void run() { - while (true) { - try { - //5绉� - if (connected && 5 * 1000 < (System.currentTimeMillis() - time)) { - time = System.currentTimeMillis(); - //蹇冭烦妫�娴� - if (iHeartbeat != null) - iHeartbeat.heartbeat(); - } - Thread.sleep(10); - } catch (Exception e) { - LogUtils.e("瀹氭椂蹇冭烦妫�娴嬬綉鍏冲紓甯革細" + e.getMessage()); - } - } - } - }); - } - } - /** - * 閲嶆柊杩炴帴 - */ - private void reconect() { - disconnect(); - connect(); - } - - /** - * 鍙戦�佹棤闇�鍥炶皟 - * @param msg 鍙戦�佺殑鏁版嵁 - */ - public void sendMsg(byte[] msg) { - sendMsg(msg, null); - } - - - /** - * @param listener 涓�鑸儏鍐垫棤闇�鐩戝惉 - */ - public void sendMsg(byte[] msg, SendListener listener) { - try { - SocketRequest request = new SocketRequest(msg); - if (listener != null && !TextUtils.isEmpty(request.getAction())) { - sendMap.put(request.getAction(), listener); - } - mMessageQueue.put(request); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * 鍏抽棴杩炴帴 - */ - private synchronized void disconnect() { - try { - client.disconnect(); - //鏂紑杩炴帴 - client.onConnectStatus(ConnectStatus.DISCONNECT); - } catch (Exception e) { - - } - } - - -// /** -// * 鏂紑鍏ㄩ儴鐨凩ink缃戝叧杩炴帴 -// */ -// public static void stopAllConnectLinkGateway() { -// for (TcpSocketBoot data : TCP_SOCKET_BOOT_LIST) { -// //鏂紑鎸囧畾鐨刲ink缃戝叧杩炴帴 -// stopConnectLinkGateway(data); -// } -// -// } -// -// /** -// * 鏂紑鎸囧畾鐨刲ink缃戝叧杩炴帴 -// * -// * @param tcpSocketBoot tcp瀵硅薄 -// */ -// public static void stopConnectLinkGateway(TcpSocketBoot tcpSocketBoot) { -// synchronized (TCP_SOCKET_BOOT_LIST) { -// try { -// TCP_SOCKET_BOOT_LIST.remove(tcpSocketBoot); -// tcpSocketBoot.client.disconnect(); -// } catch (Exception ignored) { -// } -// } -// } - -} diff --git a/HDLLinkPMSdk/.gitignore b/HDLLinkPMSdk/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/HDLLinkPMSdk/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/HDLLinkPMSdk/build.gradle b/HDLLinkPMSdk/build.gradle deleted file mode 100644 index d378eef..0000000 --- a/HDLLinkPMSdk/build.gradle +++ /dev/null @@ -1,44 +0,0 @@ -plugins { - id 'com.android.library' -} - -android { - - compileSdkVersion 29 - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 29 - versionCode 1 - versionName "1.0.1" - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - /** - * 鎵撳寘鑷姩鍛藉悕 - */ - android.libraryVariants.all { variant -> - variant.outputs.all { - outputFileName = "HDLLinkPMSdk-V" + defaultConfig.versionName + ".aar" - } - } -} - -dependencies { - //缃戠粶璇锋眰搴� - implementation 'com.alibaba:fastjson:1.2.66' - api 'com.hdl.hdlhttp:hxhttp:1.0.4' - api 'com.hdl.android:log:1.0.0' - -} \ No newline at end of file diff --git a/HDLLinkPMSdk/consumer-rules.pro b/HDLLinkPMSdk/consumer-rules.pro deleted file mode 100644 index e69de29..0000000 --- a/HDLLinkPMSdk/consumer-rules.pro +++ /dev/null diff --git a/HDLLinkPMSdk/proguard-rules.pro b/HDLLinkPMSdk/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/HDLLinkPMSdk/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/AndroidManifest.xml b/HDLLinkPMSdk/src/main/AndroidManifest.xml deleted file mode 100644 index cf2dda0..0000000 --- a/HDLLinkPMSdk/src/main/AndroidManifest.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.hdl.linkpm.sdk"> - <!--鐩稿叧蹇呰鏉冮檺--> - <uses-permission android:name="android.permission.INTERNET" /> - <!--鐩稿叧蹇呰鏉冮檺--> -</manifest> \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/HDLLinkPMSdk.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/HDLLinkPMSdk.java deleted file mode 100644 index 938a708..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/HDLLinkPMSdk.java +++ /dev/null @@ -1,174 +0,0 @@ -package com.hdl.linkpm.sdk; - -import android.app.Application; -import android.content.SharedPreferences; -import android.content.pm.ApplicationInfo; -import android.os.Looper; -import android.widget.Toast; - -import com.hdl.hdlhttp.HxHttpConfig; -import com.hdl.linkpm.sdk.core.interceptor.HDLEncryptInterceptor; -import com.hdl.linkpm.sdk.core.interceptor.HDLLoginInterceptor; -import com.hdl.linkpm.sdk.core.interceptor.HDLSmartHeaderInterceptor; -import com.hdl.linkpm.sdk.utils.HDLSDKLog; - -import java.util.Locale; - -import static android.content.Context.MODE_PRIVATE; - -/** - * Created by jlchen on 12/2/21. - * HDLLinkPMSdk 璋冭瘯瀹濄�佽皟璇曡蒋浠堕」鐩鐞哠DK - * 閽堝B绔处鍙� - */ -public class HDLLinkPMSdk { - public static final String SDK_NAME = "HDLLinkPMSdk"; - private static String appKey; - private static String appSecret; - private static String userRegionUrl; - private static String initUrl; - private static Application context; - private static String language = "zh";//閰嶇疆鎺ュ彛璇锋眰鍝嶅簲鐨勮瑷�锛屼笉閰嶇疆榛樿涓枃 - - /** - * 鑾峰彇褰撳墠Context - * @return - */ - public Application getApplication() - { - return context; - } - /** - * 鍒濆鍖朣DK - * @param appKeyStr - * @param appSecretStr - */ - public static void initWithAppKey(Application ctx, String appKeyStr, String appSecretStr,String url){ - context = ctx; - appKey = appKeyStr; - appSecret = appSecretStr; - initUrl = url; - userRegionUrl=url; - initHxHttpConfig(); -// HDLSDKLog.i("init HDLLinkPMSdk锛�"+regionUrlStr); - } - - - public static boolean isDebugVersion() { - try { - ApplicationInfo info = context.getApplicationInfo(); - return (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; - } catch (Exception e) { - e.printStackTrace(); - } - return false; - } - - public static void showToast(String msg){ -// runOnUiThread(new Runnable() { -// @Override -// public void run() { -// try { -// if (toast == null) { -// toast = Toast.makeText(HDLGlobal.getInstance().getContext(), message, Toast.LENGTH_SHORT); -// } else { -// toast.setText(message); -// } -// toast.show(); -// } catch (Exception ignored) { -// -// } -// } -// -// }); - Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); - } - - public static void runOnUiThread(Runnable run) { - //鍒よ鏄惁宸茬粡鍦ㄤ富绾跨▼ - if (Looper.getMainLooper() == Looper.myLooper()) { - run.run(); - } - } - - - public static String getInitUrl() { - return initUrl == null ? "" : initUrl; - } - - public static String get_USER_REGIONURL_ONLINE(){ - SharedPreferences sp1 = context.getSharedPreferences("USER_REGIONURL_ONLINE", MODE_PRIVATE); - //濡傛灉SoundCode,鑾峰彇鐨勫�兼槸绌虹殑,鍒欎細寮瑰嚭鍚庨潰鐨勯粯璁ゅ�� - String obtain = sp1.getString("USER_REGIONURL_ONLINE", "https://nearest.hdlcontrol.com"); - - return obtain; - } - - public static void edit_USER_REGIONURL_ONLINE(String url){ - userRegionUrl =url; - SharedPreferences sp = context.getSharedPreferences("USER_REGIONURL_ONLINE", MODE_PRIVATE); - sp.edit().putString("USER_REGIONURL_ONLINE",url).apply();//apply鎵嶄細鍐欏叆鍒皒ml閰嶇疆鏂囦欢閲岄潰 - } - - /** - * 鍒濆垵濮嬪寲缃戠粶璇锋眰搴撻厤缃� - * 娉ㄦ剰锛侊紒锛� - * 璇锋眰鍙傛暟涓嶆槸鏁扮粍鎴栧璞$被鍨嬬殑涓嶈兘鐢ㄨ〃鍗�.params(XXX)鐨勬柟寮忔坊鍔犺姹傚弬鏁� - */ - static void initHxHttpConfig(){ - HxHttpConfig.getInstance().init(context, userRegionUrl) - //.setConnectTimeout()//閰嶇疆榛樿璇锋眰瓒呮椂鏃堕棿 - .addInterceptor(new HDLLoginInterceptor(), - new HDLEncryptInterceptor(), - new HDLSmartHeaderInterceptor()); - } - - public static void destroy() { - - } - - - /** - * 璁剧疆鎵撳嵃鏄惁寮�鍚� - * @param enable- - */ - public static void setLogEnabled(boolean enable){ - HDLSDKLog.setHDLSDKLogOpen(enable); - } - - public static String getAppKey() { - return appKey; - } - - public static String getAppSecret() { - return appSecret; - } - - public static String getUserRegionUrl() { - if (userRegionUrl == null) { - userRegionUrl = get_USER_REGIONURL_ONLINE(); - } - return userRegionUrl; - } - - public static boolean isZh() { - Locale locale = getContext().getResources().getConfiguration().locale; - String language = locale.getLanguage(); - if (language.endsWith("zh")) - return true; - else - return false; - } - - public static Application getContext() { - return context; - } - - public static String getLanguage() { - return language; - } - - public static void setLanguage(String language) { - HDLLinkPMSdk.language = language; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudHomeApi.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudHomeApi.java deleted file mode 100644 index 65492ce..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudHomeApi.java +++ /dev/null @@ -1,126 +0,0 @@ -package com.hdl.linkpm.sdk.core.api; - -import com.hdl.linkpm.sdk.user.HDLLinkPMUser; - -/** - * Created by jlchen on 12/3/21. - * B绔� 浣忓畢鐩稿叧鐨凙PI鎺ュ彛 - */ -public class HDLCloudHomeApi { - /***************1.鎴垮眿绠$悊***************/ - //house琛ㄧ殑鏁版嵁娌℃湁鍚屾鍒癶ome琛ㄣ�佹暟鎹瓨鍦ㄤ袱寮犺〃閲岄潰锛岄渶瑕佸鎴风璋冩帴鍙e悓姝� - public static final String POST_PROGRAM_HOME_ADD = "/home-wisdom/program/home/add"; - /***************2.鎴块棿绠$悊***************/ - //鑾峰彇鎴块棿鍒楄〃 - public static final String POST_ROOM_GET_LIST = "/home-wisdom/program/room/list"; - //鎴块棿鍒楄〃鍏ㄩ噺鏇存柊銆佹坊鍔犮�佺紪杈戙�佸垹闄ら兘鐢ㄨ鎺ュ彛 - public static final String POST_ROOM_FULL_ADD_OR_EDIT = "/home-wisdom/program/room/add"; - /***************3.缃戝叧绠$悊***************/ - //缁戝畾缃戝叧 - public static final String POST_GATEWAY_BIND = "/home-wisdom/program/gateway/bindGateway"; - //寮哄埗缁戝畾缃戝叧 濡傛灉缁戝畾缃戝叧杩斿洖10510 宸茬粡琚粦瀹氫簡,鍒欒皟杩欎釜鎺ュ彛寮哄埗鎹㈢粦 - public static final String POST_GATEWAY_FORCE_BIND = "/home-wisdom/app/gateway/forceBind"; - //缃戝叧鏄惁缁戝畾浣忓畢 - public static final String POST_GATEWAY_HOMEINFO = "/home-wisdom/program/gateway/getGatewayByMac"; - //瑙g粦缃戝叧 - public static final String POST_GATEWAY_UNBIND = "/home-wisdom/program/gateway/untieGateway"; - //鑾峰彇缃戝叧鍒楄〃 - public static final String POST_GATEWAY_GET_LIST = "/home-wisdom/app/gateway/getGatewayList"; - //鑾峰彇缃戝叧淇℃伅 - public static final String POST_GATEWAY_GET_INFO = "/home-wisdom/program/gateway/info"; - //缃戝叧鏇挎崲 - public static final String POST_GATEWAY_REPLACE = "/home-wisdom/program/gateway/replace"; - /***************4.璁惧銆佸姛鑳藉鍒犳敼鏌ョ鐞�***************/ - //璁惧鍩烘湰淇℃伅鍒楄〃(oid)鍏ㄩ噺娣诲姞 - public static final String POST_DEVICE_OID_LIST_FULL_ADD = "/home-wisdom/program/device/oid/add"; - //璁惧鍩烘湰淇℃伅鍒楄〃(oid)鑾峰彇 - public static final String POST_DEVICE_OID_LIST_GET = "/home-wisdom/program/device/oid/list"; - //璁惧鍩烘湰淇℃伅(oid)鍒犻櫎 - public static final String POST_DEVICE_OID_REMOVE = "/home-wisdom/program/device/oid/remove"; - //璁惧锛堝姛鑳斤級鍏ㄩ噺鏇存柊 - public static final String POST_FUNCTION_LIST_FULL_ADD= "/home-wisdom/program/device/add"; - //鑾峰彇浜у搧鍒嗙被鏍� - public static final String POST_CATEGORY_LIST_ALLTREE= "/iot-cloud/mgmt/product/category/allTree"; - //鑾峰彇缃戝叧鍒楄〃 - public static final String POST_GATEWAY_LIST= "/home-wisdom/program/gateway/getGatewayList"; - //鑾峰彇浜у搧鍒嗙被涓嬩骇鍝� - public static final String POST_CATEGORY_DEVICE_LIST= "/iot-cloud/product/hardware/list"; - //璁惧锛堝姛鑳斤級鍒楄〃鑾峰彇 - public static final String POST_FUNCTION_LIST_GET= "/home-wisdom/program/device/list"; - //璁惧锛堝姛鑳斤級鍒犻櫎锛屾敮鎸佹壒閲� - public static final String POST_FUNCTION_BATCH_DELETE= "/home-wisdom/program/device/delete"; - //璁惧锛堝姛鑳斤級淇敼锛屾敮鎸佹壒閲� - public static final String POST_FUNCTION_BATCH_EDIT= "/home-wisdom/program/device/edit"; - //璁惧鎺у埗 C绔敤鎴锋帴鍙� - public static final String POST_FUNCTION_CONTROL= "/home-wisdom/app/device/control"; - //璁惧缁戝畾鎴块棿 - public static final String POST_DEVICE_BINDROOM="/home-wisdom/app/device/bindRoom"; - //璁惧鍚嶇О淇敼 - public static final String POST_DEVICE_RENAME="/home-wisdom/app/device/rename"; - - //缁戝畾/缂栬緫鐙珛璁惧(姣背娉�) - public static final String POST_DEVICE_INDEPENDENT_REGISTER= "/home-wisdom/program/device/independentRegister"; - //瑙g粦鐙珛璁惧(姣背娉�) - public static final String POST_DEVICE_INDEPENDENT_UNBIND= "/home-wisdom/program/device/independentUnbind"; - //璁惧锛堝姛鑳斤級鍒楄〃鑾峰彇(鍙互鑾峰彇鍗曚釜spk) - public static final String POST_DEVICE_LIST_GET= "/home-wisdom/app/device/list"; - //鑾峰彇姣背娉�(鑾峰彇璁惧杩滅▼閫氳淇℃伅) - public static final String POST_DEVICE_REMOTEINFO_GET= "/home-wisdom/program/device/remoteInfo"; - /***************5.鍦烘櫙澧炲垹鏀规煡绠$悊***************/ - //鑾峰彇鍦烘櫙鍒楄〃 - public static final String POST_SCENE_LIST_GET= "/home-wisdom/program/scene/list"; - //鍏ㄩ噺鍚屾鍦烘櫙 - public static final String POST_SCENE_LIST_FULL_SYNC= "/home-wisdom/program/scene/sync"; - //鍒犻櫎鍦烘櫙 - public static final String POST_SCENE_DELETE= "/home-wisdom/program/scene/delete"; - //鍦烘櫙鎵ц - public static final String POST_SCENE_EXECUTE= "/home-wisdom/program/scene/execute"; - /***************6.鑷姩鍖栧鍒犳敼鏌ョ鐞�***************/ - //鍏ㄩ噺鏇存柊鍚屾鑷姩鍖栥�佸瓨鍦ㄤ笉鍙�,涓嶅瓨鍦ㄦ柊澧� - public static final String POST_LOGIC_FULL_SYNC= "/home-wisdom/program/logic/sync"; - - /***************7.瀹夐槻鍖栧鍒犳敼鏌ョ鐞�***************/ - //鍏ㄩ噺鏇存柊鍚屾瀹夐槻鏁版嵁銆佸瓨鍦ㄤ笉鍙�,涓嶅瓨鍦ㄦ柊澧� - public static final String POST_SECURITY_FULL_SYNC= "/home-wisdom/program/security/sync"; - - /***************8.OTA 鍥轰欢鍜屽崌绾х鐞�***************/ - //鍘熺敓璁惧鑾峰彇鍥轰欢鍗囩骇鍖呬笅杞藉湴鍧� - public static final String POST_OTA_GET_NativeDeviceFirmwareDownloadUrl = "/smart-footstone/mgmt/device/ota/getNativeDeviceFirmwareDownloadUrl"; - /**椹卞姩**/ - //Link缃戝叧椹卞姩鍒楄〃鑾峰彇 - public static final String POST_OTA_GET_GatewayDrivers = "/home-wisdom/program/device/ota/getGatewayDrivers"; - //Link缃戝叧浜戠鐨勯┍鍔ㄥ垎椤靛垪琛ㄨ幏鍙� - public static final String POST_OTA_GET_CloudGatewayDrivers = "/smart-footstone/driver/buspro/download"; - //Link缃戝叧椹卞姩鍗囩骇OTA鍛戒护涓嬪彂 - public static final String POST_OTA_GatewayDriverUpgrade = "/home-wisdom/program/device/ota/gatewayDriverUpgrade"; - //LINK缃戝叧鑾峰彇椹卞姩鍗囩骇鍖呬笅杞藉湴鍧� - public static final String POST_OTA_GET_LinkDeviceDriverDownloadUrl = "/smart-footstone/mgmt/device/ota/getLinkDeviceDriverDownloadUrl"; - /**鍥轰欢**/ - //璁惧鍥轰欢鍒楄〃鑾峰彇 - public static final String POST_OTA_GET_DeviceFirmwares = "/home-wisdom/program/device/ota/getDeviceFirmwares"; - //璁惧鍥轰欢浜戠鐨勯┍鍔ㄥ垎椤靛垪琛ㄨ幏鍙� - public static final String POST_OTA_GET_CloudDeviceFirmwares = "/smart-footstone/firmware/firmwareVersion/getLastOne"; - //璁惧鍥轰欢鍗囩骇OTA鍛戒护 - public static final String POST_OTA_DeviceFirmwareUpgrade = "/home-wisdom/program/device/ota/deviceFirmwareUpgrade"; - //璁惧鑾峰彇鍥轰欢鍗囩骇鍖呬笅杞藉湴鍧� - public static final String POST_OTA_GET_LinkDeviceFirmwareDownloadUrl = "/smart-footstone/mgmt/device/ota/getLinkDeviceFirmwareDownloadUrl"; - - //鑾峰彇IARCC涓夋柟鍥轰欢鍒嗛〉 - public static final String POST_OTA_GET_FIRMWARE_PAGE = "/iot-cloud/mgmt/third/firmware/page"; - //鑾峰彇IARCC涓夋柟鍥轰欢鍒嗙被 - public static final String POST_OTA_GET_FIRMWARE_LIST = "/iot-cloud/mgmt/third/firmware/list"; - - //甯姪涓績闂瓟鍒楄〃 - public static final String POST_QUESTION_GET_LIST = "/crm-wisdom/support/center/list"; - - - /** - * 鑾峰彇浣忓畢瀹屾暣鐨勮姹傚湴鍧� - * @param api - * @return - */ - public static String getRequestUrl(String api){ - return HDLLinkPMUser.getInstance().getHomeRegionUrl() + api; - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudProjectApi.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudProjectApi.java deleted file mode 100644 index abc8349..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudProjectApi.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.hdl.linkpm.sdk.core.api; - -import com.hdl.linkpm.sdk.user.HDLLinkPMUser; - -/** - * Created by jlchen on 12/3/21. - * B绔� 鐢ㄦ埛鐩稿叧鐨凙PI鎺ュ彛 - */ -public class HDLCloudProjectApi { - /***************椤圭洰绠$悊***************/ - //鑾峰彇鎸囧畾鍏徃鍛樺伐鍒楄〃 鏀寔鍚嶇О妯$硦鏌ヨ - public static final String POST_DEBUGGER_GET = "/basis-footstone/mgmt/user/manage/getUserByCompanyIdAndUserName"; - //鏂板椤圭洰 - public static final String POST_PROJECT_CREATE = "/smart-footstone/mgmt/community/project/create"; - //鍒犻櫎椤圭洰 - public static final String POST_PROJECT_DELETE_BY_ID = "/smart-footstone/mgmt/community/project/deleteById"; - //鑾峰彇椤圭洰鍒楄〃 - public static final String POST_PROJECT_GET_PAGE = "/smart-footstone/mgmt/community/project/page"; - //鑾峰彇浜屾璋冭瘯 - public static final String POST_REDEBUG_GET_PAGE = "/smart-footstone/mgmt/community/project/getDebugInfoList"; - //缂栬緫椤圭洰 - public static final String POST_PROJECT_UPDATE = "/smart-footstone/mgmt/community/project/update"; -// //鍒嗛厤璋冭瘯浜哄憳 -// public static final String POST_PROJECT_ARRANGE_DEBUG_USER = "/smart-footstone/mgmt/community/project/arrangeDebugUser"; - //鏍规嵁椤圭洰璋冭瘯鐘舵�佽幏鍙栭」鐩粺璁℃暟鎹� - public static final String POST_PROJECT_GET_SUMMARY_LIST = "/smart-footstone/mgmt/community/project/getSummaryList"; - //鏍规嵁椤圭洰ID鑾峰彇椤圭洰淇℃伅 - public static final String POST_PROJECT_GET_INFO = "/smart-footstone/mgmt/community/project/getInfo"; - //鍒嗛厤涓氬姟浜哄憳鍚� 淇敼涓鸿窡杩涗腑鐘舵�� - public static final String POST_PROJECT_ARRANGE_BUSINESS_USER = "/smart-footstone/mgmt/community/project/arrangeBusinessUser"; - //浜や粯椤圭洰 鎵�鏈夋埧灞嬪浜庡凡浜や粯鐘舵�佹墠閫氳繃 鍚﹀垯鎻愮ず灏氭湭鏈夋湭浜や粯鐨勬埧灞� - public static final String POST_PROJECT_DELIVERY_ROJECT = "/smart-footstone/mgmt/community/project/deliveryProject"; - //鎾ゅ洖浜や粯鐨勯」鐩� 宸蹭氦浠樼殑椤圭洰鍙樹负寰呬氦浠� 閽堝閰掑簵鍜屽湴浜ч」鐩� - public static final String POST_PROJECT_WITHDRAW_DELIVERY_PROJECT = "/smart-footstone/mgmt/community/project/withdrawDeliveryProject"; - - - /***************鎴垮眿绠$悊***************/ - //鏌ヨ鎴垮眿淇℃伅鍒楄〃锛屽垎椤垫煡璇� :鏍规嵁鏌ヨ鏉′欢锛岃繑鍥炴煡璇㈢粨鏋滅殑鎴垮眿璇︾粏淇℃伅鍒楄〃 - public static final String POST_PROJECT_GET_HOUSE_PAGE = "/smart-footstone/mgmt/community/houseExtend/getHousePage"; - //娣诲姞鍒嗛厤璋冭瘯浜哄憳 :缁欐埧灞嬫坊鍔犺皟璇曚汉鍛橈紝璋冭瘯浜哄憳璐﹀彿蹇呴』瀛樺湪锛屾洿鏂拌皟璇曚汉鍛樿皟璇曡繖涓帴鍙e氨濂斤紝浼氳繘琛岃鐩� - public static final String POST_HOUSE_DEBUGGER_ADD = "/smart-footstone/mgmt/community/houseExtend/add"; - //鎵归噺娣诲姞璋冭瘯浜哄憳 :澶氫釜鎴垮眿鍚屾椂鍒嗛厤缁欎竴涓皟璇曚汉鍛� - public static final String POST_HOUSE_DEBUGGER_BATCHADD = "/smart-footstone/mgmt/community/houseExtend/batchAdd"; - //鎵归噺鏇存柊璋冭瘯鐘舵�� - public static final String POST_HOUSE_BATCH_UPDATE_STATUS = "/smart-footstone/mgmt/community/houseExtend/batchUpdateStatus"; - - - /***************鏁版嵁涓婁紶浜戠***************/ - /** - * 鏇存柊oid 鍏ㄩ噺 - */ - public static final String POST_HOUSE_DEVICE_FULL_UPDATE = "/home-wisdom/program/device/oid/add"; - /** - * 鍔熻兘鍏ㄩ噺鏇存柊 - */ - public static final String POST_HOUSE_FUNCTION_FULL_UPDATE = "/home-wisdom/program/device/add"; - /** - * 鎴块棿Uid鍏ㄩ噺鏇存柊 - */ - public static final String POST_HOUSE_ROOM_FULL_UPDATE = "/home-wisdom/program/room/add"; - /** - * 鍦烘櫙鍏ㄩ噺鏇存柊 - */ - public static final String POST_HOUSE_SCENE_FULL_UPDATE = "/home-wisdom/program/scene/sync"; - /** - * 鑷姩鍖栧叏閲忔洿鏂� - */ - public static final String POST_HOUSE_LOGIC_FULL_UPDATE = "/home-wisdom/program/logic/sync"; - /** - * 瀹夐槻鍏ㄩ噺鏇存柊 - */ - public static final String POST_HOUSE_SECURITY_FULL_UPDATE = "/home-wisdom/program/security/sync"; - /** - * 缇ゆ帶鍏ㄩ噺鏇存柊 - */ - public static final String POST_HOUSE_GROUPCONTROL_FULL_UPDATE = "/home-wisdom/program/device/groupcontrol/syncData"; - /** - * 鏇存敼浣忓畢鍚嶇О - */ - public static final String POST_HOUSENAME_UPDATE = "/home-wisdom/program/home/updateName"; - /** - * 娣诲姞鎺ㄩ�乀oken - */ - public static final String POST_JPUSH_BIND = "/smart-footstone/app/push-information/add"; - /** - * 鍒犻櫎鎺ㄩ�乀oken - */ - public static final String POST_JPUSH_UNBIND = "/smart-footstone/app/push-information/delete"; - - /***************缃戝叧椹卞姩***************/ - /** - * 鑾峰彇椹卞姩鍒嗛〉鍒楄〃 - */ - public static final String POST_GET_DRIVERLIST = "/smart-footstone/driver/driverList"; - - /** - * 鑾峰彇椹卞姩鐗堟湰鍒嗛〉鍒楄〃 - */ - public static final String POST_GET_VERSIONLIST = "/smart-footstone/driver/versionList"; - - /** - * 绾㈠璁惧绫诲瀷鍒楄〃 - */ - public static final String POST_GET_IR_DEVICETYPELIST = "/smart-footstone/app/ir/device-type/list"; - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鐨勫搧鐗屽垪琛� - */ - public static final String POST_GET_IR_DEVICEBRANDLIST = "/smart-footstone/app/ir/brand/list"; - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鐨勫搧鐗岀孩澶栫爜搴撳垪琛� - */ - public static final String POST_GET_IR_DEVICECODELIST = "/smart-footstone/app/ir/code/list"; - - /** - * 娣诲姞椹卞姩涓嬭浇娆℃暟 - */ - public static final String POST_ADD_DOWNLOADCOUNT= "/smart-footstone/driver/addDownloadCount"; - - /** - * 娣诲姞鍥轰欢涓嬭浇娆℃暟 - */ - public static final String POST_ADD_FIRMWARE_DOWNLOADCOUNT= "/smart-footstone/firmware/firmwareVersion/updateDownload"; - - /** - * 娣诲姞涓夋柟涓嬭浇娆℃暟 - */ - public static final String POST_ADD_THIRD_DOWNLOADCOUNT= "/iot-cloud/mgmt/third/firmware/version/downOverlay"; - - - - - - /** - * 鑾峰彇瀹屾暣鐨勮姹傚湴鍧� - * @param api - * @return - */ - public static String getRequestUrl(String api){ - return HDLLinkPMUser.getInstance().getUserRegionUrl() + api; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudUserApi.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudUserApi.java deleted file mode 100644 index e5b0c0a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/api/HDLCloudUserApi.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.hdl.linkpm.sdk.core.api; - -import com.hdl.linkpm.sdk.user.HDLLinkPMUser; - -/** - * Created by jlchen on 12/3/21. - * B绔� 鐢ㄦ埛鐩稿叧鐨凙PI鎺ュ彛 - */ -public class HDLCloudUserApi { - /***************鐢ㄦ埛绠$悊***************/ - //鑾峰彇璐﹀彿鎵�鍦ㄥ尯鍩�(B绔�) - public static final String POST_RegionByAccount = "/smart-footstone/region/regionByUserAccount"; - //鑾峰彇璐﹀彿鎵�鍦ㄥ尯鍩燂紙C绔級 - public static final String C_POST_RegionByAccount = "/smart-footstone/region/regionByAccount"; - //鐧诲綍鎺ュ彛(B绔�) - public static final String POST_LOGIN = "/smart-footstone/user/oauth/login"; - //鐧诲綍鎺ュ彛锛圕绔級 - public static final String C_POST_LOGIN = "/smart-footstone/member/oauth/login"; - //鍙戦�佹秷鎭獙璇佺爜 - public static final String POST_VERIFICATION_CODE_SEND = "/smart-footstone/verification/message/send"; - //鐢ㄦ埛鎵惧洖瀵嗙爜 蹇樿瀵嗙爜,閫氳繃閭鍜屾墜鏈哄彿鎵惧洖 - public static final String POST_FORGET_PROGRAM_PWD = "/smart-footstone/user/oauth/forgetProgramPwd"; - //鏇存敼涓汉瀵嗙爜 - public static final String POST_UPDATE_PROGRAM_PASSWORD = "/smart-footstone/user/userInfo/updateProgramPassword"; - //鑾峰彇鍛樺伐鍒楄〃 - public static final String POST_GET_USER_LIST = "/smart-footstone/user/userInfo/getUserList"; - //鑾峰彇鐢ㄦ埛涓汉淇℃伅 C绔� - public static final String POST_GET_MEMBER_INFO = "/smart-footstone/member/memberInfo/getMemberInfo"; - //鏇存柊涓汉淇℃伅 C绔� - public static final String POST_UPDATE_MEMBER_INFO = "/smart-footstone/member/memberInfo/updateMemberInfo"; - //涓婁紶鍥剧墖 - public static final String POST_UPLOAD_IMAGE = "/home-wisdom/app/images/upload_image"; - //涓婁紶鍥剧墖锛堟柊锛� - public static final String POST_UPLOAD_IMAGE_NEW = "/basis-cosmos/file/upload"; - //鏌ヨ鍥剧墖璺緞 - public static final String POST_GET_IMAGE_URL = "/home-wisdom/app/images/get_image_url"; - // //鐗堟湰妫�娴嬫洿鏂� -// public static final String POST_APP_APPVERSION_CHECK = "/smart-footstone/app/appVersion/check"; - //鏀寔APP鍜屽皬绋嬪簭妫�娴� - public static final String POST_APP_APPVERSION_CHECK = "/basis-footstone/app/appVersion/check"; - //mqtt杩炴帴闇�瑕佺殑鏁版嵁 - public static final String MQTT_INFO_URL = "/home-wisdom/app/mqtt/getRemoteInfo"; - - - /***************椤圭洰绠$悊***************/ - /** - * 鑾峰彇瀹屾暣鐨勮姹傚湴鍧� - * - * @param api - * @return - */ - public static String getRequestUrl(String api) { - return HDLLinkPMUser.getInstance().getUserRegionUrl() + api; - } - - - /***************妯℃澘绠$悊***************/ - //鍒涘缓妯℃澘 - public static final String POST_TEMPLATE_CREATE = "/smart-footstone/mgmt/template/extends/debug/create"; - //鑾峰彇妯℃澘鍒楄〃 - public static final String POST_TEMPLATE_GET_LIST = "/smart-footstone/mgmt/template/extends/debug/page"; - //鍒犻櫎妯℃澘 - public static final String POST_TEMPLATE_DELETE = "/smart-footstone/mgmt/template/extends/debug/delete"; - //娣诲姞缃戝叧(鍏ㄩ噺) - public static final String POST_TEMPLATE_UPDATE_GATEWAY = "/smart-footstone/mgmt/template/detail/gateway/fullUpdate"; - //娣诲姞鎴块棿(鍏ㄩ噺) - public static final String POST_TEMPLATE_UPDATE_ROOM = "/smart-footstone/mgmt/template/detail/room/fullUpdate"; - //娣诲姞璁惧(鍏ㄩ噺) - public static final String POST_TEMPLATE_UPDATE_DEVICES = "/smart-footstone/mgmt/template/detail/oid/fullUpdate"; - //鑾峰彇璁惧鍒楄〃 - public static final String POST_TEMPALTE_GET_DEVICES = "/smart-footstone/mgmt/template/detail/oid/list"; - //娣诲姞鍔熻兘(鍏ㄩ噺) - public static final String POST_TEMPLATE_UPDATE_FUNCTIONS = "/smart-footstone/mgmt/template/detail/sid/fullUpdate"; - //娣诲姞鍦烘櫙(鍏ㄩ噺) - public static final String POST_TEMPLATE_UPDATE_SCENES = "/smart-footstone/mgmt/template/detail/scene/fullUpdate"; - //娣诲姞鑷姩鍖�(鍏ㄩ噺) - public static final String POST_TEMPLATE_UPDATE_LOGIC = "/smart-footstone/mgmt/template/detail/logic/fullUpdate"; - //娣诲姞瀹夐槻 - public static final String POST_TEMPLATE_UPDATE_SECURITY = "/smart-footstone/mgmt/template/detail/security/fullUpdate"; - //鑾峰彇绌洪棿淇℃伅 - public static final String POST_GET_TEMPLATE_SPATIAL_INFO = "/smart-footstone/mgmt/template/detail/room/list"; - //鑾峰彇缃戝叧淇℃伅 - public static final String POST_GET_TEMPLATE_GATEWAY_LIST = "/smart-footstone/mgmt/template/detail/gateway/list"; - //鑾峰彇鍔熻兘鍒楄〃 - public static final String POST_GET_TEMPLATE_FUNCTION_LIST = "/smart-footstone/mgmt/template/detail/sid/list"; - //鑾峰彇鍦烘櫙鍒楄〃 - public static final String POST_GET_TEMPLATE_SCENE_LIST = "/smart-footstone/mgmt/template/detail/scene/list"; - //鑾峰彇瀹夐槻鍒楄〃 - public static final String POST_GET_TEMPLATE_SECURITY_LIST = "/smart-footstone/mgmt/template/detail/security/list"; - //鑾峰彇鑷姩鍖栧垪琛� - public static final String POST_GET_TEMPLATE_LOGIC_LIST = "/smart-footstone/mgmt/template/detail/logic/list"; - - - /***************鏁版嵁澶囦唤***************/ - /** - * 涓婁紶鏁版嵁澶囦唤 - */ - public static final String POST_BACKUP_UPLOAD = "/smart-footstone/debug/backup/file/upload"; - /** - * 鑾峰彇鏂囦欢涓嬭浇鍦板潃 - */ - public static final String POST_BACKUP_DOWNLOAD_URL = "/smart-footstone/debug/backup/file/newestUrl"; - /** - * 鍒犻櫎澶囦唤鏁版嵁 - */ - public static final String POST_BACKUP_DEL = "/smart-footstone/debug/backup/file/deleteByHouseIds"; - - /** - * 鑾峰彇澶囦唤鍒楄〃 - */ - public static final String POST_BACKUP_LIST = "/smart-footstone/mgmt/community/houseExtend/getHouseDebugPage"; - - /** - * 鑾峰彇缃戝叧鏈�鏂扮殑涓変唤澶囦唤鏁版嵁 - */ - public static final String POST_GATEWAY_BACKUP_LIST = "/iot-cloud/file/device/backup/threeLatest"; - /** - * 鑾峰彇璋冭瘯瀹屾垚鐨勫浠芥枃浠跺洖澶� - */ - public static final String POST_GATEWAY_BACKUP_DEBUGCOMPLETEBACKUPFILE = "/iot-cloud/file/device/backup/debugCompleteBackupFile"; - /** - * 缃戝叧鎭㈠鐨勫浠芥枃浠� - */ - public static final String POST_GATEWAY_BACKUP_RECOVER = "/iot-cloud/file/device/backup/recover"; - - - /** - * 鏇挎崲缃戝叧 - */ - public static final String POST_GATEWAY_REPLACE = "/home-wisdom/program/gateway/replace"; - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/BasePageInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/BasePageInfoBean.java deleted file mode 100644 index d8fb74e..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/BasePageInfoBean.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.hdl.linkpm.sdk.core.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/9/21. - */ -public class BasePageInfoBean implements Serializable { - - private int totalCount; - private int totalPage; - private int pageNo;//褰撳墠椤� - private int pageSize;//椤甸潰澶у皬 - - public int getTotalCount() { - return totalCount; - } - - public void setTotalCount(int totalCount) { - this.totalCount = totalCount; - } - - public int getTotalPage() { - return totalPage; - } - - public void setTotalPage(int totalPage) { - this.totalPage = totalPage; - } - - public int getPageNo() { - return pageNo; - } - - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/BaseRequestPageBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/BaseRequestPageBean.java deleted file mode 100644 index 83d2f4a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/BaseRequestPageBean.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.hdl.linkpm.sdk.core.bean; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/9/21. - */ -public class BaseRequestPageBean implements Serializable { - private int pageNo = 1;//鍝竴椤� (榛樿 1) - private int pageSize = 100;//椤靛ぇ灏� - - public int getPageNo() { - return pageNo; - } - - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/PageInfoListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/PageInfoListBean.java deleted file mode 100644 index 1cb59bf..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/bean/PageInfoListBean.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.hdl.linkpm.sdk.core.bean; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.home.bean.RoomInfoBean; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by hxb on 2022/2/28. - */ -public class PageInfoListBean<T> extends BasePageInfoBean { - - private List<T> list = new ArrayList<>(); - - @NonNull - public List<T> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<T> list) { - this.list = list; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IBaseCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IBaseCallBack.java deleted file mode 100644 index 4332b08..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IBaseCallBack.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hdl.linkpm.sdk.core.callback; - -import com.hdl.linkpm.sdk.core.exception.HDLException; - -/** - * Created by jlchen on 12/3/21. - */ -public interface IBaseCallBack { - /** - * 澶辫触 - * @param error 閿欒 - */ - void onFailure(HDLException error); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IDefaultCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IDefaultCallBack.java deleted file mode 100644 index 1fa1979..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IDefaultCallBack.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hdl.linkpm.sdk.core.callback; - -/** - * Created by jlchen on 12/2/21. - */ -public interface IDefaultCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IDefaultStrCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IDefaultStrCallBack.java deleted file mode 100644 index 22c8e80..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IDefaultStrCallBack.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hdl.linkpm.sdk.core.callback; - -/** - * Created by jlchen on 12/2/21. - */ -public interface IDefaultStrCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(String data); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IResponseCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IResponseCallBack.java deleted file mode 100644 index da6a342..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/callback/IResponseCallBack.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.hdl.linkpm.sdk.core.callback; - -/** - * Created by jlchen on 12/2/21. - * 閫氶厤鍥炶皟 - */ -public interface IResponseCallBack<T> extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(T objects); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/code/HDLCloudCode.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/code/HDLCloudCode.java deleted file mode 100644 index f601014..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/code/HDLCloudCode.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.hdl.linkpm.sdk.core.code; - -/** - * Created by jlchen on 12/3/21. - */ -public @interface HDLCloudCode { - //鎴愬姛 - int SUCCEED = 0; - - //绯荤粺绻佸繖 - int SYSTEM_BUSY = 1; - - //绯荤粺缁存姢 2 - - //鏈嶅姟寮傚父 3 - - //绛惧悕閿欒 4 - - //鍙傛暟寮傚父 5 - - //token瓒呮椂 - int TOKEN_TIMEOUT = 10001; - //璇烽噸鏂扮櫥褰� - int RE_LOGIN = 10002; - //涓嶅悎娉曠殑token锛岃璁ょ湡姣斿token鐨勭鍚� - int TOKEN_NOT_STANDARD = 10003; - //缂哄皯token鍙傛暟 - int NO_TOKEN = 10004; - //瑙f瀽鐢ㄦ埛韬唤閿欒锛岃閲嶆柊鐧诲綍 - int CODE_TOKEN_ERROR_10006 = 10006; - //鐢ㄦ埛宸茬粡琚鐢� - int CODE_TOKEN_ERROR_10009 = 10009; -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLErrorCode.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLErrorCode.java deleted file mode 100644 index 8a58163..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLErrorCode.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.hdl.linkpm.sdk.core.exception; - - -import com.hdl.linkpm.sdk.HDLLinkPMSdk; - -/** - * Created by jlchen on 12/2/21. - */ -public enum HDLErrorCode { - /***缃戠粶璇锋眰閫氫俊鑷畾涔夐敊璇爜**/ - HDL_DATA_PARSING_ERROR(-1000, HDLLinkPMSdk.isZh() == true ? "鏁版嵁瑙f瀽寮傚父" : "Data parsing error"), - /***鏈湴閫氫俊鑷畾涔夐敊璇爜**/ - HDL_DATA_ERROR(-2000, HDLLinkPMSdk.isZh() == true ? "鍙傛暟寮傚父" : "Parameter exception"), - HDL_DATA_NULL_ERROR(-2001, HDLLinkPMSdk.isZh() == true ? "鍙傛暟涓嶈兘涓虹┖" : "Parameter cannot be empty"), - HDL_TIMEOUT_ERROR(-2002, HDLLinkPMSdk.isZh() == true ? "瓒呮椂" : "timeout"); - - private String msg; - private int code; - - private HDLErrorCode(int code, String msg) { - this.msg = msg; - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java deleted file mode 100644 index 9a9b3e9..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLException.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.hdl.linkpm.sdk.core.exception; - -import android.text.TextUtils; - -import androidx.annotation.IntDef; -import androidx.annotation.Nullable; - -import com.hdl.hdlhttp.HxHttpConfig; -import com.hdl.hdlhttp.callback.HxException; -import com.hdl.linkpm.sdk.R; -import com.hdl.linkpm.sdk.core.response.BaseInfo; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Created by Tong on 2021/11/8. - */ -public class HDLException extends RuntimeException { - - private Throwable rawThrowable; - private int code; - private String msg; - - private BaseInfo.Extra mExtra; - - @Retention(RetentionPolicy.SOURCE) - @Target({ElementType.FIELD, ElementType.PARAMETER}) - @IntDef({ - ErrorCode.UNKNOWN, - ErrorCode.PARSE_ERROR, - ErrorCode.NETWORK_ERROR, - ErrorCode.HTTP_ERROR, - ErrorCode.SSL_ERROR, - ErrorCode.TIMEOUT_ERROR - }) - public @interface ErrorCode { - //鏈煡閿欒 - int UNKNOWN = -40000; - //瑙f瀽閿欒 - int PARSE_ERROR = -40001; - //缃戠粶閿欒 - int NETWORK_ERROR = -40002; - //鍗忚鍑洪敊 - int HTTP_ERROR = -40003; - //璇佷功鍑洪敊 - int SSL_ERROR = -40004; - //杩炴帴瓒呮椂 - int TIMEOUT_ERROR = -40005; - - } - - - private int getHxToErrorCode(@HxException.ErrorCode int hxCode) { - switch (hxCode) { - case HxException.ErrorCode.UNKNOWN: - return ErrorCode.UNKNOWN; - case HxException.ErrorCode.PARSE_ERROR: - return ErrorCode.PARSE_ERROR; - case HxException.ErrorCode.NETWORK_ERROR: - return ErrorCode.NETWORK_ERROR; - case HxException.ErrorCode.HTTP_ERROR: - return ErrorCode.HTTP_ERROR; - case HxException.ErrorCode.SSL_ERROR: - return ErrorCode.SSL_ERROR; - case HxException.ErrorCode.TIMEOUT_ERROR: - return ErrorCode.TIMEOUT_ERROR; - } - return ErrorCode.NETWORK_ERROR; - } - - public HDLException(HxException exception) { - this.code = getHxToErrorCode(exception.getCode()); - this.msg = exception.getMsg(); - this.rawThrowable = exception.getRawThrowable(); - } - - - public HDLException(int code, String msg) { - this.code = code; - this.msg = msg; - if (!TextUtils.isEmpty(msg)) { - this.msg = msg; - } else { - this.msg = HxHttpConfig.getInstance().getString(com.hdl.hdlhttp.R.string.network_error); - } - } - - public BaseInfo.Extra getmExtra() { - return mExtra; - } - - public void setExtra(BaseInfo.Extra mExtra) { - this.mExtra = mExtra; - } - - public HDLException(int code, String msg, BaseInfo.Extra extra) { - this.code = code; - this.msg = msg; - if (extra != null) { - this.mExtra = extra; - } - if (!TextUtils.isEmpty(msg)) { - this.msg = msg; - } else { - this.msg = HxHttpConfig.getInstance().getString(com.hdl.hdlhttp.R.string.network_error); - } - } - - - public boolean isNetError() { - return getCode() < 0; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - @Nullable - @Override - public String getMessage() { - if (rawThrowable != null) { - String message = rawThrowable.getMessage(); - if (!TextUtils.isEmpty(message)) { - return message; - } - if (!TextUtils.isEmpty(msg)) { - return msg; - } - } - return super.getMessage(); - } - - @Override - public String toString() { - return "HDLException{" + - "rawThrowable=" + rawThrowable + - ", code=" + code + - ", msg='" + msg + '\'' + - '}'; - } - - public static HDLException getErrorWithCode(HDLErrorCode code) { - return new HDLException(code.getCode(), code.getMsg()); - } - -} - - diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLLinkCopyException.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLLinkCopyException.java deleted file mode 100644 index bed9cfd..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/exception/HDLLinkCopyException.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.hdl.linkpm.sdk.core.exception; - -import androidx.annotation.NonNull; - -/** - * Created by Tong on 2021/11/11. - */ -public class HDLLinkCopyException extends RuntimeException { - - private int code = 0; - private String msg = ""; - private Throwable rawThrowable; - - public HDLLinkCopyException() { - } - - public HDLLinkCopyException(String msg) { - this.msg = msg; - } - - public HDLLinkCopyException(int code, String msg) { - this.code = code; - this.msg = msg; - } - - public HDLLinkCopyException(int code) { - this.code = code; - } - - public HDLLinkCopyException(Throwable rawThrowable) { - this.rawThrowable = rawThrowable; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public @NonNull - String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } - - public Throwable getRawThrowable() { - return rawThrowable; - } - - public void setRawThrowable(Throwable rawThrowable) { - this.rawThrowable = rawThrowable; - } - - public static HDLLinkCopyException getErrorWithCode(int code, String msg){ - return new HDLLinkCopyException(code,msg); - } -} - diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLEncryptInterceptor.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLEncryptInterceptor.java deleted file mode 100644 index 2165c3e..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLEncryptInterceptor.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.hdl.linkpm.sdk.core.interceptor; - -import android.net.Uri; -import android.text.TextUtils; - -import androidx.annotation.NonNull; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.reflect.TypeToken; -import com.hdl.hdlhttp.utils.GsonConvert; -import com.hdl.linkpm.sdk.HDLLinkPMSdk; -import com.hdl.linkpm.sdk.core.interceptor.HDLSmartHeader; -import com.hdl.linkpm.sdk.utils.HDLMD5Utils; -import com.hdl.linkpm.sdk.utils.HDLSDKLog; - -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import okhttp3.FormBody; -import okhttp3.Headers; -import okhttp3.Interceptor; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okio.Buffer; - -/** - * Created by Tong on 2021/11/4. - * 鍔犲瘑骞惰嚜鍔ㄨˉ鍏呭弬鏁�,appKey銆乼imestamp - * 鍙敮鎸佽〃鍗曘�乯son - * 鏈�缁坖son鏂瑰紡鎻愪氦 - */ -public class HDLEncryptInterceptor implements Interceptor { - - - @NonNull - @Override - public Response intercept(@NonNull Chain chain) throws IOException { - Request request = chain.request(); - Headers headers = request.headers(); - if (!isIgnoreSignHeader(headers)) { - return chain.proceed(encrypt(request)); - } - - return chain.proceed(request); - } - - - /** - * 娣诲姞sign瀛楁 - */ - private Request encrypt(Request request) { - final String timestamp = String.valueOf(System.currentTimeMillis()); - final String appKey = HDLLinkPMSdk.getAppKey(); - final String appSecret = HDLLinkPMSdk.getAppSecret(); - final JsonObject json = getBodyJson(request); - if (json != null) { - json.addProperty("appKey", appKey); - json.addProperty("timestamp", timestamp); - json.addProperty("sign", getSign(json, appSecret)); - final RequestBody requestBody = RequestBody.create(json.toString(), MediaType.parse("application/json;charset=UTF-8")); - return request.newBuilder().post(requestBody) - .build(); - } - return request; - } - - - /** - * 鏄惁蹇界暐鑷畾涔夌殑鍔犲瘑澶� - */ - private boolean isIgnoreSignHeader(Headers headers) { - String signHeader = headers.get(HDLSmartHeader.IGNORE_SIGN_HEADER); - - return !TextUtils.isEmpty(signHeader); - } - - private JsonObject getBodyJson(Request request) { - - RequestBody body = request.body(); - if (body instanceof FormBody) { - JsonObject object = new JsonObject(); - FormBody formBody = (FormBody) body; - for (int i = 0; i < formBody.size(); i++) { - object.addProperty(formBody.encodedName(i), formBody.value(i)); - } - return object; - } else { - //json鏍煎紡 - try { - String bodyString = getBodyString(request); - if (!TextUtils.isEmpty(bodyString)) { - final JsonElement parseString = JsonParser.parseString(bodyString); - return parseString.getAsJsonObject(); - } - } catch (Exception e) { - e.printStackTrace(); - } - - } - return null; - } - - private String getBodyString(Request request) { - try { - RequestBody body = request.body(); - if (body != null) { - Buffer buffer = new Buffer(); - body.writeTo(buffer); - Charset charset = StandardCharsets.UTF_8; - MediaType contentType = body.contentType(); - charset = contentType.charset(charset); - return buffer.readString(charset); - } - } catch (IOException e) { - e.printStackTrace(); - } - return ""; - } - - - /** - * 闇�瑕佹寜瀛楁瘝鎺掑簭 - * - * @param json 鎵�鏈夊瓧娈典娇鐢╱rlParameter鎷兼帴锛岄櫎浜哸ppSecret - */ - private String getSign(JsonObject json, String appSecret) { - String builder = jsonToUrlParameter(json) + - appSecret; - return HDLMD5Utils.encodeMD5(builder); - } - - - private String jsonToUrlParameter(JsonObject object) { - final Map<String, String> map = GsonConvert.getGson().fromJson(object, new TypeToken<Map<String, String>>() { - }.getType()); - final Uri.Builder builder = new Uri.Builder(); - List<String> list = new ArrayList<>(map.keySet()); - Collections.sort(list); - for (String key : list) { - //鍒ゆ柇褰撳墠鍊兼槸鍚﹂渶瑕佸弬涓庣鍚嶏紝淇濇寔璺熶簯绔竴鑷� - if (IfValueNeedSign(map.get(key))) { - builder.appendQueryParameter(key, map.get(key)); -// HDLSDKLog.e("瑕佺鍚嶏細" + key + " 锛�" + map.get(key)); - } else { -// HDLSDKLog.e("涓嶉渶瑕佺鍚嶏細" + key + " 锛�" + map.get(key)); - } - } - return builder.build().getQuery(); - } - - /** - * 鍒ゆ柇褰撳墠鍊兼槸鍚﹂渶瑕佸弬涓庣鍚嶏紝淇濇寔璺熶簯绔竴鑷� - * 绌哄瓧绗︿覆涓嶅弬涓� - * 鏁扮粍,闆嗗悎,瀵硅薄涓嶅弬涓� - * - * @param valueStr - * @return - */ - private static boolean IfValueNeedSign(String valueStr) { - if (TextUtils.isEmpty(valueStr)) - return false; - final char[] strChar = valueStr.substring(0, 1).toCharArray(); - final char firstChar = strChar[0]; - //System.out.println("getJSONType firstChar = "+firstChar); - if (firstChar != '{' && firstChar != '[') - return true; - - return false; - } -// /** -// * 鍒ゆ柇褰撳墠鍊兼槸鍚﹂渶瑕佸弬涓庣鍚嶏紝淇濇寔璺熶簯绔竴鑷� -// * 绌哄瓧绗︿覆涓嶅弬涓� -// * 鏁扮粍,闆嗗悎,瀵硅薄涓嶅弬涓� -// * -// * @param inputValueStr -// * @return -// */ -// private static boolean IfValueNeedSign(String inputValueStr) { -// if (TextUtils.isEmpty(inputValueStr)) -// return false; -// try { -// //鍏堣В鐮� -// String valueStr = URLDecoder.decode(inputValueStr, "utf-8"); -// final char[] strChar = valueStr.substring(0, 1).toCharArray(); -// final char firstChar = strChar[0]; -// //System.out.println("getJSONType firstChar = "+firstChar); -// if (firstChar != '{' && firstChar != '[') { -// return true; -// } -// return false; -// } catch (UnsupportedEncodingException e) { -// e.printStackTrace(); -// return false; -// } -// -// } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLLoginInterceptor.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLLoginInterceptor.java deleted file mode 100644 index f702e2d..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLLoginInterceptor.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.hdl.linkpm.sdk.core.interceptor; - -import android.text.TextUtils; -import android.util.Log; - -import androidx.annotation.NonNull; - -import com.google.gson.Gson; -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import com.google.gson.reflect.TypeToken; -import com.hdl.hdlhttp.HxHttpConfig; -import com.hdl.linkpm.sdk.core.api.HDLCloudUserApi; -import com.hdl.linkpm.sdk.core.code.HDLCloudCode; -import com.hdl.linkpm.sdk.core.response.BaseInfo; -import com.hdl.linkpm.sdk.user.HDLLinkPMUser; -import com.hdl.linkpm.sdk.user.bean.HDLLoginBean; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.io.IOException; -import java.nio.charset.Charset; - -import okhttp3.Headers; -import okhttp3.Interceptor; -import okhttp3.MediaType; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import okio.Buffer; -import okio.BufferedSource; - -/** - * Created by Tong on 2021/11/2. - */ -public class HDLLoginInterceptor implements Interceptor { - - @NonNull - @Override - public Response intercept(@NonNull Chain chain) throws IOException { - Request request = chain.request(); - if (!isRefreshTokenHeader(request.headers())) { - String token = HDLLinkPMUser.getInstance().getAccessToken(); - if (!TextUtils.isEmpty(token)) { - Request processRequest = addToken(request, token); - Response processResponse = chain.proceed(processRequest); - return disposeToken(chain, processRequest, processResponse); - } - } - return chain.proceed(request); - } - - @NonNull - private Response disposeToken(Chain chain, Request request, Response response) { - try { - -// ResponseBody responseBody2 = response.body(); -// BufferedSource source2 = responseBody2.source(); -// source2.request(Long.MAX_VALUE); -// Buffer buffer2 = source2.getBuffer().clone(); -// String respString2 = buffer2.readString(Charset.defaultCharset()); - //http鏍囧噯鐘舵�佺爜 - if (401 == response.code() || 402 == response.code() || 403 == response.code()) { - final String token = refreshToken(); - if (!TextUtils.isEmpty(token)) { - return chain.proceed(addToken(request, token)); - } - - } else if (response.isSuccessful()) { - ResponseBody responseBody = response.body(); - if (responseBody != null) { - BufferedSource source = responseBody.source(); - source.request(Long.MAX_VALUE); - Buffer buffer = source.getBuffer().clone(); - String respString = buffer.readString(Charset.defaultCharset()); - JsonObject object = JsonParser.parseString(respString).getAsJsonObject(); - int code = object.get("code").getAsInt(); - //1.鍒ゆ柇token鏄惁杩囨湡鏄惁闇�瑕佸埛鏂皌oken - if (isTokenTimeoutByCode(code)) { - final String token = refreshToken(); - if (!TextUtils.isEmpty(token)) { - return chain.proceed(addToken(request, token)); - } - } - //2.鍒ゆ柇Token鏄惁閿欒 鍙戦�佺櫥鍑哄鐞嗛�氱煡 - if (isTokenNeedReLoginByCode(code)) { - //3.娓呯┖鐧诲綍淇℃伅骞跺彂鍑洪噸鏂扮櫥褰曢�氱煡 - HDLLinkPMUser.getInstance().logout(0); - } - } - - } - - } catch (Exception e) { - Log.d("HDL===>", "disposeToken: 澶辫触," + e); - } - return response; - } - - /** - * 鏍规嵁code鍒ゆ柇token鏄惁澶辨晥 闇�瑕佸埛鏂伴噸鏂皌oken - * - * @param code 涓氬姟code - * @return ture 澶辨晥 - */ - private boolean isTokenTimeoutByCode(int code) { - return HDLCloudCode.TOKEN_TIMEOUT == code; - } - - /** - * 鏍规嵁code鍒ゆ柇token鏄惁澶辨晥 闇�瑕侀噸鏂扮櫥褰曠殑 - * - * @param code 涓氬姟code - * @return ture 澶辨晥 - */ - private boolean isTokenNeedReLoginByCode(int code) { - return HDLCloudCode.RE_LOGIN == code - || HDLCloudCode.TOKEN_NOT_STANDARD == code - || HDLCloudCode.NO_TOKEN == code - || HDLCloudCode.CODE_TOKEN_ERROR_10006 == code - || HDLCloudCode.CODE_TOKEN_ERROR_10009 == code; - } - - - /** - * 鏄惁瀛樺湪鍒锋柊澶� - */ - private boolean isRefreshTokenHeader(Headers headers) { - String signHeader = headers.get(HDLSmartHeader.REFRESH_TOKEN_HEADER); - return !TextUtils.isEmpty(signHeader); - } - - private Request addToken(Request request, String token) { - return request.newBuilder() - .removeHeader("Authorization") - .build() - .newBuilder() - .method(request.method(), request.body()) - .addHeader("Authorization", token) - .build(); - } - - /** - * 鎷︽埅鍣‥ncryptInterceptor浼氬鐞嗗姞瀵� - * - * @return token - */ - private String refreshToken() { - final String cacheRefreshToken = HDLLinkPMUser.getInstance().getRefreshToken(); - final String regionUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_LOGIN); - final OkHttpClient client = HxHttpConfig.getInstance().getClient(); - Request.Builder builder = new Request.Builder(); - - final JsonObject json = new JsonObject(); - json.addProperty("refreshToken", cacheRefreshToken); - json.addProperty("grantType", "refresh_token"); - - final RequestBody requestBody = RequestBody.create(json.toString(), MediaType.parse("application/json;charset=UTF-8")); - builder.post(requestBody); - builder.url(regionUrl); - builder.addHeader(HDLSmartHeader.REFRESH_TOKEN_HEADER, "0"); - try { - Response response = client.newCall(builder.build()).execute(); - if (response.isSuccessful()) { - ResponseBody responseBody = response.body(); - if (responseBody != null) { - BufferedSource source = responseBody.source(); - source.request(Long.MAX_VALUE); - Buffer buffer = source.getBuffer().clone(); - String respString = buffer.readString(Charset.defaultCharset()); - BaseInfo<HDLLoginBean> baseInfo = HDLGsonUtils.fromJson(respString, new TypeToken<BaseInfo<HDLLoginBean>>() { - }.getType()); - if (baseInfo != null) { - if (baseInfo.getCode() == HDLCloudCode.SUCCEED) { - if (baseInfo.getData() != null) { - HDLLoginBean loginBean = baseInfo.getData(); - HDLLinkPMUser.getInstance().updateRefreshToken(loginBean); - return loginBean.getHeaderPrefix() + loginBean.getAccessToken(); - } - } else { - //refreshToken涔熻繃鏈熺殑璇濓紝鍒欏彂鍑虹櫥鍑哄鐞嗛�氱煡锛岄噸鏂扮櫥褰� - //娓呯┖鐧诲綍淇℃伅骞跺彂鍑洪噸鏂扮櫥褰曢�氱煡 - HDLLinkPMUser.getInstance().logout(0); - } - } - } - } - } catch (Exception ignored) { - Log.d("HDL===>", "refreshToken: 澶辫触"); - } - return ""; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLSmartHeader.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLSmartHeader.java deleted file mode 100644 index 261d0a1..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLSmartHeader.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.hdl.linkpm.sdk.core.interceptor; - -/** - * Created by Tong on 2021/11/8. - * 鎷︽埅鍣ㄦ爣璇� - */ -public class HDLSmartHeader { - - //榛樿鎼哄甫鍔犲瘑銆佽В瀵嗕互鍙婃椂闂存埑锛屼娇鐢�"IGNORE_SIGN_HEADER"鍙互灞忚斀 - public static final String IGNORE_SIGN_HEADER = "IgnoreSignHeader"; - - //鍦ㄥ埛鏂癟oken - public static final String REFRESH_TOKEN_HEADER = "RefreshTokenHeader"; - - //璇锋眰璇█ - public static final String LANGUAGE_HEADER = "language"; - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLSmartHeaderInterceptor.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLSmartHeaderInterceptor.java deleted file mode 100644 index 0cf27a9..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/interceptor/HDLSmartHeaderInterceptor.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.hdl.linkpm.sdk.core.interceptor; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.HDLLinkPMSdk; - -import java.io.IOException; - -import okhttp3.Interceptor; -import okhttp3.Request; -import okhttp3.Response; - -/** - * Created by Tong on 2021/11/9. - * 鑷畾涔夊ご鍒犻櫎鎴栨坊鍔犲鐞� - */ -public class HDLSmartHeaderInterceptor implements Interceptor { - - - @NonNull - @Override - public Response intercept(@NonNull Chain chain) throws IOException { - Request request = chain.request().newBuilder() - .addHeader(HDLSmartHeader.LANGUAGE_HEADER, HDLLinkPMSdk.getLanguage())//閰嶇疆鎺ュ彛鍝嶅簲璇█ - .removeHeader(HDLSmartHeader.IGNORE_SIGN_HEADER) - .removeHeader(HDLSmartHeader.REFRESH_TOKEN_HEADER).build(); - return chain.proceed(request); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/response/BaseInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/response/BaseInfo.java deleted file mode 100644 index c807bcc..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/response/BaseInfo.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.hdl.linkpm.sdk.core.response; - - -import androidx.annotation.NonNull; - -import java.io.Serializable; - - -/** - * @Author : Zoro. - * @Date : 2019/6/9. - * @Describe : - */ -public class BaseInfo<T> implements Serializable { - - private int code; - private T data; - private String message; - - //杩欎釜鏄瘑鐮佽緭閿欒秴鍑烘鏁�,鎵嶆湁杩欎釜瀛楁; - private Extra extra; - - public BaseInfo(int code, T data) { - this.code = code; - this.data = data; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public T getData() { - return data; - } - - @NonNull - public String getMessage() { - return message == null ? "" : message; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setData(T data) { - this.data = data; - } - - public Extra getExtra() { - return extra; - } - - public void setExtra(Extra extra) { - this.extra = extra; - } - - public static class Extra { - - public int getMaxPwdErrorNum() { - return maxPwdErrorNum; - } - - public void setMaxPwdErrorNum(int maxPwdErrorNum) { - this.maxPwdErrorNum = maxPwdErrorNum; - } - - public long getUnlockTime() { - return unlockTime; - } - - public void setUnlockTime(long unlockTime) { - this.unlockTime = unlockTime; - } - - public int getCurrentPwdErrorNum() { - return currentPwdErrorNum; - } - - public void setCurrentPwdErrorNum(int currentPwdErrorNum) { - this.currentPwdErrorNum = currentPwdErrorNum; - } - - private int maxPwdErrorNum; - private long unlockTime; - - private int currentPwdErrorNum; - - } - - -} - diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/response/HDLResponse.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/response/HDLResponse.java deleted file mode 100644 index 260e8df..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/core/response/HDLResponse.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.hdl.linkpm.sdk.core.response; - - -import android.content.pm.ApplicationInfo; -import android.provider.Settings; -import android.widget.Toast; - -import com.hdl.hdlhttp.callback.HxException; -import com.hdl.hdlhttp.response.GsonSubscribe; -import com.hdl.hdlhttp.utils.ParameterizedTypeImpl; -import com.hdl.linkpm.sdk.HDLLinkPMSdk; -import com.hdl.linkpm.sdk.core.code.HDLCloudCode; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - - -/** - * Created by Tong on 2021/11/8. - */ -public abstract class HDLResponse<K> extends GsonSubscribe<BaseInfo<K>> { - - public abstract void onResponse(K response); - - public abstract void onFailure(HDLException e); - - @Override - public void onNext(String s) { - try { - Type type = getClass().getGenericSuperclass(); - if (type instanceof ParameterizedType) { - Type[] types = ((ParameterizedType) type).getActualTypeArguments(); - Type parameterizedType = new ParameterizedTypeImpl(BaseInfo.class, types, BaseInfo.class); - BaseInfo<K> data = HDLGsonUtils.fromJson(s, parameterizedType); - onSuccess(data); - } - } catch (Exception e) { - e.printStackTrace(); - this.onError(HxException.handleException(e)); - } - } - - @Override - public final void onSuccess(BaseInfo<K> response) { - if (response.getCode() == HDLCloudCode.SUCCEED) { - onResponse(response.getData()); - } else { -// if(HDLLinkPMSdk.isDebugVersion()){ -// HDLLinkPMSdk.showToast(response.getMessage()); -// } - onFailure(new HDLException(response.getCode(), response.getMessage(), response.getExtra())); - } - } - - @Override - public final void onError(HxException e) { -// if(HDLLinkPMSdk.isDebugVersion()){ -// HDLLinkPMSdk.showToast(e.getRawThrowable().getMessage()); -// } - onFailure(new HDLException(e.getCode(), e.getRawThrowable().getMessage(), null)); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/HDLLinkPMDevice.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/HDLLinkPMDevice.java deleted file mode 100644 index f579697..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/HDLLinkPMDevice.java +++ /dev/null @@ -1,272 +0,0 @@ -package com.hdl.linkpm.sdk.device; - -import android.text.TextUtils; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.core.api.HDLCloudHomeApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.device.bean.CategoryInfo; -import com.hdl.linkpm.sdk.device.bean.DeviceOidInfoBean; -import com.hdl.linkpm.sdk.device.bean.FunctionActionBean; -import com.hdl.linkpm.sdk.device.bean.FunctionInfoBaseBean; -import com.hdl.linkpm.sdk.device.bean.FunctionInfoListBean; -import com.hdl.linkpm.sdk.device.bean.GatewayCloudBean; -import com.hdl.linkpm.sdk.device.bean.ProductInfo; -import com.hdl.linkpm.sdk.device.controller.HDLPMDeviceController; -import com.hdl.linkpm.sdk.home.bean.QuestionInfo; -import com.hdl.linkpm.sdk.home.bean.QuestionListInfo; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; - -/** - * Created by jlchen on 12/2/21. - */ -public class HDLLinkPMDevice { - //instance - private volatile static HDLLinkPMDevice instance; - - /** - * getInstance - * - * @return HDLLinkDevice - */ - public static synchronized HDLLinkPMDevice getInstance() { - if (instance == null) { - synchronized (HDLLinkPMDevice.class) { - if (instance == null) { - instance = new HDLLinkPMDevice(); - } - } - } - return instance; - } - - /***************4.璁惧銆佸姛鑳藉鍒犳敼鏌ョ鐞�***************/ - /** - * 璁惧鍩烘湰淇℃伅鍒楄〃(oid)鍏ㄩ噺娣诲姞 - * - * @param homeId 浣忓畢id - * @param oidDeviceList 鏈�鏂扮殑璁惧Oid鍒楄〃 - * @param callBack - * @return - */ - public void fullAddDeviceOidList(String homeId, List<DeviceOidInfoBean> oidDeviceList, IDefaultCallBack callBack) { - HDLPMDeviceController.getInstance().fullAddDeviceOidList(homeId, oidDeviceList, callBack); - } - - /** - * 璁惧鍩烘湰淇℃伅鍒楄〃(oid)鑾峰彇 - * - * @param homeId 浣忓畢id - * @param callBack - * @return - */ - public void getDeviceOidList(String homeId, IResponseCallBack<List<DeviceOidInfoBean>> callBack) { - HDLPMDeviceController.getInstance().getDeviceOidList(homeId, callBack); - } - - /** - * 璁惧缃戝叧鍒楄〃 - * - * @param homeId 浣忓畢id - * @param callBack - * @return - */ - public void getGatewayList(String homeId, IResponseCallBack<List<GatewayCloudBean>> callBack) { - HDLPMDeviceController.getInstance().getGatewayList(homeId, callBack); - } - - - /** - * 璁惧鍩烘湰淇℃伅(oid)鍒犻櫎 - * 鍒犻櫎璁惧鎴栬�呬粠缃戝叧绛塷id - * - * @param homeId 浣忓畢id - * @param oid 璁惧鐨刼id - * @param callBack - * @return - */ - public void removeDeviceOid(String homeId, String oid, IDefaultCallBack callBack) { - HDLPMDeviceController.getInstance().removeDeviceOid(homeId, oid, callBack); - } - - /** - * 璁惧锛堝姛鑳斤級鍏ㄩ噺鏇存柊 - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param functionList 鏈�鏂扮殑鍔熻兘鍒楄〃 - * @param callBack - * @return - */ - public void fullAddFunctionList(String homeId, String gatewayId, List<FunctionInfoBaseBean> functionList, IDefaultCallBack callBack) { - HDLPMDeviceController.getInstance().fullAddFunctionList(homeId, gatewayId, functionList, callBack); - } - - /** - * 鑾峰彇绫荤洰 - * - * @param callBack - * @return - */ - public void getCategoryAllTree(IResponseCallBack<List<CategoryInfo>> callBack) { - HDLPMDeviceController.getInstance().getCategoryList(callBack); - } - - /** - * 鑾峰彇绫荤洰涓嬭澶囧垪琛ㄦ牴鎹悕瀛� - * - * @param callBack - * @return - */ - public void getCategoryListByName(String productName, IResponseCallBack<List<ProductInfo>> callBack) { - HDLPMDeviceController.getInstance().getCategoryListByName(productName, callBack); - } - - /** - * 鑾峰彇绫荤洰涓嬭澶囧垪琛ㄦ牴鎹被鐩� - * - * @param callBack - * @return - */ - public void getCategoryListByCode(String categorySecondCode, IResponseCallBack<List<ProductInfo>> callBack) { - HDLPMDeviceController.getInstance().getCategoryListByCode(categorySecondCode, callBack); - } - - /** - * 璁惧锛堝姛鑳斤級鍒楄〃鑾峰彇 - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param callBack - * @return - */ - public void getFunctionList(String homeId, String gatewayId, IResponseCallBack<FunctionInfoListBean> callBack) { - HDLPMDeviceController.getInstance().getFunctionList(homeId, gatewayId, callBack); - } - - /** - * 璁惧锛堝姛鑳斤級鍒犻櫎锛屾敮鎸佹壒閲� - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param devices 浜戠璁惧ID闆嗗悎 - * @param callBack - * @return - */ - public void batchDeleteFunctionList(String homeId, String gatewayId, List<String> devices, IDefaultCallBack callBack) { - HDLPMDeviceController.getInstance().batchDeleteFunctionList(homeId, gatewayId, devices, callBack); - } - - /** - * 鎺у埗璁惧 - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param actions 鍔ㄤ綔 - * @param callBack - * @return - */ - public void controlFunction(String homeId, String gatewayId, List<FunctionActionBean> actions, IDefaultCallBack callBack) { - HDLPMDeviceController.getInstance().controlFunction(homeId, gatewayId, actions, callBack); - } - - - /** - * 缁戝畾姣背娉㈣澶� - * - * @param homeId 浣忓畢Id - * @param name 璁惧鍚嶇О - * @param spk 浜у搧spk - * @param oid 璁惧oid - * @param mac 璁惧mac - * @param sid 璁惧sid - * @param uidList 鎴块棿uid鍒楄〃 - * @param callBack 鍥炶皟 - */ - public void bindMillimeterDevice(String homeId, String name, String spk, String oid, String mac, String sid, List<String> uidList, IResponseCallBack<String> callBack) { - HDLPMDeviceController.getInstance().bindMillimeterDevice(homeId, name, spk, oid, mac, sid, uidList, callBack); - } - - /** - * 瑙g粦姣背娉㈣澶� - * - * @param homeId 浣忓畢Id - * @param spk 浜у搧spk - * @param mac 璁惧mac - * @param callBack 鍥炶皟 - */ - public void unBindMillimeterDevice(String homeId, String spk, String mac, IResponseCallBack<String> callBack) { - HDLPMDeviceController.getInstance().unBindMillimeterDevice(homeId, spk, mac, callBack); - } - - /** - * 鑾峰彇link鍔熻兘鍒楄〃 - * - * @param homeId 浣忓畢Id - * @param spk spk - * @param callBack 鍥炶皟 - */ - public void getDeviceList(String homeId, String spk, IResponseCallBack<FunctionInfoListBean> callBack) { - HDLPMDeviceController.getInstance().getDeviceList(homeId, spk, callBack); - } - - /** - * 鑾峰彇姣背娉�(鑾峰彇璁惧杩滅▼閫氳淇℃伅) - * - * @param homeId 浣忓畢Id - * @param spk spk - * @param mac 璁惧mac - * @param callBack 鍥炶皟 - */ - public void getDeviceRemoteInfo(String homeId, String spk, String mac, IResponseCallBack<String> callBack) { - HDLPMDeviceController.getInstance().getDeviceRemoteInfo(homeId, spk, mac, callBack); - } - - /** - * 璁惧锛堝姛鑳斤級淇敼澶囨敞 - * - * @param homeId 浣忓畢id - * @param deviceId 璁惧Id - * @param name 璁惧鍚嶇О - */ - public void rename(String homeId, long deviceId,String name, IResponseCallBack<String> callBack) { - HDLPMDeviceController.getInstance().rename( homeId, deviceId, name, callBack); - } - - - /** - * 璁惧锛堝姛鑳斤級缁戝畾鎴块棿 - * - * @param homeId 浣忓畢id - * @param deviceIds 璁惧id鍒楄〃 - * @param roomIds 鎴块棿id鍒楄〃 - */ - public void bindRoom(String homeId, List<String> deviceIds,List<String> roomIds, IResponseCallBack<String> callBack) { - HDLPMDeviceController.getInstance().bindRoom( homeId, deviceIds, roomIds, callBack); - } - - - - /** - * 鑾峰彇甯歌闂鍒楄〃 - * - * @param languageType 0:涓枃 1:鑻辨枃,鍙敤鍊�:CHINESE,ENGLISH - * @param pageNo 褰撳墠椤� - * @param pageSize 椤甸潰澶у皬 - * @param question 闂 - * @param callBack - * @return - */ - public void getQuestionList(String languageType, String question, String pageNo, String pageSize, IResponseCallBack<QuestionListInfo> callBack) { - HDLPMDeviceController.getInstance().getQuestionList(languageType, question, pageNo, pageSize, callBack); - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/CategoryInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/CategoryInfo.java deleted file mode 100644 index f57b6a1..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/CategoryInfo.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/11/1 - * description: - */ -public class CategoryInfo implements Serializable { - private String categoryId; - private String categoryCode; - private String categoryName; - private String categoryType; - private String categoryIcon; - private List<CategoryInfo> children = new ArrayList<>(); - - public String getCategoryIcon() { - return categoryIcon == null ? "" : categoryIcon; - } - - public void setCategoryIcon(@NonNull String categoryIcon) { - this.categoryIcon = categoryIcon; - } - - public String getCategoryId() { - return categoryId == null ? "" : categoryId; - } - - public void setCategoryId(@NonNull String categoryId) { - this.categoryId = categoryId; - } - - public String getCategoryCode() { - return categoryCode == null ? "" : categoryCode; - } - - public void setCategoryCode(@NonNull String categoryCode) { - this.categoryCode = categoryCode; - } - - public String getCategoryName() { - return categoryName == null ? "" : categoryName; - } - - public void setCategoryName(@NonNull String categoryName) { - this.categoryName = categoryName; - } - - public String getCategoryType() { - return categoryType == null ? "" : categoryType; - } - - public void setCategoryType(@NonNull String categoryType) { - this.categoryType = categoryType; - } - - public List<CategoryInfo> getChildren() { - if (children == null) { - return children = new ArrayList<>(); - } - return children; - } - - public void setChildren(@NonNull List<CategoryInfo> children) { - this.children = children; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/DeviceOidInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/DeviceOidInfoBean.java deleted file mode 100644 index 68a5622..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/DeviceOidInfoBean.java +++ /dev/null @@ -1,153 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import androidx.annotation.NonNull; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; -import java.util.List; - -/** - * Created by jlchen on 12/11/21. - * 璁惧鍩烘湰淇℃伅(oid) - */ -public class DeviceOidInfoBean implements Serializable { - private String deviceOidId;//涓婁紶鍚庝簯绔垎閰嶇殑鍞竴ID - private String oid;//璁惧鐨刼id - @SerializedName(value = "mac", alternate = {"device_mac"}) - private String mac;//璁惧mac - private String protocolType;//鍗忚绫诲瀷(bus銆乲nx銆亃igbee) - private String deviceType;//璁惧绫诲瀷 - private String device_name;//璁惧鍚嶇О -// @SerializedName(value = "parentOid", alternate = {"from"}) - private String parentOid;//鐖惰澶噊id - private String device_model;//璁惧鍨嬪彿 - private String fw_version;//鍥轰欢鐗堟湰 - private String hw_info;//纭欢鐗堟湰 - private List<ImageInfoBean> image_info;//鐗堟湰淇℃伅 -// private String addresses;//瀛愮綉鍙疯澶囧彿 - - - @NonNull - public String getDeviceOidId() { - return deviceOidId == null ? "" : deviceOidId; - } - - public void setDeviceOidId(@NonNull String deviceOidId) { - this.deviceOidId = deviceOidId; - } - - @NonNull - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(@NonNull String oid) { - this.oid = oid; - } - - @NonNull - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - - @NonNull - public String getProtocolType() { - return protocolType == null ? "" : protocolType; - } - - public void setProtocolType(@NonNull String protocolType) { - this.protocolType = protocolType; - } - - @NonNull - public String getDeviceType() { - return deviceType == null ? "" : deviceType; - } - - public void setDeviceType(@NonNull String deviceType) { - this.deviceType = deviceType; - } - - @NonNull - public String getDevice_name() { - return device_name == null ? "" : device_name; - } - - public void setDevice_name(@NonNull String device_name) { - this.device_name = device_name; - } - - @NonNull - public String getParentOid() { - return parentOid == null ? "" : parentOid; - } - - public void setParentOid(@NonNull String parentOid) { - this.parentOid = parentOid; - } - - @NonNull - public String getDevice_model() { - return device_model == null ? "" : device_model; - } - - public void setDevice_model(@NonNull String device_model) { - this.device_model = device_model; - } - - @NonNull - public String getFw_version() { - return fw_version == null ? "" : fw_version; - } - - public void setFw_version(@NonNull String fw_version) { - this.fw_version = fw_version; - } - - @NonNull - public String getHw_info() { - return hw_info == null ? "" : hw_info; - } - - public void setHw_info(@NonNull String hw_info) { - this.hw_info = hw_info; - } - - public static class ImageInfoBean implements Serializable { - private String imageId;//闀滃儚id - private String fw_version;//鍥轰欢鐗堟湰 - private String hw_version;//纭欢鐗堟湰 - - @NonNull - public String getImageId() { - return imageId == null ? "" : imageId; - } - - public void setImageId(@NonNull String imageId) { - this.imageId = imageId; - } - - @NonNull - public String getFw_version() { - return fw_version == null ? "" : fw_version; - } - - public void setFw_version(@NonNull String fw_version) { - this.fw_version = fw_version; - } - - @NonNull - public String getHw_version() { - return hw_version == null ? "" : hw_version; - } - - public void setHw_version(@NonNull String hw_version) { - this.hw_version = hw_version; - } - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionActionBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionActionBean.java deleted file mode 100644 index 0845ff7..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionActionBean.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/11/21. - */ -public class FunctionActionBean implements Serializable{ - - private String deviceId;//璁惧涓婚敭id - private String spk;//spk - private List<StatusBean> attributes = new ArrayList<>();//鎺у埗鍔ㄤ綔 - - @NonNull - public String getDeviceId() { - return deviceId == null ? "" : deviceId; - } - - public void setDeviceId(@NonNull String deviceId) { - this.deviceId = deviceId; - } - - @NonNull - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(@NonNull String spk) { - this.spk = spk; - } - - @NonNull - public List<StatusBean> getAttributes() { - if (attributes == null) { - return new ArrayList<>(); - } - return attributes; - } - - public void setAttributes(@NonNull List<StatusBean> attributes) { - this.attributes = attributes; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionAttributesBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionAttributesBean.java deleted file mode 100644 index 22d07c6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionAttributesBean.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/11/21. - */ -public class FunctionAttributesBean implements Serializable{ - - private String key; - private String data_type; - private String max; - private String min; - private List<String> value = new ArrayList<>(); - - public String getMax() { - return max == null ? "" : max; - } - - public void setMax(@NonNull String max) { - this.max = max; - } - - public String getMin() { - return min == null ? "" : min; - } - - public void setMin(@NonNull String min) { - this.min = min; - } - - @NonNull - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(@NonNull String key) { - this.key = key; - } - - @NonNull - public String getData_type() { - return data_type == null ? "" : data_type; - } - - public void setData_type(@NonNull String data_type) { - this.data_type = data_type; - } - - @NonNull - public List<String> getValue() { - if (value == null) { - return new ArrayList<>(); - } - return value; - } - - public void setValue(@NonNull List<String> value) { - this.value = value; - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoBaseBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoBaseBean.java deleted file mode 100644 index ebe0d66..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoBaseBean.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/11/21. - * 鍔熻兘鍩虹鍙傛暟锛屾湰鍦伴�氫俊浣跨敤 - */ -public class FunctionInfoBaseBean implements Serializable { - - private String sid;//鍔熻兘Id - private List<String> uids = new ArrayList<>();//鎵�鍒嗛厤鐨勬埧闂磚id闆嗗悎 - private String name;//鍔熻兘鍚嶇О - private String spk;//鍔熻兘绫诲瀷 - private String oid;//璁惧瀵瑰簲鐨刼id - private String omodel;//鐗╃悊璁惧(妯″潡)鍨嬪彿 - private List<FunctionAttributesBean> attributes = new ArrayList<>();//灞炴�� - private String extend;//鎵╁睍淇℃伅 - - - - private String src;//璁惧鏉ユ簮 - - /** - * 1:灞曠ず 2:涓嶅睍绀� - */ - private String show; - - public String getSrc() { - return src; - } - - public void setSrc(String src) { - this.src = src; - } - - public String getShow() { - return show == null ? "1" : show; - } - - public void setShow(@NonNull String show) { - this.show = show; - } - - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public List<String> getUids() { - if (uids == null) { - return new ArrayList<>(); - } - return uids; - } - - public void setUids(@NonNull List<String> uids) { - this.uids = uids; - } - - @NonNull - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - @NonNull - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(@NonNull String spk) { - this.spk = spk; - } - - @NonNull - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(@NonNull String oid) { - this.oid = oid; - } - - @NonNull - public String getOmodel() { - return omodel == null ? "" : omodel; - } - - public void setOmodel(@NonNull String omodel) { - this.omodel = omodel; - } - - @NonNull - public List<FunctionAttributesBean> getAttributes() { - if (attributes == null) { - return new ArrayList<>(); - } - return attributes; - } - - public void setAttributes(@NonNull List<FunctionAttributesBean> attributes) { - this.attributes = attributes; - } - - @NonNull - public String getExtend() { - return extend == null ? "" : extend; - } - - public void setExtend(@NonNull String extend) { - this.extend = extend; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoBean.java deleted file mode 100644 index af59704..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoBean.java +++ /dev/null @@ -1,245 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/11/21. - */ -public class FunctionInfoBean extends FunctionInfoBaseBean { -// -// private String sid;//鍔熻兘Id -// private List<String> uids;//鎵�鍒嗛厤鐨勬埧闂磚id闆嗗悎 -// private String name;//鍔熻兘鍚嶇О -// private String spk;//鍔熻兘绫诲瀷 -// private String oid;//璁惧瀵瑰簲鐨刼id -// private String omodel;//鐗╃悊璁惧(妯″潡)鍨嬪彿 -// private List<FunctionInfoBaseBean.AttributesBean> attributes;//灞炴�� -// private String extend;//鎵╁睍淇℃伅 -// - - private String deviceId; - private String homeId; - private List<String> roomIds = new ArrayList<>(); - private List<RoomInfosBean> roomInfos = new ArrayList<>(); - private String gatewayId; - private String gatewayName; - private boolean collect; - private boolean online; - private String controlCounter; - private List<StatusBean> status = new ArrayList<>(); - private String createTime; - private String modifyTime; - private String productBrand; - private String productPic; - private String deviceMac;//姣背娉㈢嫭鏈� - - - public String getDeviceMac() { - return deviceMac == null ? "" : this.deviceMac; - } - - public void setDeviceMac(String deviceMac) { - this.deviceMac = deviceMac; - } - - @NonNull - public String getDeviceId() { - return deviceId == null ? "" : deviceId; - } - - public void setDeviceId(@NonNull String deviceId) { - this.deviceId = deviceId; - } - - @NonNull - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - public void setHomeId(@NonNull String homeId) { - this.homeId = homeId; - } - - @NonNull - public List<String> getRoomIds() { - if (roomIds == null) { - return new ArrayList<>(); - } - return roomIds; - } - - public void setRoomIds(@NonNull List<String> roomIds) { - this.roomIds = roomIds; - } - - @NonNull - public List<RoomInfosBean> getRoomInfos() { - if (roomInfos == null) { - return new ArrayList<>(); - } - return roomInfos; - } - - public void setRoomInfos(@NonNull List<RoomInfosBean> roomInfos) { - this.roomInfos = roomInfos; - } - - @NonNull - public String getGatewayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGatewayId(@NonNull String gatewayId) { - this.gatewayId = gatewayId; - } - - @NonNull - public String getGatewayName() { - return gatewayName == null ? "" : gatewayName; - } - - public void setGatewayName(@NonNull String gatewayName) { - this.gatewayName = gatewayName; - } - - public boolean isCollect() { - return collect; - } - - public void setCollect(boolean collect) { - this.collect = collect; - } - - public boolean isOnline() { - return online; - } - - public void setOnline(boolean online) { - this.online = online; - } - - @NonNull - public String getControlCounter() { - return controlCounter == null ? "" : controlCounter; - } - - public void setControlCounter(@NonNull String controlCounter) { - this.controlCounter = controlCounter; - } - - @NonNull - public List<StatusBean> getStatus() { - if (status == null) { - return new ArrayList<>(); - } - return status; - } - - public void setStatus(@NonNull List<StatusBean> status) { - this.status = status; - } - - @NonNull - public String getCreateTime() { - return createTime == null ? "" : createTime; - } - - public void setCreateTime(@NonNull String createTime) { - this.createTime = createTime; - } - - @NonNull - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } - - public void setModifyTime(@NonNull String modifyTime) { - this.modifyTime = modifyTime; - } - - @NonNull - public String getProductBrand() { - return productBrand == null ? "" : productBrand; - } - - public void setProductBrand(@NonNull String productBrand) { - this.productBrand = productBrand; - } - - @NonNull - public String getProductPic() { - return productPic == null ? "" : productPic; - } - - public void setProductPic(@NonNull String productPic) { - this.productPic = productPic; - } - - public static class RoomInfosBean implements Serializable { - private String floorId; - private String floorUid; - private String floorName; - private String roomId; - private String roomUid; - private String roomName; - - @NonNull - public String getFloorId() { - return floorId == null ? "" : floorId; - } - - public void setFloorId(@NonNull String floorId) { - this.floorId = floorId; - } - - @NonNull - public String getFloorUid() { - return floorUid == null ? "" : floorUid; - } - - public void setFloorUid(@NonNull String floorUid) { - this.floorUid = floorUid; - } - - @NonNull - public String getFloorName() { - return floorName == null ? "" : floorName; - } - - public void setFloorName(@NonNull String floorName) { - this.floorName = floorName; - } - - @NonNull - public String getRoomId() { - return roomId == null ? "" : roomId; - } - - public void setRoomId(@NonNull String roomId) { - this.roomId = roomId; - } - - @NonNull - public String getRoomUid() { - return roomUid == null ? "" : roomUid; - } - - public void setRoomUid(@NonNull String roomUid) { - this.roomUid = roomUid; - } - - @NonNull - public String getRoomName() { - return roomName == null ? "" : roomName; - } - - public void setRoomName(@NonNull String roomName) { - this.roomName = roomName; - } - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoListBean.java deleted file mode 100644 index 3368bcf..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/FunctionInfoListBean.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/11/21. - */ -public class FunctionInfoListBean implements Serializable{ - - private List<FunctionInfoBean> list = new ArrayList<>(); - - @NonNull - public List<FunctionInfoBean> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<FunctionInfoBean> list) { - this.list = list; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/GatewayCloudBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/GatewayCloudBean.java deleted file mode 100644 index e3539fb..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/GatewayCloudBean.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/11/7 - * description: - */ -public class GatewayCloudBean implements Serializable { - private String aesKey; - private String createTime; - private String deviceId; - /** - * 0.SM4 1.AES 2.涓嶅姞瀵� - */ - private String encryptionType; - private String gatewayName; - /** - * 缃戝叧绫诲瀷 - * BUSUDPGATEWAY - * AGATEWAY - * ZIGBEEGATEWAY - * KNXGATEWAY - */ - private String gatewayType; - private String groupName; - private String gwFirmwareVersion; - private String homeId; - private String gatewayId; - private String mac; - private String oid; - private String modifyPeople; - private String deviceModel; - private String modifyTime; - private String primaryKey; - private String projectName; - private String region; - private String subnetId; - private String userName; - private boolean gatewayStatus; - private String lastHeartbeatTime; - private String localSecret; - private List<SlaveGatewayCloudBean> slaveDevices = new ArrayList<>(); - - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(@NonNull String oid) { - this.oid = oid; - } - - public String getDeviceModel() { - return deviceModel == null ? "" : deviceModel; - } - - public void setDeviceModel(@NonNull String deviceModel) { - this.deviceModel = deviceModel; - } - - public String getAesKey() { - return aesKey == null ? "" : aesKey; - } - - public void setAesKey(@NonNull String aesKey) { - this.aesKey = aesKey; - } - - public boolean isGatewayStatus() { - return gatewayStatus; - } - - public void setGatewayStatus(@NonNull boolean gatewayStatus) { - this.gatewayStatus = gatewayStatus; - } - - public String getCreateTime() { - return createTime == null ? "" : createTime; - } - - public void setCreateTime(@NonNull String createTime) { - this.createTime = createTime; - } - - public String getDeviceId() { - return deviceId == null ? "" : deviceId; - } - - public void setDeviceId(@NonNull String deviceId) { - this.deviceId = deviceId; - } - - public String getEncryptionType() { - return encryptionType == null ? "" : encryptionType; - } - - public void setEncryptionType(@NonNull String encryptionType) { - this.encryptionType = encryptionType; - } - - public String getGatewayName() { - return gatewayName == null ? "" : gatewayName; - } - - public void setGatewayName(@NonNull String gatewayName) { - this.gatewayName = gatewayName; - } - - public String getGatewayType() { - return gatewayType == null ? "" : gatewayType; - } - - public void setGatewayType(@NonNull String gatewayType) { - this.gatewayType = gatewayType; - } - - public String getGroupName() { - return groupName == null ? "" : groupName; - } - - public void setGroupName(@NonNull String groupName) { - this.groupName = groupName; - } - - public String getGwFirmwareVersion() { - return gwFirmwareVersion == null ? "" : gwFirmwareVersion; - } - - public void setGwFirmwareVersion(@NonNull String gwFirmwareVersion) { - this.gwFirmwareVersion = gwFirmwareVersion; - } - - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - public void setHomeId(@NonNull String homeId) { - this.homeId = homeId; - } - - public String getGatewayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGatewayId(@NonNull String gatewayId) { - this.gatewayId = gatewayId; - } - - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - - public String getModifyPeople() { - return modifyPeople == null ? "" : modifyPeople; - } - - public void setModifyPeople(@NonNull String modifyPeople) { - this.modifyPeople = modifyPeople; - } - - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } - - public void setModifyTime(@NonNull String modifyTime) { - this.modifyTime = modifyTime; - } - - public String getPrimaryKey() { - return primaryKey == null ? "" : primaryKey; - } - - public void setPrimaryKey(@NonNull String primaryKey) { - this.primaryKey = primaryKey; - } - - public String getProjectName() { - return projectName == null ? "" : projectName; - } - - public void setProjectName(@NonNull String projectName) { - this.projectName = projectName; - } - - public String getRegion() { - return region == null ? "" : region; - } - - public void setRegion(@NonNull String region) { - this.region = region; - } - - public String getSubnetId() { - return subnetId == null ? "" : subnetId; - } - - public void setSubnetId(@NonNull String subnetId) { - this.subnetId = subnetId; - } - - public String getUserName() { - return userName == null ? "" : userName; - } - - public void setUserName(@NonNull String userName) { - this.userName = userName; - } - - public String getLastHeartbeatTime() { - return lastHeartbeatTime == null ? "" : lastHeartbeatTime; - } - - public void setLastHeartbeatTime(@NonNull String lastHeartbeatTime) { - this.lastHeartbeatTime = lastHeartbeatTime; - } - - public String getLocalSecret() { - return localSecret == null ? "" : localSecret; - } - - public void setLocalSecret(@NonNull String localSecret) { - this.localSecret = localSecret; - } - - public List<SlaveGatewayCloudBean> getSlaveDevices() { - if (slaveDevices == null) { - return slaveDevices = new ArrayList<>(); - } - return slaveDevices; - } - - public void setSlaveDevices(@NonNull List<SlaveGatewayCloudBean> slaveDevices) { - this.slaveDevices = slaveDevices; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/ProductInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/ProductInfo.java deleted file mode 100644 index 5c1fd7c..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/ProductInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/11/1 - * description: - */ -public class ProductInfo implements Serializable { - private String productName; - private String productModel; - private String imageUrl; - - public String getImageUrl() { - return imageUrl == null ? "" : imageUrl; - } - - public void setImageUrl(@NonNull String imageUrl) { - this.imageUrl = imageUrl; - } - - public String getProductName() { - return productName == null ? "" : productName; - } - - public void setProductName(@NonNull String productName) { - this.productName = productName; - } - - public String getProductModel() { - return productModel == null ? "" : productModel; - } - - public void setProductModel(@NonNull String productModel) { - this.productModel = productModel; - } - - public ProductInfo() { - } - - public ProductInfo(String productName, String productModel, String imageUrl) { - this.productName = productName; - this.productModel = productModel; - this.imageUrl = imageUrl; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/SlaveGatewayCloudBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/SlaveGatewayCloudBean.java deleted file mode 100644 index 9f0d6e3..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/SlaveGatewayCloudBean.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import java.io.Serializable; - -/** - * Created by Zoro - * Created on 2022/11/7 - * description: - */ -public class SlaveGatewayCloudBean implements Serializable { - /** - * 鍗忚绫诲瀷(bus銆乲nx銆亃igbee) - */ - private String protocolType; - private String deviceName; - private String deviceType; - private String oid; - private String addresses; - private String deviceModel; - private String mac; - - public String getProtocolType() { - return protocolType == null ? "" : protocolType; - } - - public String getDeviceName() { - return deviceName == null ? "" : deviceName; - } - - public String getDeviceType() { - return deviceType == null ? "" : deviceType; - } - - public String getOid() { - return oid == null ? "" : oid; - } - - public String getAddresses() { - return addresses == null ? "" : addresses; - } - - public String getDeviceModel() { - return deviceModel == null ? "" : deviceModel; - } - - public String getMac() { - return mac == null ? "" : mac; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/StatusBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/StatusBean.java deleted file mode 100644 index 72190a7..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/bean/StatusBean.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.hdl.linkpm.sdk.device.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/14/21. - * 鐘舵�佹垨鑰卆ttributes鎺у埗鍔ㄤ綔 - */ -public class StatusBean implements Serializable { - private String key;//灞炴�у悕 - private String value;//灞炴�у�� - - @NonNull - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(@NonNull String key) { - this.key = key; - } - - @NonNull - public String getValue() { - return value == null ? "" : value; - } - - public void setValue(@NonNull String value) { - this.value = value; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/controller/HDLPMDeviceController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/controller/HDLPMDeviceController.java deleted file mode 100644 index fbcd40c..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/controller/HDLPMDeviceController.java +++ /dev/null @@ -1,733 +0,0 @@ -package com.hdl.linkpm.sdk.device.controller; - -import android.text.TextUtils; - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.core.api.HDLCloudHomeApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.device.bean.CategoryInfo; -import com.hdl.linkpm.sdk.device.bean.DeviceOidInfoBean; -import com.hdl.linkpm.sdk.device.bean.FunctionActionBean; -import com.hdl.linkpm.sdk.device.bean.FunctionInfoBaseBean; -import com.hdl.linkpm.sdk.device.bean.FunctionInfoListBean; -import com.hdl.linkpm.sdk.device.bean.GatewayCloudBean; -import com.hdl.linkpm.sdk.device.bean.ProductInfo; -import com.hdl.linkpm.sdk.home.bean.QuestionListInfo; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; - -/** - * Created by jlchen on 12/3/21. - * 璁惧鐩稿叧鐨勭綉缁滆姹� - */ -public class HDLPMDeviceController { - /** - * instance - */ - private volatile static HDLPMDeviceController instance; - - /** - * getInstance - * - * @return HDLDeviceController - */ - public static synchronized HDLPMDeviceController getInstance() { - if (instance == null) { - synchronized (HDLPMDeviceController.class) { - if (instance == null) { - instance = new HDLPMDeviceController(); - } - } - } - return instance; - } - - /***************4.璁惧銆佸姛鑳藉鍒犳敼鏌ョ鐞�***************/ - /** - * 璁惧鍩烘湰淇℃伅鍒楄〃(oid)鍏ㄩ噺娣诲姞 - * - * @param homeId 浣忓畢id - * @param oidDeviceList 鏈�鏂扮殑璁惧Oid鍒楄〃 - * @param callBack - * @return - */ - public Disposable fullAddDeviceOidList(String homeId, List<DeviceOidInfoBean> oidDeviceList, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("devices", HDLGsonUtils.toJsonArray(oidDeviceList)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_OID_LIST_FULL_ADD); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 璁惧鍩烘湰淇℃伅鍒楄〃(oid)鑾峰彇 - * - * @param homeId 浣忓畢id - * @param callBack - * @return - */ - public Disposable getDeviceOidList(String homeId, IResponseCallBack<List<DeviceOidInfoBean>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_OID_LIST_GET); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<DeviceOidInfoBean>>() { - @Override - public void onResponse(List<DeviceOidInfoBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 璁惧鍩烘湰淇℃伅(oid)鍒犻櫎 - * 鍒犻櫎璁惧鎴栬�呬粠缃戝叧绛塷id - * - * @param homeId 浣忓畢id - * @param oid 璁惧鐨刼id - * @param callBack - * @return - */ - public Disposable removeDeviceOid(String homeId, String oid, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("oid", oid); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_OID_REMOVE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 璁惧锛堝姛鑳斤級鍏ㄩ噺鏇存柊 - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param functionList 鏈�鏂扮殑鍔熻兘鍒楄〃 - * @param callBack - * @return - */ - public Disposable fullAddFunctionList(String homeId, String gatewayId, List<FunctionInfoBaseBean> functionList, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.add("devices", HDLGsonUtils.toJsonArray(functionList)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_FUNCTION_LIST_FULL_ADD); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇浜у搧鍒嗙被鏍� - * - * @param callBack - * @return - */ - public Disposable getCategoryList(IResponseCallBack<List<CategoryInfo>> callBack) { - JsonObject json = new JsonObject(); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_CATEGORY_LIST_ALLTREE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<CategoryInfo>>() { - @Override - public void onResponse(List<CategoryInfo> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇缃戝叧鍒楄〃 - * - * @param callBack - * @return - */ - public Disposable getGatewayList(String homeId, IResponseCallBack<List<GatewayCloudBean>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_GATEWAY_LIST); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<GatewayCloudBean>>() { - @Override - public void onResponse(List<GatewayCloudBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鑾峰彇绫荤洰涓嬭澶囧垪琛� - * - * @param callBack - * @return - */ - public Disposable getCategoryListByName(String productName, IResponseCallBack<List<ProductInfo>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("productName", productName); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_CATEGORY_DEVICE_LIST); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<ProductInfo>>() { - @Override - public void onResponse(List<ProductInfo> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇绫荤洰涓嬭澶囧垪琛� - * - * @param callBack - * @return - */ - public Disposable getCategoryListByCode(String categorySecondCode, IResponseCallBack<List<ProductInfo>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("categorySecondCode", categorySecondCode); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_CATEGORY_DEVICE_LIST); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<ProductInfo>>() { - @Override - public void onResponse(List<ProductInfo> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 璁惧锛堝姛鑳斤級鍒楄〃鑾峰彇 - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param callBack - * @return - */ - public Disposable getFunctionList(String homeId, String gatewayId, IResponseCallBack<FunctionInfoListBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_FUNCTION_LIST_GET); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<FunctionInfoListBean>() { - @Override - public void onResponse(FunctionInfoListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 璁惧锛堝姛鑳斤級鍒犻櫎锛屾敮鎸佹壒閲� - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param devices 浜戠璁惧ID闆嗗悎 - * @param callBack - * @return - */ - public Disposable batchDeleteFunctionList(String homeId, String gatewayId, List<String> devices, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.add("devices", HDLGsonUtils.toJsonArray(devices)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_FUNCTION_BATCH_DELETE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鎺у埗璁惧 - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧Id - * @param actions 鍔ㄤ綔 - * @param callBack - * @return - */ - public Disposable controlFunction(String homeId, String gatewayId, List<FunctionActionBean> actions, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.add("actions", HDLGsonUtils.toJsonArray(actions)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_FUNCTION_CONTROL); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鑾峰彇甯歌闂鍒楄〃 - * - * @param languageType 0:涓枃 1:鑻辨枃,鍙敤鍊�:CHINESE,ENGLISH - * @param pageNo 褰撳墠椤� - * @param pageSize 椤甸潰澶у皬 - * @param question 闂 - * @param callBack - * @return - */ - public Disposable getQuestionList(String languageType, String question, String pageNo, String pageSize, IResponseCallBack<QuestionListInfo> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("zoneType", languageType); - json.addProperty("question", question); - json.addProperty("pageNo", pageNo); - json.addProperty("pageSize", pageSize); - json.addProperty("softwareType", "DEBUGGING_TREASURE"); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_QUESTION_GET_LIST); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<QuestionListInfo>() { - @Override - public void onResponse(QuestionListInfo response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 缁戝畾姣背娉㈣澶� - * - * @param homeId 浣忓畢Id - * @param name 璁惧鍚嶇О - * @param apk 浜у搧spk - * @param oid 璁惧oid - * @param mac 璁惧mac - * @param sid 璁惧sid - * @param uidList 鎴块棿uid鍒楄〃 - * @param callBack 鍥炶皟 - * @return - - */ - public Disposable bindMillimeterDevice(String homeId, String name, String apk, String oid, String mac, String sid, List<String> uidList, IResponseCallBack<String> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("name", name); - json.addProperty("spk", apk); - json.addProperty("oid", oid); - json.addProperty("mac", mac); - json.addProperty("sid", sid); - if(uidList!=null) { - json.add("uids", HDLGsonUtils.toJsonArray(uidList)); - } - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_INDEPENDENT_REGISTER); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String str) { - if (callBack != null) { - callBack.onSuccess(str); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 瑙g粦姣背娉㈣澶� - * - * @param homeId 浣忓畢Id - * @param spk 浜у搧spk - * @param mac 璁惧mac - * @param callBack 鍥炶皟 - * @return - - */ - public Disposable unBindMillimeterDevice(String homeId, String spk, String mac, IResponseCallBack<String> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("spk", spk); - json.addProperty("mac", mac); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_INDEPENDENT_UNBIND); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String str) { - if (callBack != null) { - callBack.onSuccess(str); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇link鍔熻兘鍒楄〃 - * - * @param homeId 浣忓畢Id - * @param spk spk(鎸囧畾鑾峰彇鍗曚釜鍔熻兘) - * @param callBack 鍥炶皟 - * @return - - */ - public Disposable getDeviceList(String homeId, String spk, IResponseCallBack<FunctionInfoListBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - if(!TextUtils.isEmpty(spk)) { - json.addProperty("spk", spk); - } - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_FUNCTION_LIST_GET); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<FunctionInfoListBean>() { - @Override - public void onResponse(FunctionInfoListBean functionInfoListBean) { - if (callBack != null) { - callBack.onSuccess(functionInfoListBean); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇姣背娉�(鑾峰彇璁惧杩滅▼閫氳淇℃伅) - * - * @param homeId 浣忓畢Id - * @param spk spk - * @param mac 璁惧mac - * @param callBack 鍥炶皟 - * @return - - */ - public Disposable getDeviceRemoteInfo(String homeId, String spk,String mac, IResponseCallBack<String> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("spk", spk); - json.addProperty("mac", mac); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_REMOTEINFO_GET); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String str) { - if (callBack != null) { - callBack.onSuccess(str); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 璁惧锛堝姛鑳斤級淇敼澶囨敞 - * - * @param homeId 浣忓畢id - * @param deviceId 璁惧Id - * @param name 璁惧鍚嶇О - * @return callBack - */ - public Disposable rename(String homeId, long deviceId,String name, IResponseCallBack<String> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("deviceId", deviceId); - json.addProperty("name", name); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_RENAME); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String string) { - if (callBack != null) { - callBack.onSuccess(string); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 璁惧锛堝姛鑳斤級缁戝畾鎴块棿 - * - * @param homeId 浣忓畢id - * @param deviceIds 璁惧id鍒楄〃 - * @param roomIds 鎴块棿id鍒楄〃 - * @return callBack - */ - public Disposable bindRoom(String homeId, List<String> deviceIds,List<String> roomIds, IResponseCallBack<String> callBack) { - JsonObject json = new JsonObject(); - JsonArray deviceIdsArray=new JsonArray(); - JsonArray roomIdsArray=new JsonArray(); - for (int i = 0; i < deviceIds.size(); i++) { - deviceIdsArray.add(deviceIdsArray.get(i)); - } - for (int i = 0; i < roomIds.size(); i++) { - roomIdsArray.add(roomIdsArray.get(i)); - } - json.addProperty("homeId", homeId); - json.add("deviceIds", deviceIdsArray); - json.add("roomIds", roomIdsArray); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_BINDROOM); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String string) { - if (callBack != null) { - callBack.onSuccess(string); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/spk/BrandType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/spk/BrandType.java deleted file mode 100644 index 2a01258..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/spk/BrandType.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hdl.linkpm.sdk.device.spk; - -import androidx.annotation.IntDef; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.SOURCE; - - -/** - * Created by jlchen on 12/16/21. - * 绗笁鏂瑰搧鐗屽垪琛� - */ -@Retention(SOURCE) -@IntDef({BrandType.All, BrandType.Hdl, BrandType.Tuya, BrandType.Megahealth, BrandType.All3tyBrand}) -public @interface BrandType { - int All = 0; - int Hdl = 1; - int Tuya = 2; - int Megahealth = 3; - int All3tyBrand = 99; -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/spk/SPK.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/spk/SPK.java deleted file mode 100644 index 2352f3c..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/device/spk/SPK.java +++ /dev/null @@ -1,353 +0,0 @@ -package com.hdl.linkpm.sdk.device.spk; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/16/21. - * LINK鍗忚鐨凷PK - */ -public class SPK { - - /** - * 1.security - */ - //鐚溂銆佽悿鐭� - public final static String SecurityEz = "security.peephole.ez"; - //闂ㄩ攣 - public final static String SecurityDoor = "security.door"; - /** - * 2.panel - */ - //闈㈡澘銆佹彃搴с�侀潰鏉� - public final static String PanelSocket = "panel.socket"; - //鍦烘櫙闈㈡澘 - - /** - * 3.鐏厜 - */ - // 锛堝紑鍏崇伅锛� - public final static String LightSwitch = "light.switch"; - // 锛堣皟鍏夌伅锛� - public final static String LightDimming = "light.dimming"; - // 锛圧GB鐏級 - public final static String LightRGB = "light.rgb"; - // 锛圕CT鐏級 - public final static String LightCCT = "light.cct"; - // 锛圧GBW鐏級 - public final static String LightRGBW = "light.rgbw"; - - // 鐏厜spk鍒楄〃 - public static List<String> LightSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(LightSwitch); - spkList.add(LightDimming); - spkList.add(LightRGB); - spkList.add(LightCCT); - spkList.add(LightRGBW); - return spkList; - } - - /** - * 4.sensor 浼犳劅鍣� - */ - //鐜浼犳劅鍣� - // 浜屾哀鍖栫⒊浼犳劅鍣� - public final static String SensorCO2 = "sensor.co2"; - // PM2.5浼犳劅鍣� - public final static String SensorPm25 = "sensor.pm25"; - // tvoc浼犳劅鍣� - public final static String SensorTVOC = "sensor.tvoc"; - // 娓╁害浼犳劅鍣� - public final static String SensorTemperature = "sensor.temperature"; - // 婀垮害浼犳劅鍣� - public final static String SensorHumidity = "sensor.humidity"; - // 鐜浼犳劅鍣� - // 鐜妫�娴嬩紶鎰熷櫒 - // 鐗规畩绫籹pk - // 璇pk鍔熻兘鏄幆澧冧紶鎰熷櫒鍔熻兘鐨勯泦鎴� - public final static String SensorEnvironment = "sensor.environment"; - // 闈掕悕鐜浼犳劅鍣� - public final static String SensorEnvironment2 = "sensor.environment2"; - // 闈掕悕鐜浼犳劅鍣� - public final static String SensorEnvironment3 = "sensor.environment3"; - //鐜浼犳劅鍣� 娴锋灄 - public final static String SensorEnvironmentHailin = "sensor.environment.hailin"; - // 鐢查啗 - public final static String SensorHcho = "sensor.hcho"; - //region 瀹夐槻浼犳劅鍣� - // 浜害浼犳劅鍣� - public final static String SensorLight = "sensor.light"; - // (绾㈠绉诲姩浼犳劅鍣�) - public final static String SensorPir = "sensor.pir"; - // 锛堥棬绐椾紶鎰熷櫒锛� - public final static String SensorDoorWindow = "sensor.doorwindow"; - // 鐑熼浘浼犳劅鍣� - public final static String SensorSmoke = "sensor.smoke"; - // 姘存蹈浼犳劅鍣� - public final static String SensorWater = "sensor.water"; - // 鐕冩皵浼犳劅鍣� - public final static String SensorGas = "sensor.gas"; - // 绾㈠鐝婃爮浼犳劅鍣� - public final static String SensorShanLan = "sensor.shanlan"; - // 绾㈠瀵瑰皠浼犳劅鍣� - public final static String SensorDuiShe = "sensor.duishe"; - // 瓒呭0娉紶鎰熷櫒 - public final static String SensorUtrasonic = "sensor.ultrasonic"; - // 锛堝共鎺ョ偣锛� - public final static String SensorDryContact = "sensor.dryContact"; - public final static String SensorDryContact2 = "dryContact.standard"; - // 姣背娉紶鎰熷櫒 - public final static String SenesorMegahealth = "sensor.megahealth"; - public final static String SenesorMegahealth2 = "sensor.megahealth.zg"; - - // 瀹夐槻浼犳劅鍣╯pk鍒楄〃 - public static List<String> ArmSensorSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(SensorPir); - spkList.add(SensorDoorWindow); - spkList.add(SensorSmoke); - spkList.add(SensorWater); - spkList.add(SensorGas); - spkList.add(SensorDryContact); - spkList.add(SensorDryContact2); - spkList.add(SenesorMegahealth); - spkList.add(SenesorMegahealth2); - return spkList; - } - - // 鐜浼犳劅鍣ㄨ澶噑pk鍒楄〃 - public static List<String> EnvironDeviceSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(SensorTemperature); - spkList.add(SensorPm25); - spkList.add(SensorCO2); - spkList.add(SensorTVOC); - spkList.add(SensorHumidity); - spkList.add(SensorEnvironment); - spkList.add(SensorEnvironment2); - spkList.add(SensorEnvironment3); - spkList.add(SensorHcho); - return spkList; - } - - // 鐜浼犳劅鍣╯pk鍒楄〃 - public static List<String> EnvironSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(SensorTemperature); - spkList.add(SensorPm25); - spkList.add(SensorCO2); - spkList.add(SensorTVOC); - spkList.add(SensorHumidity); - spkList.add(SensorHcho); - return spkList; - } - - // 鐜浼犳劅鍣ㄨ澶囧垪琛� - public static List<String> EvironmentSensorList() { - List<String> spkList = new ArrayList<>(); - spkList.add(SensorEnvironment); - spkList.add(SensorEnvironment2); - spkList.add(SensorEnvironment3); - return spkList; - } - - /** - * 5.绐楀笜 - */ - // 锛堝紑鍏崇獥甯橈級 - public final static String CurtainSwitch = "curtain.switch"; - // 锛堝紑鍚堝笜锛� - public final static String CurtainTrietex = "curtain.trietex"; - // 锛堢櫨鍙跺笜锛� - public final static String CurtainShades = "curtain.shades"; - // 锛堝嵎甯橈級 - public final static String CurtainRoller = "curtain.roller"; - - /** - * 绐楀笜spk鍒楄〃 - * - * @return - */ - public static List<String> CurtainSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(CurtainRoller); - spkList.add(CurtainSwitch); - spkList.add(CurtainShades); - spkList.add(CurtainTrietex); - return spkList; - } - - /** - * 6.HAVA - */ - // 绌鸿皟 - public final static String HvacAC = "hvac.ac"; - - // 绌鸿皟spk鍒楄〃 - public static List<String> AcSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(HvacAC); - return spkList; - } - - // 鍦版殩 - public final static String HvacFloorHeat = "hvac.floorHeat"; - - // 鍦扮儹spk鍒楄〃 - public static List<String> FhSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(HvacFloorHeat); - return spkList; - } - - // 鏂伴 - public final static String HvacAirFresh = "hvac.airFresh"; - // 鏂伴 鈥斺�旈噾鑼傚畾鍒� - public final static String HvacAirFreshJinmao = "hvac.airFresh.jinmao"; - - // 鏂伴spk鍒楄〃 - public static List<String> AirFreshSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(HvacAirFresh); - spkList.add(HvacAirFreshJinmao); - return spkList; - } - - /** - * 鑳芥簮 - */ - // 鑳芥簮妯″潡 - public final static String EnergyStandard = "energy.standard"; - // 鑳芥簮-鐢佃兘 - public final static String ElectricEnergy = "energy.electric"; - - // 鑳芥簮spk鍒楄〃 - public static List<String> EnergySpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(ElectricEnergy); - return spkList; - } - - - //region 闊充箰 - // 闊充箰 - public final static String AvMusic = "av.music"; - - // 闊充箰spk鍒楄〃 - public static List<String> MusicSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(AvMusic); - return spkList; - } - - //region 瀹剁數 - // 绾㈠銆佺數瑙� - public final static String TvIr = "ir.tv"; - // 绾㈠銆佸皬绫崇數瑙� - public final static String TvXmIr = "ir.tvxm"; - // 瀹剁數銆侀鎵� - public final static String HvacFan = "hvac.fan"; - // 鍑夐湼 - public final static String ClothesHanger = "electrical.racks"; - // 绾㈠閬ユ帶鍣� - public final static String IrLearn = "ir.learn"; - // 绾㈠鎶曞奖浠� - public final static String PjtIr = "ir.pjt"; - // 绾㈠鏈洪《鐩� - public final static String StbIr = "ir.stb"; - // 绾㈠褰辩鏈� - public final static String DvDIr = "ir.dvd"; - // 绾㈠绌烘皵鍑�鍖栧櫒 - public final static String PurifierIr = "ir.air_purifier"; - // 绾㈠鐑按鍣� - public final static String HeaterIr = " ir.water_heater"; - // 绾㈠椋庢墖 - public final static String FanIr = "ir.fan"; - // 鏅鸿兘绌哄紑 - // public final static String AirSwitch = "electrical.breaker"; - public final static String AirSwitch = "electrical.airSwitch"; - - //region 娑傞甫 - // 瀹剁數銆佹秱楦︾┖姘斿噣鍖栧櫒 - public final static String ElectricTuyaAirCleaner2 = "hvac.air.tuya_epi345"; - // 瀹剁數銆佹秱楦︾數椋庢墖 - public final static String ElectricTuyaFan2 = "hvac.fan.tuya_ef101"; - // 瀹剁數銆佹秱楦︽壂鍦版満鍣ㄤ汉 - public final static String ElectricTuyaWeepRobot2 = "electrical.sweep.tuya"; - // 瀹剁數銆佹秱楦︽按闃� - public final static String ElectricTuyaWaterValve2 = "electrical.watervalve.tuya_aw713"; - - - // 瀹剁數spk鍒楄〃 - public static List<String> ElectricalSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(PanelSocket); - spkList.add(TvIr); - spkList.add(TvXmIr); - spkList.add(HvacFan); - spkList.add(FanIr); - spkList.add(ClothesHanger); - spkList.add(IrLearn); - spkList.add(PjtIr); - spkList.add(StbIr); - spkList.add(ElectricTuyaAirCleaner2); - spkList.add(ElectricTuyaFan2); - spkList.add(ElectricTuyaWeepRobot2); - spkList.add(ElectricTuyaWaterValve2); - spkList.add(AirSwitch); - return spkList; - } - - //region 璁惧绫� - // 绾㈠瀹� - public final static String IrModule = "ir.module"; - - // 璁惧绫籹pk鍒楄〃 - public static List<String> DeviceSpkList() { - List<String> spkList = new ArrayList<>(); - spkList.add(IrModule); - return spkList; - } - - //region 绗笁鏂箂pk鍒楄〃 - // 鑾峰彇鎵�鏈夌涓夋柟鍝佺墝鍔熻兘鐨剆pk - public static List<String> GetAll3tySPK() { - List<String> spkList = new ArrayList<>(); - spkList.add(ElectricTuyaAirCleaner2); - spkList.add(ElectricTuyaFan2); - spkList.add(ElectricTuyaWaterValve2); - spkList.add(ElectricTuyaWeepRobot2); - spkList.add(SenesorMegahealth); - spkList.add(SenesorMegahealth2); - return spkList; - } - - // 鑾峰彇绗笁鏂硅澶噑pk - public static List<String> Get3tySpk(int brandType) { - List<String> list = new ArrayList<>(); - if (BrandType.Tuya == brandType) { - list.add(ElectricTuyaAirCleaner2); - list.add(ElectricTuyaFan2); - list.add(ElectricTuyaWaterValve2); - list.add(ElectricTuyaWeepRobot2); - } else if (BrandType.All3tyBrand == brandType) { - list.add(SenesorMegahealth);//鍏嗚 - } - return list; - } - - // 娌℃湁鐘舵�佹樉绀虹殑鍔熻兘spk鍒楄〃 - public static List<String> NotStatusSpkList() { - List<String> list = new ArrayList<>(); - list.add(FanIr); - list.add(TvIr); - list.add(TvXmIr); - list.add(StbIr); - list.add(PjtIr); - list.add(IrLearn); - return list; - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/HDLLinkPMHome.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/HDLLinkPMHome.java deleted file mode 100644 index 78c3b41..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/HDLLinkPMHome.java +++ /dev/null @@ -1,191 +0,0 @@ -package com.hdl.linkpm.sdk.home; - - -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.home.bean.GatewayBindBean; -import com.hdl.linkpm.sdk.home.bean.GatewayInfoBean; -import com.hdl.linkpm.sdk.home.bean.HomeInfoBean; -import com.hdl.linkpm.sdk.home.bean.RoomInfoBean; -import com.hdl.linkpm.sdk.home.bean.logic.LogicInfoBean; -import com.hdl.linkpm.sdk.home.bean.logic.SecurityInfoBean; -import com.hdl.linkpm.sdk.home.callback.IAddRoomListCallBack; -import com.hdl.linkpm.sdk.home.callback.IRoomListCallBack; -import com.hdl.linkpm.sdk.home.controller.HDLPMHomeController; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; - -/** - * Created by jlchen on 12/2/21. - */ -public class HDLLinkPMHome { - //instance - private volatile static HDLLinkPMHome instance; - - /** - * getInstance - * - * @return HDLLinkPMHome - */ - public static synchronized HDLLinkPMHome getInstance() { - if (instance == null) { - synchronized (HDLLinkPMHome.class) { - if (instance == null) { - instance = new HDLLinkPMHome(); - } - } - } - return instance; - } - - - /** - * house琛ㄧ殑鏁版嵁娌℃湁鍚屾鍒癶ome琛ㄣ�佹暟鎹瓨鍦ㄤ袱寮犺〃閲岄潰锛岄渶瑕佸鎴风璋冩帴鍙e悓姝� - * - * @param homeInfoBean 浣忓畢Info - * @param callBack - * @return - */ - public void synchHouseToHome(HomeInfoBean homeInfoBean, IDefaultCallBack callBack) { - HDLPMHomeController.getInstance().synchHouseToHome(homeInfoBean, callBack); - } - - /** - * 鑾峰彇浣忓畢涓嬫埧闂磋〃 - * - * @param homeId 浣忓畢ID - * @param roomType 鎴垮眿绫诲瀷 FLOOR ROOM銆佷负绌虹殑鏃跺�欐煡鍏ㄩ儴 - * @param pageNo 鍝竴椤� - * @param pageSize 椤甸潰澶у皬 - * @param callBack - * @return - */ - public void getRoomList(String homeId, String roomType, int pageNo, int pageSize, IRoomListCallBack callBack) { - HDLPMHomeController.getInstance().getRoomList(homeId, roomType, pageNo, pageSize, callBack); - } - - /** - * 鎴块棿鍒楄〃鍏ㄩ噺鏇存柊銆佹坊鍔犮�佺紪杈戙�佸垹闄ら兘鐢ㄨ鎺ュ彛 - * - * @param homeId 浣忓畢ID - * @param roomList 鏈�鏂扮殑鎴块棿鍒楄〃 - * @param callBack - * @return - */ - public void fullAddOrEditRoomList(String homeId, List<RoomInfoBean> roomList, IAddRoomListCallBack callBack) { - HDLPMHomeController.getInstance().fullAddOrEditRoomList(homeId, roomList, callBack); - } - - - /***************3.缃戝叧绠$悊***************/ - /** - * 缁戝畾缃戝叧鍒颁綇瀹� - * - * @param bean 缃戝叧淇℃伅 - * @param callBack - * @return - */ - public void bindGateway(GatewayBindBean bean, IResponseCallBack<GatewayInfoBean> callBack) { - HDLPMHomeController.getInstance().bindGateway(bean, callBack); - } - - /** - * 寮哄埗缁戝畾缃戝叧 - * 濡傛灉缁戝畾缃戝叧杩斿洖10510 宸茬粡琚粦瀹氫簡,鍒欒皟杩欎釜鎺ュ彛寮哄埗鎹㈢粦 - * - * @param homeId 浣忓畢ID - * @param mac 缃戝叧MAC - * @param callBack - * @return - */ - public void forceBindGateway(String homeId, String mac, IResponseCallBack<GatewayInfoBean> callBack) { - HDLPMHomeController.getInstance().forceBindGateway(homeId, mac, callBack); - } - - /** - * 瑙g粦缃戝叧 - * - * @param homeId 浣忓畢id - * @param gateWayId gatewayId - * @param callBack - * @return - */ - public void unbindGateway(String homeId, String gateWayId, IResponseCallBack<Boolean> callBack) { - HDLPMHomeController.getInstance().unbindGateway(homeId, gateWayId, callBack); - } - /** - * 瑙g粦浠庣綉鍏� - * - * @param homeId 浣忓畢id - * @param oid 璁惧oid - * @param callBack - * @return - */ - public void unbindFalseGateway(String homeId, String oid, IResponseCallBack<Boolean> callBack) { - HDLPMHomeController.getInstance().unbindFalseGateway(homeId, oid, callBack); - } - /** - * 缃戝叧缁戝畾浣忓畢淇℃伅 - * - * @param mac 缃戝叧mac - * @param callBack - * @return - */ - public void getGatewayHomeInfo(String mac,IResponseCallBack<GatewayInfoBean> callBack) { - HDLPMHomeController.getInstance().getGatewayHomeInfo(mac, callBack); - } - - /** - * 鑾峰彇缃戝叧鍒楄〃 - * - * @param homeId 浣忓畢id - * @param callBack - * @return - */ - public void getGatewayList(String homeId, IResponseCallBack<List<GatewayInfoBean>> callBack) { - HDLPMHomeController.getInstance().getGatewayList(homeId, callBack); - } - - /** - * 缃戝叧鏇挎崲 - * - * @param homeId 浣忓畢id - * @param gatewayId 鏃х綉鍏砳d - * @param newMac 鏂扮綉鍏砿ac - * @param callBack - * @return - */ - public void replaceGateway(String homeId, String gatewayId, String newMac, IDefaultCallBack callBack) { - HDLPMHomeController.getInstance().replaceGateway(homeId, gatewayId, newMac, callBack); - } - - /***************6.鑷姩鍖栧鍒犳敼鏌ョ鐞�***************/ - /** - * 鍏ㄩ噺鏇存柊鍚屾鑷姩鍖栥�佸瓨鍦ㄤ笉鍙�,涓嶅瓨鍦ㄦ柊澧� - * - * @param homeId 浣忓畢id - * @param logics 鑷姩鍖栧垪琛� - * @param callBack - * @return - */ - public void fullAddLogicList(String homeId, List<LogicInfoBean> logics, IDefaultCallBack callBack) { - HDLPMHomeController.getInstance().fullAddLogicList(homeId, logics, callBack); - } - - /***************7.瀹夐槻鍖栧鍒犳敼鏌ョ鐞�***************/ - /** - * 鍏ㄩ噺鏇存柊鍚屾瀹夐槻銆佸瓨鍦ㄤ笉鍙�,涓嶅瓨鍦ㄦ柊澧� - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧ID - * @param securitys 瀹夐槻鍒楄〃 - * @param callBack - * @return - */ - public void fullAddSecurityList(String homeId, String gatewayId, List<SecurityInfoBean> securitys, IDefaultCallBack callBack) { - HDLPMHomeController.getInstance().fullAddSecurityList(homeId, gatewayId, securitys, callBack); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/GatewayBindBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/GatewayBindBean.java deleted file mode 100644 index 462e6ca..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/GatewayBindBean.java +++ /dev/null @@ -1,124 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/10/21. - * 缁戝畾缃戝叧鎻愪氦鐨勫弬鏁板璞� - */ -public class GatewayBindBean implements Serializable { - - private String homeId; - private String mac; - private String gwFirmwareVersion; - private String gatewayName; - private String gatewayType; - private String encryptionType;//0.SM4(鍥藉瘑) 1.AES 2.NONE(涓嶅姞瀵�) (榛樿1) - //涓嬮潰鏄竴绔彛闇�瑕佹彁浜ょ殑鍙傛暟 - private String projectName; - private String userName; - private String subnetId; - private String deviceId; - private String groupName; - - @NonNull - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - public void setHomeId(@NonNull String homeId) { - this.homeId = homeId; - } - - @NonNull - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - - @NonNull - public String getGwFirmwareVersion() { - return gwFirmwareVersion == null ? "" : gwFirmwareVersion; - } - - public void setGwFirmwareVersion(@NonNull String gwFirmwareVersion) { - this.gwFirmwareVersion = gwFirmwareVersion; - } - - @NonNull - public String getGatewayName() { - return gatewayName == null ? "" : gatewayName; - } - - public void setGatewayName(@NonNull String gatewayName) { - this.gatewayName = gatewayName; - } - - @NonNull - public String getGatewayType() { - return gatewayType == null ? "" : gatewayType; - } - - public void setGatewayType(@NonNull String gatewayType) { - this.gatewayType = gatewayType; - } - - @NonNull - public String getEncryptionType() { - return encryptionType == null ? "" : encryptionType; - } - - public void setEncryptionType(@NonNull String encryptionType) { - this.encryptionType = encryptionType; - } - - @NonNull - public String getProjectName() { - return projectName == null ? "" : projectName; - } - - public void setProjectName(@NonNull String projectName) { - this.projectName = projectName; - } - - @NonNull - public String getUserName() { - return userName == null ? "" : userName; - } - - public void setUserName(@NonNull String userName) { - this.userName = userName; - } - - @NonNull - public String getSubnetId() { - return subnetId == null ? "" : subnetId; - } - - public void setSubnetId(@NonNull String subnetId) { - this.subnetId = subnetId; - } - - @NonNull - public String getDeviceId() { - return deviceId == null ? "" : deviceId; - } - - public void setDeviceId(@NonNull String deviceId) { - this.deviceId = deviceId; - } - - @NonNull - public String getGroupName() { - return groupName == null ? "" : groupName; - } - - public void setGroupName(@NonNull String groupName) { - this.groupName = groupName; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/GatewayInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/GatewayInfoBean.java deleted file mode 100644 index a9c4579..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/GatewayInfoBean.java +++ /dev/null @@ -1,283 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/10/21. - * 缃戝叧淇℃伅璇︽儏 - */ -public class GatewayInfoBean implements Serializable { - - private String gatewayId;//缃戝叧id - private String mac;//缃戝叧mac鍦板潃 - private String homeId;//浣忓畢id - private String primaryKey;//绉侀挜 - private String aesKey;//mqtt閫氫俊瀵嗛挜 - private String localSecret;//鏈湴瀵嗛挜 2021.7.5鏂板 - private String gatewayStatus;//缃戝叧鐘舵�� true false - private int encryptionType;//0.SM4 1.AES 2.涓嶅姞瀵� - private String gatewayName;//缃戝叧鍚嶇О - private String gatewayType;//BUSUDPGATEWAY銆丄GATEWAY銆乑IGBEEGATEWAY銆並NXGATEWAY - private String gwFirmwareVersion;//缃戝叧鍥轰欢鐗堟湰 - private String onlineLatestTime;// - private List<SlaveDevicesBean> slaveDevices = new ArrayList<>();//浠庤澶囦俊鎭� 2021.10.18 鏂板 - //涓嬮潰鍙傛暟涓�绔彛缃戝叧鐨勬椂鍊欐墠鏈� - private String userName;//鐢ㄦ埛鍚� - private String groupName;//缁勫悕 - private String projectName;//宸ョ▼鍚� - private String region;//鏈嶅姟鍖哄煙 - private int subnetId;//瀛愮綉鍙� - private int deviceId;//璁惧鍙� - // private String createPeople;// -// private String createTime;// -// private String modifyPeople;// -// private String modifyTime;// - - - @NonNull - public String getGatewayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGatewayId(@NonNull String gatewayId) { - this.gatewayId = gatewayId; - } - - @NonNull - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - - @NonNull - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - public void setHomeId(@NonNull String homeId) { - this.homeId = homeId; - } - - @NonNull - public String getPrimaryKey() { - return primaryKey == null ? "" : primaryKey; - } - - public void setPrimaryKey(@NonNull String primaryKey) { - this.primaryKey = primaryKey; - } - - @NonNull - public String getAesKey() { - return aesKey == null ? "" : aesKey; - } - - public void setAesKey(@NonNull String aesKey) { - this.aesKey = aesKey; - } - - @NonNull - public String getLocalSecret() { - return localSecret == null ? "" : localSecret; - } - - public void setLocalSecret(@NonNull String localSecret) { - this.localSecret = localSecret; - } - - @NonNull - public String getGatewayStatus() { - return gatewayStatus == null ? "" : gatewayStatus; - } - - public void setGatewayStatus(@NonNull String gatewayStatus) { - this.gatewayStatus = gatewayStatus; - } - - public int getEncryptionType() { - return encryptionType; - } - - public void setEncryptionType(int encryptionType) { - this.encryptionType = encryptionType; - } - - @NonNull - public String getGatewayName() { - return gatewayName == null ? "" : gatewayName; - } - - public void setGatewayName(@NonNull String gatewayName) { - this.gatewayName = gatewayName; - } - - @NonNull - public String getGatewayType() { - return gatewayType == null ? "" : gatewayType; - } - - public void setGatewayType(@NonNull String gatewayType) { - this.gatewayType = gatewayType; - } - - @NonNull - public String getGwFirmwareVersion() { - return gwFirmwareVersion == null ? "" : gwFirmwareVersion; - } - - public void setGwFirmwareVersion(@NonNull String gwFirmwareVersion) { - this.gwFirmwareVersion = gwFirmwareVersion; - } - - @NonNull - public String getOnlineLatestTime() { - return onlineLatestTime == null ? "" : onlineLatestTime; - } - - public void setOnlineLatestTime(@NonNull String onlineLatestTime) { - this.onlineLatestTime = onlineLatestTime; - } - - @NonNull - public List<SlaveDevicesBean> getSlaveDevices() { - if (slaveDevices == null) { - return new ArrayList<>(); - } - return slaveDevices; - } - - public void setSlaveDevices(@NonNull List<SlaveDevicesBean> slaveDevices) { - this.slaveDevices = slaveDevices; - } - - @NonNull - public String getUserName() { - return userName == null ? "" : userName; - } - - public void setUserName(@NonNull String userName) { - this.userName = userName; - } - - @NonNull - public String getGroupName() { - return groupName == null ? "" : groupName; - } - - public void setGroupName(@NonNull String groupName) { - this.groupName = groupName; - } - - @NonNull - public String getProjectName() { - return projectName == null ? "" : projectName; - } - - public void setProjectName(@NonNull String projectName) { - this.projectName = projectName; - } - - @NonNull - public String getRegion() { - return region == null ? "" : region; - } - - public void setRegion(@NonNull String region) { - this.region = region; - } - - public int getSubnetId() { - return subnetId; - } - - public void setSubnetId(int subnetId) { - this.subnetId = subnetId; - } - - public int getDeviceId() { - return deviceId; - } - - public void setDeviceId(int deviceId) { - this.deviceId = deviceId; - } - - public static class SlaveDevicesBean implements Serializable { - private String protocolType; - private int deviceType; - private String device_name; - private String oid; - private String addresses; - private String deviceModel; - private String mac; - - @NonNull - public String getProtocolType() { - return protocolType == null ? "" : protocolType; - } - - public void setProtocolType(@NonNull String protocolType) { - this.protocolType = protocolType; - } - - public int getDeviceType() { - return deviceType; - } - - public void setDeviceType(int deviceType) { - this.deviceType = deviceType; - } - - @NonNull - public String getDevice_name() { - return device_name == null ? "" : device_name; - } - - public void setDevice_name(@NonNull String device_name) { - this.device_name = device_name; - } - - @NonNull - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(@NonNull String oid) { - this.oid = oid; - } - - @NonNull - public String getAddresses() { - return addresses == null ? "" : addresses; - } - - public void setAddresses(@NonNull String addresses) { - this.addresses = addresses; - } - - @NonNull - public String getDeviceModel() { - return deviceModel == null ? "" : deviceModel; - } - - public void setDeviceModel(@NonNull String deviceModel) { - this.deviceModel = deviceModel; - } - - @NonNull - public String getMac() { - return mac == null ? "" : mac; - } - - public void setMac(@NonNull String mac) { - this.mac = mac; - } - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/HomeInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/HomeInfoBean.java deleted file mode 100644 index 9a575a6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/HomeInfoBean.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/10/21. - */ -public class HomeInfoBean implements Serializable { - - private String homeId; - private String homeName; - private String homeType; - private String homeAddress; - private String latitude; - private String longitude; - - public HomeInfoBean() { - - } - - public HomeInfoBean(String homeId, String homeName, String homeType) { - this.homeId = homeId; - this.homeName = homeName; - this.homeType = homeType; - } - - @NonNull - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - public void setHomeId(@NonNull String homeId) { - this.homeId = homeId; - } - - @NonNull - public String getHomeName() { - return homeName == null ? "" : homeName; - } - - public void setHomeName(@NonNull String homeName) { - this.homeName = homeName; - } - - @NonNull - public String getHomeType() { - return homeType == null ? "" : homeType; - } - - public void setHomeType(@NonNull String homeType) { - this.homeType = homeType; - } - - @NonNull - public String getHomeAddress() { - return homeAddress == null ? "" : homeAddress; - } - - public void setHomeAddress(@NonNull String homeAddress) { - this.homeAddress = homeAddress; - } - - @NonNull - public String getLatitude() { - return latitude == null ? "" : latitude; - } - - public void setLatitude(@NonNull String latitude) { - this.latitude = latitude; - } - - @NonNull - public String getLongitude() { - return longitude == null ? "" : longitude; - } - - public void setLongitude(@NonNull String longitude) { - this.longitude = longitude; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/QuestionInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/QuestionInfo.java deleted file mode 100644 index 16d60e0..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/QuestionInfo.java +++ /dev/null @@ -1,145 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/6/8 - * description: - */ -public class QuestionInfo implements Serializable { - /** - * 瑙g瓟鍐呭 - */ - private String answerContent; - /** - * 鍐呭鍒嗙被 0锛氳秴鏂囨湰 1锛氳棰�,鍙敤鍊�:HYPERTEXT,VIDEO - */ - private String contentType; - /** - * 鍐呭鍒嗙被鍚嶇О - */ - private String coverUrl; - /** - * 灏侀潰鍦板潃 - */ - private String questionDesc; - /** - * 鎻忚堪 - */ - private String languageType; - private String modifyTime; - /** - * 闂鏍囬 - */ - private String question; - private String sort; - private String contentTypeName; - private String languageTypeName; - /** - * 甯姪涓績id - */ - private String supportCenterId; - /** - * 瑙嗛鍦板潃 - */ - private String videoUrl; - - public String getAnswerContent() { - return answerContent == null ? "" : answerContent; - } - - public void setAnswerContent(@NonNull String answerContent) { - this.answerContent = answerContent; - } - - public String getContentType() { - return contentType == null ? "" : contentType; - } - - public void setContentType(@NonNull String contentType) { - this.contentType = contentType; - } - - public String getCoverUrl() { - return coverUrl == null ? "" : coverUrl; - } - - public void setCoverUrl(@NonNull String coverUrl) { - this.coverUrl = coverUrl; - } - - public String getQuestionDesc() { - return questionDesc == null ? "" : questionDesc; - } - - public void setQuestionDesc(@NonNull String questionDesc) { - this.questionDesc = questionDesc; - } - - public String getLanguageType() { - return languageType == null ? "" : languageType; - } - - public void setLanguageType(@NonNull String languageType) { - this.languageType = languageType; - } - - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } - - public void setModifyTime(@NonNull String modifyTime) { - this.modifyTime = modifyTime; - } - - public String getQuestion() { - return question == null ? "" : question; - } - - public void setQuestion(@NonNull String question) { - this.question = question; - } - - public String getSort() { - return sort == null ? "" : sort; - } - - public void setSort(@NonNull String sort) { - this.sort = sort; - } - - public String getContentTypeName() { - return contentTypeName == null ? "" : contentTypeName; - } - - public void setContentTypeName(@NonNull String contentTypeName) { - this.contentTypeName = contentTypeName; - } - - public String getLanguageTypeName() { - return languageTypeName == null ? "" : languageTypeName; - } - - public void setLanguageTypeName(@NonNull String languageTypeName) { - this.languageTypeName = languageTypeName; - } - - public String getSupportCenterId() { - return supportCenterId == null ? "" : supportCenterId; - } - - public void setSupportCenterId(@NonNull String supportCenterId) { - this.supportCenterId = supportCenterId; - } - - public String getVideoUrl() { - return videoUrl == null ? "" : videoUrl; - } - - public void setVideoUrl(@NonNull String videoUrl) { - this.videoUrl = videoUrl; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/QuestionListInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/QuestionListInfo.java deleted file mode 100644 index f348159..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/QuestionListInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/6/8 - * description: - */ -public class QuestionListInfo implements Serializable { - private List<QuestionInfo> list = new ArrayList<>(); - private String pageNo; - private String pageSize; - private String totalCount; - private String totalPage; - - public List<QuestionInfo> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<QuestionInfo> list) { - this.list = list; - } - - public String getPageNo() { - return pageNo == null ? "" : pageNo; - } - - public void setPageNo(@NonNull String pageNo) { - this.pageNo = pageNo; - } - - public String getPageSize() { - return pageSize == null ? "" : pageSize; - } - - public void setPageSize(@NonNull String pageSize) { - this.pageSize = pageSize; - } - - public String getTotalCount() { - return totalCount == null ? "" : totalCount; - } - - public void setTotalCount(@NonNull String totalCount) { - this.totalCount = totalCount; - } - - public String getTotalPage() { - return totalPage == null ? "" : totalPage; - } - - public void setTotalPage(@NonNull String totalPage) { - this.totalPage = totalPage; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/RoomInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/RoomInfoBean.java deleted file mode 100644 index 4f1976a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/RoomInfoBean.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean; - -import androidx.annotation.NonNull; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/10/21. - */ -public class RoomInfoBean implements Serializable { - private String uid;//璋冭瘯杞欢鐢熸垚鐨勫敮涓�Id - private String roomType;//鎴块棿绫诲瀷 FLOOR ROOM - //娣诲姞鎴栬�呬慨鏀规埧闂寸殑鏃跺�欙紝涓嬪垪鍙傛暟鍏佽淇敼 - private String roomName;//鎴块棿鍚嶇О - private String roomImage;//鎴块棿鍥剧墖杩滅▼鎴栬�呮湰鍦拌矾寰勫湴鍧� - private String parentId;//鐖惰妭鐐笽d锛屾埧闂村垎閰嶇殑妤煎眰鐨処D - //涓嬮潰鍙傛暟浜戠鍥哄畾杩斿洖鐨勶紝涓嶈兘淇敼鐨� - private String roomId;//娣诲姞鍒颁簯绔墠浼氱敓鎴� - private String homeId;//浣忓畢id - private String floorRoomName;//鎴垮眿鍏ㄧ▼ 渚嬶細2妤�-娆″崸 - - @NonNull - public String getUid() { - return uid == null ? "" : uid; - } - - public void setUid(@NonNull String uid) { - this.uid = uid; - } - - @NonNull - public String getRoomType() { - return roomType == null ? "" : roomType; - } - - public void setRoomType(@NonNull String roomType) { - this.roomType = roomType; - } - - @NonNull - public String getRoomName() { - return roomName == null ? "" : roomName; - } - - public void setRoomName(@NonNull String roomName) { - this.roomName = roomName; - } - - @NonNull - public String getRoomImage() { - return roomImage == null ? "" : roomImage; - } - - public void setRoomImage(@NonNull String roomImage) { - this.roomImage = roomImage; - } - - @NonNull - public String getParentId() { - return parentId == null ? "" : parentId; - } - - public void setParentId(@NonNull String parentId) { - this.parentId = parentId; - } - - @NonNull - public String getRoomId() { - return roomId == null ? "" : roomId; - } - - public void setRoomId(@NonNull String roomId) { - this.roomId = roomId; - } - - @NonNull - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - public void setHomeId(@NonNull String homeId) { - this.homeId = homeId; - } - - @NonNull - public String getFloorRoomName() { - return floorRoomName == null ? "" : floorRoomName; - } - - public void setFloorRoomName(@NonNull String floorRoomName) { - this.floorRoomName = floorRoomName; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/RoomInfoListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/RoomInfoListBean.java deleted file mode 100644 index 9feaed0..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/RoomInfoListBean.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.core.bean.BasePageInfoBean; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/10/21. - * 椤圭洰鍒楄〃瀵硅薄 - */ -public class RoomInfoListBean extends BasePageInfoBean { - - private List<RoomInfoBean> list = new ArrayList<>(); - - @NonNull - public List<RoomInfoBean> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<RoomInfoBean> list) { - this.list = list; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/ConditionBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/ConditionBean.java deleted file mode 100644 index 6fc9b37..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/ConditionBean.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean.logic; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/14/21. - * 鏉′欢 - */ -public class ConditionBean implements Serializable { - - private String key;//灞炴�у悕绉� - private String comparator;//鎿嶄綔 < 灏忎簬 > 澶т簬 ==绛変簬 - private String data_type;//鍊肩被鍨� int \float\ string - private String value;//鍊� - - @NonNull - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(@NonNull String key) { - this.key = key; - } - - @NonNull - public String getComparator() { - return comparator == null ? "" : comparator; - } - - public void setComparator(@NonNull String comparator) { - this.comparator = comparator; - } - - @NonNull - public String getData_type() { - return data_type == null ? "" : data_type; - } - - public void setData_type(@NonNull String data_type) { - this.data_type = data_type; - } - - @NonNull - public String getValue() { - return value == null ? "" : value; - } - - public void setValue(@NonNull String value) { - this.value = value; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/LogicInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/LogicInfoBean.java deleted file mode 100644 index f03d6e1..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/LogicInfoBean.java +++ /dev/null @@ -1,203 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean.logic; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/10/21. - * 鑷姩鍖� 璇︽儏瀵硅薄 - */ -public class LogicInfoBean implements Serializable { - - private String sid;//鑷姩鍖杋d - private String gatewayId;//缃戝叧ID - private String name;//鑷姩鍖栧悕瀛� - private List<String> conditionLabel = new ArrayList<>();//瑙﹀彂鏉′欢鏍囩 1:鏃堕棿鐐规潯浠� 2:鏃堕棿娈�+寰幆鏂瑰紡 3:璁惧鐘舵�� - private String tag;//鈥� tag 鏍囩 - private String push_customer_message;//娑堟伅鎺ㄩ�佸唴瀹� - private String relation;//鍏崇郴 and/or - private String enable;//true:鍚敤(榛樿) false:绂佺敤 - private CycleBean cycle;//寰幆鏃堕棿 - private List<InputBean> input = new ArrayList<>();//瑙﹀彂鏉′欢 - private List<OutputBean> output = new ArrayList<>();//鎵ц鍔ㄤ綔 - private String output_delay;//杈撳嚭寤舵椂 - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public String getGatewayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGatewayId(@NonNull String gatewayId) { - this.gatewayId = gatewayId; - } - - @NonNull - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - @NonNull - public List<String> getConditionLabel() { - if (conditionLabel == null) { - return new ArrayList<>(); - } - return conditionLabel; - } - - public void setConditionLabel(@NonNull List<String> conditionLabel) { - this.conditionLabel = conditionLabel; - } - - @NonNull - public String getTag() { - return tag == null ? "" : tag; - } - - public void setTag(@NonNull String tag) { - this.tag = tag; - } - - @NonNull - public String getPush_customer_message() { - return push_customer_message == null ? "" : push_customer_message; - } - - public void setPush_customer_message(@NonNull String push_customer_message) { - this.push_customer_message = push_customer_message; - } - - @NonNull - public String getRelation() { - return relation == null ? "" : relation; - } - - public void setRelation(@NonNull String relation) { - this.relation = relation; - } - - @NonNull - public String getEnable() { - return enable == null ? "" : enable; - } - - public void setEnable(@NonNull String enable) { - this.enable = enable; - } - - public CycleBean getCycle() { - return cycle; - } - - public void setCycle(CycleBean cycle) { - this.cycle = cycle; - } - - @NonNull - public List<InputBean> getInput() { - if (input == null) { - return new ArrayList<>(); - } - return input; - } - - public void setInput(@NonNull List<InputBean> input) { - this.input = input; - } - - @NonNull - public List<OutputBean> getOutput() { - if (output == null) { - return new ArrayList<>(); - } - return output; - } - - public void setOutput(@NonNull List<OutputBean> output) { - this.output = output; - } - - @NonNull - public String getOutput_delay() { - return output_delay == null ? "" : output_delay; - } - - public void setOutput_delay(@NonNull String output_delay) { - this.output_delay = output_delay; - } - - /** - * 寰幆鏃堕棿 - */ - public static class CycleBean implements Serializable{ - private String type;//鏃堕棿绫诲瀷 - private List<String> value;//鍊� - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List<String> getValue() { - return value; - } - - public void setValue(List<String> value) { - this.value = value; - } - } - - /** - * 瑙﹀彂鏉′欢 - */ - public static class InputBean implements Serializable{ - private String sid;//璁惧sid 浠呭湪condition_type:3 璁惧瑙﹀彂蹇呭~ - private String condition_type;//1:鏃堕棿鐐规潯浠� 2:鏃堕棿娈�+寰幆鏂瑰紡 3:璁惧鐘舵�� - private List<ConditionBean> condition;//鏉′欢 - - public String getSid() { - return sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getCondition_type() { - return condition_type; - } - - public void setCondition_type(String condition_type) { - this.condition_type = condition_type; - } - - public List<ConditionBean> getCondition() { - return condition; - } - - public void setCondition(List<ConditionBean> condition) { - this.condition = condition; - } - - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/OutputBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/OutputBean.java deleted file mode 100644 index f0957a7..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/OutputBean.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean.logic; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.device.bean.StatusBean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/14/21. - * 鎵ц鍔ㄤ綔 - */ -public class OutputBean implements Serializable { - - private String target_type;//鎺у埗鐩爣绫诲瀷 璁惧锛�0锛屽満鏅�1锛岃嚜鍔ㄥ寲2 - private String sid;//璁惧鎴栧満鏅痠d - private List<StatusBean> status = new ArrayList<>();//鐘舵�� - - @NonNull - public String getTarget_type() { - return target_type == null ? "" : target_type; - } - - public void setTarget_type(@NonNull String target_type) { - this.target_type = target_type; - } - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public List<StatusBean> getStatus() { - if (status == null) { - return new ArrayList<>(); - } - return status; - } - - public void setStatus(@NonNull List<StatusBean> status) { - this.status = status; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/SecurityInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/SecurityInfoBean.java deleted file mode 100644 index 20aac71..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/bean/logic/SecurityInfoBean.java +++ /dev/null @@ -1,177 +0,0 @@ -package com.hdl.linkpm.sdk.home.bean.logic; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/10/21. - * 瀹夐槻 璇︽儏瀵硅薄 - */ -public class SecurityInfoBean implements Serializable { - - private String sid;//瀹夐槻id - private String name;//瀹夐槻鍚嶇О - private String delay;//寤舵椂(姣) - private String status;//鐘舵�� enable甯冮槻銆乨isable鎾掗槻 - private String type;//绫诲瀷 "all"--鍏ㄥ畢甯冮槻锛�"normal"--鏅�氭ā寮�,"all_day":24灏忔椂,"mute"锛氶潤闊� - private List<InPutBean> input = new ArrayList<>();//杈撳叆鏉′欢 浼犳劅鍣� - private List<OutputBean> output = new ArrayList<>();//鎺у埗鐩爣 -// private NoticeConfigBean noticeConfig;//閫氱煡閰嶇疆 -// private List<PushConfigsBean> pushConfigs;//鎺ㄩ�侀厤缃� - - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - @NonNull - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - @NonNull - public String getStatus() { - return status == null ? "" : status; - } - - public void setStatus(@NonNull String status) { - this.status = status; - } - - @NonNull - public String getType() { - return type == null ? "" : type; - } - - public void setType(@NonNull String type) { - this.type = type; - } - - @NonNull - public List<InPutBean> getInput() { - if (input == null) { - return new ArrayList<>(); - } - return input; - } - - public void setInput(@NonNull List<InPutBean> input) { - this.input = input; - } - - @NonNull - public List<OutputBean> getOutput() { - if (output == null) { - return new ArrayList<>(); - } - return output; - } - - public void setOutput(@NonNull List<OutputBean> output) { - this.output = output; - } - - /** - * 瑙﹀彂鏉′欢 - */ - public static class InPutBean implements Serializable{ - private String sid;////璁惧sid 浠呭湪condition_type:3 璁惧瑙﹀彂蹇呭~ - private String bypass;//#Bypass璁剧疆 true:鍚敤涓�乫alse:涓存椂bypass涓� - private List<ConditionBean> condition;//鏉′欢 - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public String getBypass() { - return bypass == null ? "" : bypass; - } - - public void setBypass(@NonNull String bypass) { - this.bypass = bypass; - } - - @NonNull - public List<ConditionBean> getCondition() { - if (condition == null) { - return new ArrayList<>(); - } - return condition; - } - - public void setCondition(@NonNull List<ConditionBean> condition) { - this.condition = condition; - } - } - - - -// public static class NoticeConfigBean implements Serializable{ -// private boolean enable; -// private String noticeContent; -// -// public boolean isEnable() { -// return enable; -// } -// -// public void setEnable(boolean enable) { -// this.enable = enable; -// } -// -// public String getNoticeContent() { -// return noticeContent; -// } -// -// public void setNoticeContent(String noticeContent) { -// this.noticeContent = noticeContent; -// } -// } - -// public static class PushConfigsBean implements Serializable{ -// private String pushMethod; -// private List<String> pushTarget; -// -// public String getPushMethod() { -// return pushMethod; -// } -// -// public void setPushMethod(String pushMethod) { -// this.pushMethod = pushMethod; -// } -// -// public List<String> getPushTarget() { -// return pushTarget; -// } -// -// public void setPushTarget(List<String> pushTarget) { -// this.pushTarget = pushTarget; -// } -// } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/callback/IAddRoomListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/callback/IAddRoomListCallBack.java deleted file mode 100644 index 0ecb2c7..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/callback/IAddRoomListCallBack.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hdl.linkpm.sdk.home.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.home.bean.RoomInfoBean; - -import java.util.List; - -/** - * Created by jlchen on 12/10/21. - */ -public interface IAddRoomListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(Boolean bean); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/callback/IRoomListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/callback/IRoomListCallBack.java deleted file mode 100644 index d509585..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/callback/IRoomListCallBack.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hdl.linkpm.sdk.home.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.home.bean.RoomInfoListBean; - -/** - * Created by jlchen on 12/10/21. - */ -public interface IRoomListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(RoomInfoListBean bean); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/controller/HDLPMHomeController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/controller/HDLPMHomeController.java deleted file mode 100644 index 153959e..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/controller/HDLPMHomeController.java +++ /dev/null @@ -1,493 +0,0 @@ -package com.hdl.linkpm.sdk.home.controller; - -import android.text.TextUtils; - -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.core.api.HDLCloudHomeApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.home.bean.GatewayInfoBean; -import com.hdl.linkpm.sdk.home.bean.GatewayBindBean; -import com.hdl.linkpm.sdk.home.bean.HomeInfoBean; -import com.hdl.linkpm.sdk.home.bean.logic.LogicInfoBean; -import com.hdl.linkpm.sdk.home.bean.RoomInfoBean; -import com.hdl.linkpm.sdk.home.bean.RoomInfoListBean; -import com.hdl.linkpm.sdk.home.bean.logic.SecurityInfoBean; -import com.hdl.linkpm.sdk.home.callback.IAddRoomListCallBack; -import com.hdl.linkpm.sdk.home.callback.IRoomListCallBack; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; - -/** - * Created by jlchen on 12/3/21. - * 浣忓畢鐩稿叧鐨勭綉缁滆姹� - */ -public class HDLPMHomeController { - /** - * instance - */ - private volatile static HDLPMHomeController instance; - - /** - * getInstance - * - * @return HDLHomeController - */ - public static synchronized HDLPMHomeController getInstance() { - if (instance == null) { - synchronized (HDLPMHomeController.class) { - if (instance == null) { - instance = new HDLPMHomeController(); - } - } - } - return instance; - } - - /** - * house琛ㄧ殑鏁版嵁娌℃湁鍚屾鍒癶ome琛ㄣ�佹暟鎹瓨鍦ㄤ袱寮犺〃閲岄潰锛岄渶瑕佸鎴风璋冩帴鍙e悓姝� - * - * @param homeInfoBean 浣忓畢Info - * @param callBack - * @return - */ - public Disposable synchHouseToHome(HomeInfoBean homeInfoBean, IDefaultCallBack callBack) { - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_PROGRAM_HOME_ADD); - return HxHttp.builder() - .url(requestUrl) - .raw(HDLGsonUtils.toJson(homeInfoBean)) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,homeInfoBean,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /***************2.鎴块棿绠$悊***************/ - /** - * 鑾峰彇浣忓畢涓嬫埧闂磋〃 - * - * @param homeId 浣忓畢ID - * @param roomType 鎴垮眿绫诲瀷 FLOOR ROOM銆佷负绌虹殑鏃跺�欐煡鍏ㄩ儴 - * @param pageNo 鍝竴椤� - * @param pageSize 椤甸潰澶у皬 - * @param callBack - * @return - */ - public Disposable getRoomList(String homeId, String roomType, int pageNo, int pageSize, IRoomListCallBack callBack) { - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_ROOM_GET_LIST); - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - if (!TextUtils.isEmpty(roomType)) { - json.addProperty("roomType", roomType); - } - json.addProperty("pageNo", pageNo); - json.addProperty("pageSize", pageSize); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<RoomInfoListBean>() { - @Override - public void onResponse(RoomInfoListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鎴块棿鍒楄〃鍏ㄩ噺鏇存柊銆佹坊鍔犮�佺紪杈戙�佸垹闄ら兘鐢ㄨ鎺ュ彛 - * - * @param homeId 浣忓畢ID - * @param roomList 鏈�鏂扮殑鎴块棿鍒楄〃 - * @param callBack - * @return - */ - public Disposable fullAddOrEditRoomList(String homeId, List<RoomInfoBean> roomList, IAddRoomListCallBack callBack) { - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_ROOM_FULL_ADD_OR_EDIT); - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("rooms", HDLGsonUtils.toJsonArray(roomList)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<Boolean>() { - @Override - public void onResponse(Boolean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /***************3.缃戝叧绠$悊***************/ - /** - * 缁戝畾缃戝叧鍒颁綇瀹� - * - * @param bean 缃戝叧淇℃伅 - * @param callBack - * @return - */ - public Disposable bindGateway(GatewayBindBean bean, IResponseCallBack<GatewayInfoBean> callBack) { - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_GATEWAY_BIND); - return HxHttp.builder() - .url(requestUrl) - .raw(HDLGsonUtils.toJson(bean)) - .build() - .post() - .subscribeWith(new HDLResponse<GatewayInfoBean>() { - @Override - public void onResponse(GatewayInfoBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,bean,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 寮哄埗缁戝畾缃戝叧 - * 濡傛灉缁戝畾缃戝叧杩斿洖10510 宸茬粡琚粦瀹氫簡,鍒欒皟杩欎釜鎺ュ彛寮哄埗鎹㈢粦 - * - * @param homeId 浣忓畢ID - * @param mac 缃戝叧MAC - * @param callBack - * @return - */ - public Disposable forceBindGateway(String homeId, String mac, IResponseCallBack<GatewayInfoBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("mac", mac); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_GATEWAY_FORCE_BIND); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<GatewayInfoBean>() { - @Override - public void onResponse(GatewayInfoBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 瑙g粦缃戝叧 - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧gatewayId - * @param callBack - * @return - */ - public Disposable unbindGateway(String homeId, String gatewayId, IResponseCallBack<Boolean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_GATEWAY_UNBIND); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<Boolean>() { - @Override - public void onResponse(Boolean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 瑙g粦缃戝叧 - * - * @param mac 缃戝叧mac鍦板潃 - * @param callBack - * @return - */ - public Disposable getGatewayHomeInfo(String mac, IResponseCallBack<GatewayInfoBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("mac", mac); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_GATEWAY_HOMEINFO); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<GatewayInfoBean>() { - @Override - public void onResponse(GatewayInfoBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - /** - * 瑙g粦浠庣綉鍏� - * - * @param homeId 浣忓畢id - * @param oid 璁惧oid - * @param callBack - * @return - */ - public Disposable unbindFalseGateway(String homeId, String oid,IResponseCallBack<Boolean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("oid", oid); - - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_DEVICE_OID_REMOVE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<Boolean>() { - @Override - public void onResponse(Boolean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - /** - * 鑾峰彇缃戝叧鍒楄〃 - * - * @param homeId 浣忓畢id - * @param callBack - * @return - */ - public Disposable getGatewayList(String homeId, IResponseCallBack<List<GatewayInfoBean>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_GATEWAY_GET_LIST); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<GatewayInfoBean>>() { - @Override - public void onResponse(List<GatewayInfoBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 缃戝叧鏇挎崲 - * - * @param homeId 浣忓畢id - * @param gatewayId 鏃х綉鍏砳d - * @param newMac 鏂扮綉鍏砿ac - * @param callBack - * @return - */ - public Disposable replaceGateway(String homeId, String gatewayId, String newMac, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.addProperty("newMac", newMac); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_GATEWAY_REPLACE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<String>>() { - @Override - public void onResponse(List<String> response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /***************6.鑷姩鍖栧鍒犳敼鏌ョ鐞�***************/ - /** - * 鍏ㄩ噺鏇存柊鍚屾鑷姩鍖栥�佸瓨鍦ㄤ笉鍙�,涓嶅瓨鍦ㄦ柊澧� - * - * @param homeId 浣忓畢id - * @param logics 鑷姩鍖栧垪琛� - * @param callBack - * @return - */ - public Disposable fullAddLogicList(String homeId, List<LogicInfoBean> logics, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("logics", HDLGsonUtils.toJsonArray(logics)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_LOGIC_FULL_SYNC); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /***************7.瀹夐槻鍖栧鍒犳敼鏌ョ鐞�***************/ - /** - * 鍏ㄩ噺鏇存柊鍚屾瀹夐槻銆佸瓨鍦ㄤ笉鍙�,涓嶅瓨鍦ㄦ柊澧� - * - * @param homeId 浣忓畢id - * @param gatewayId 缃戝叧ID - * @param securitys 瀹夐槻鍒楄〃 - * @param callBack - * @return - */ - public Disposable fullAddSecurityList(String homeId, String gatewayId, List<SecurityInfoBean> securitys, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.add("securitys", HDLGsonUtils.toJsonArray(securitys)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_SECURITY_FULL_SYNC); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl,json,e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/GatewayType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/GatewayType.java deleted file mode 100644 index a4656e7..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/GatewayType.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.hdl.linkpm.sdk.home.type; - -import androidx.annotation.StringDef; -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -/** - * Created by jlchen on 12/10/21. - * 缃戝叧绫诲瀷 - */ -@Retention(SOURCE) -@StringDef({GatewayType.BUSUDPGATEWAY, GatewayType.AGATEWAY, GatewayType.ZIGBEEGATEWAY, GatewayType.KNXGATEWAY}) -public @interface GatewayType { - - String BUSUDPGATEWAY = "BUSUDPGATEWAY"; - - String AGATEWAY = "AGATEWAY"; - - String ZIGBEEGATEWAY = "ZIGBEEGATEWAY"; - - String KNXGATEWAY = "KNXGATEWAY"; - -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/HomeType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/HomeType.java deleted file mode 100644 index d370c4a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/HomeType.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hdl.linkpm.sdk.home.type; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -/** - * Created by jlchen on 12/10/21. - * 浣忓畢绫诲瀷 ZIGBEE銆丅USPRO銆丄 - */ -@Retention(SOURCE) -@StringDef({HomeType.ZIGBEE, HomeType.BUSPRO, HomeType.A}) -public @interface HomeType { - //0锛歓IGBEE - String ZIGBEE = "ZIGBEE"; - //1锛欱USPRO - String BUSPRO = "BUSPRO"; - //2锛欰 - String A = "A"; -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/RoomType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/RoomType.java deleted file mode 100644 index 02fa1a7..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/home/type/RoomType.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hdl.linkpm.sdk.home.type; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -/** - * Created by jlchen on 12/10/21. - * 鎴块棿绫诲瀷锛氭ゼ灞傘�佹埧闂� - */ -@Retention(SOURCE) -@StringDef({RoomType.FLOOR, RoomType.ROOM}) -public @interface RoomType { - //0锛氭ゼ灞� - String FLOOR = "FLOOR"; - //1锛氭埧闂� - String ROOM = "ROOM"; -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/HDLLinkPMOta.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/HDLLinkPMOta.java deleted file mode 100644 index d104d85..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/HDLLinkPMOta.java +++ /dev/null @@ -1,176 +0,0 @@ -package com.hdl.linkpm.sdk.ota; - -import com.google.gson.JsonObject; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.ota.bean.CloudDeviceFirmwaresBean; -import com.hdl.linkpm.sdk.ota.bean.CloudGatewayDriversBean; -import com.hdl.linkpm.sdk.ota.bean.DeviceFirmwareBean; -import com.hdl.linkpm.sdk.ota.bean.DownloadUrlBean; -import com.hdl.linkpm.sdk.ota.bean.FirmwareBean; -import com.hdl.linkpm.sdk.ota.bean.GatewayDriverBean; -import com.hdl.linkpm.sdk.ota.controller.HDLPMOtaController; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; -import okhttp3.ResponseBody; - - -/** - * Created by jlchen on 12/17/21. - * OTA 缃戝叧銆佽澶囧浐浠舵煡璇㈠拰涓嬭浇鐩稿叧绠$悊 - */ -public class HDLLinkPMOta { - - //instance - private volatile static HDLLinkPMOta instance; - - /** - * getInstance - * - * @return HDLLinkPMOta - */ - public static synchronized HDLLinkPMOta getInstance() { - if (instance == null) { - synchronized (HDLLinkPMOta.class) { - if (instance == null) { - instance = new HDLLinkPMOta(); - } - } - } - return instance; - } - - /** - * 鍘熺敓璁惧鑾峰彇鍥轰欢鍗囩骇鍖呬笅杞藉湴鍧� - * - * @param firmwareVersionId 鍥轰欢鐗堟湰Id - * @return - */ - public void getNativeDeviceFirmwareDownloadUrl(String firmwareVersionId, IResponseCallBack<DownloadUrlBean> callBack) { - HDLPMOtaController.getInstance().getNativeDeviceFirmwareDownloadUrl(firmwareVersionId, callBack); - } - - /** - * Link璁惧椹卞姩鍒楄〃鑾峰彇 - * - * @param homeId 浣忓畢id - * @param oid 缃戝叧璁惧oid - * @param callBack - * @return - */ - public void getGatewayDrivers(String homeId, String oid, IResponseCallBack<List<GatewayDriverBean>> callBack) { - HDLPMOtaController.getInstance().getGatewayDrivers(homeId, oid, callBack); - } - /** - * Link缃戝叧椹卞姩->鑾峰彇瀛樺偍鍦ㄤ簯绔殑椹卞姩鍒嗛〉鍒楄〃 - * - * @param driveCode 椹卞姩缂栧彿鎴栭┍鍔ㄥ悕绉� - * @param osImageId 椹卞姩绫诲瀷id - * @param callBack - * @return - */ - public void getCloudGatewayDrivers(String driveCode, String osImageId, IResponseCallBack<CloudGatewayDriversBean> callBack) { - HDLPMOtaController.getInstance().getCloudGatewayDrivers(driveCode, osImageId, callBack); - } - /** - * Link缃戝叧椹卞姩鍗囩骇OTA鍛戒护涓嬪彂 - * - * @param homeId 浣忓畢id - * @param oid 缃戝叧璁惧oid - * @param driverVersionId 椹卞姩鐗堟湰id - * @param callBack - * @return - */ - public void upgradeGatewayDriver(String homeId, String oid, String driverVersionId, IDefaultCallBack callBack) { - HDLPMOtaController.getInstance().upgradeGatewayDriver(homeId, oid, driverVersionId, callBack); - } - - /** - * 鑾峰彇IARCC涓夋柟鍥轰欢鍒嗛〉 - * @param json 璇锋眰鏁版嵁 - * @param callBack 鍥炶皟 - * @return - */ - public void getACIARCCFirmware(String json, IResponseCallBack<List<FirmwareBean>> callBack) { - HDLPMOtaController.getInstance().getACIARCCFirmware(json, callBack); - } - /** - * 鑾峰彇IARCC涓夋柟鍥轰欢鍒嗙被 - * @param json 璇锋眰鏁版嵁 - * @param callBack 鍥炶皟 - * @return - */ - public void getACIARCCFirmwareList(String json, IResponseCallBack<List<FirmwareBean>> callBack) { - HDLPMOtaController.getInstance().getACIARCCFirmwareList(json, callBack); - } - /** - * 涓嬭浇IARCC鍥轰欢 - * @param requestUrl 璇锋眰鍦板潃 - * @param callBack 鍥炶皟 - * @return - */ - public void downloadCloudACIARCCFirmware(String requestUrl, IResponseCallBack<ResponseBody> callBack) { - HDLPMOtaController.getInstance().downloadCloudACIARCCFirmware(requestUrl, callBack); - } - /** - * LINK璁惧鑾峰彇椹卞姩鍗囩骇鍖呬笅杞藉湴鍧� - * - * @param driverVersionId 椹卞姩鐗堟湰Id - * @return - */ - public void getLinkDeviceDriverDownloadUrl(String driverVersionId, IResponseCallBack<DownloadUrlBean> callBack) { - HDLPMOtaController.getInstance().getLinkDeviceDriverDownloadUrl(driverVersionId, callBack); - } - - - /** - * 鑾峰彇璁惧鍥轰欢鍒楄〃鑾峰彇 - * - * @param homeId 浣忓畢id - * @param deviceOidId oid浜戠id - * @param callBack - * @return - */ - public void getDeviceFirmwares(String homeId, String deviceOidId, IResponseCallBack<List<DeviceFirmwareBean>> callBack) { - HDLPMOtaController.getInstance().getDeviceFirmwares(homeId, deviceOidId, callBack); - } - /** - /** - * 鑾峰彇璁惧鍥轰欢鍒楄〃鑾峰彇->鑾峰彇瀛樺偍鍦ㄤ簯绔殑鍥轰欢鍒嗛〉鍒楄〃 - * - * @param hardwareModel 纭欢鍨嬪彿 - * @param osImageId 绯荤粺闀滃儚id - * @param callBack - * @return - */ - public void getCloudDeviceFirmwares(String hardwareModel, String osImageId, IResponseCallBack<List<CloudDeviceFirmwaresBean>> callBack) { - HDLPMOtaController.getInstance().getCloudDeviceFirmwares(hardwareModel, osImageId, callBack); - } - - - /** - * Link璁惧鍥轰欢鍗囩骇OTA鍛戒护涓嬪彂 - * - * @param homeId 浣忓畢id - * @param deviceOidId 璁惧id - * @param firmwareVersionId 鍥轰欢鐗堟湰id - * @param callBack - * @return - */ - public void upgradeDeviceFirmware(String homeId, String deviceOidId, String firmwareVersionId, IDefaultCallBack callBack) { - HDLPMOtaController.getInstance().upgradeDeviceFirmware(homeId, deviceOidId, firmwareVersionId, callBack); - } - - /** - * LINK璁惧鑾峰彇鍥轰欢鍗囩骇鍖呬笅杞藉湴鍧� - * - * @param firmwareVersionId 鍥轰欢鐗堟湰Id - * @return - */ - public void getLinkDeviceFirmwareDownloadUrl(String firmwareVersionId, IResponseCallBack<DownloadUrlBean> callBack) { - HDLPMOtaController.getInstance().getLinkDeviceFirmwareDownloadUrl(firmwareVersionId, callBack); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/CloudDeviceFirmwaresBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/CloudDeviceFirmwaresBean.java deleted file mode 100644 index 137b8e6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/CloudDeviceFirmwaresBean.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.hdl.linkpm.sdk.ota.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * 浜戠璁惧鍥轰欢瀵硅薄 - */ - public class CloudDeviceFirmwaresBean implements Serializable { - /// 鍥轰欢鐗堟湰鍔犲瘑鏂囦欢鍦板潃 - private String encryptionFileUrl; - /// 鍥轰欢涓枃鍚嶇О - private String firmwareNameCn; - /// 鍥轰欢鑻辨枃鍚嶇О - private String firmwareNameEn; - /// 鏍囩绫诲瀷 - private String firmwareTag; - /// 鍥轰欢鐗堟湰 - private String firmwareVersion; - /// 鍥轰欢鐗堟湰缂栧彿 - private String firmwareVersionCode; - /// 鏇存柊鎻忚堪 - private String firmwareVersionDesc; - /// 鍥轰欢鐗堟湰Id - private String firmwareVersionId; - /// 鍥轰欢鐗堟湰绫诲瀷,鍙敤鍊�:STANDARD,SPECIAL - private String firmwareVersionType; - /// 纭欢cpu淇℃伅 - private String hardwareCpu; - /// 纭欢鍨嬪彿 - private String hardwareModel; - /// 鍥轰欢鏂囦欢MD5 - private String md5; - /// 鏇存柊鏃堕棿 - private String modifyTime; - - @NonNull - public String getEncryptionFileUrl() { - return encryptionFileUrl == null ? "" : encryptionFileUrl; - } - - public void setEncryptionFileUrl(@NonNull String newEncryptionFileUrl) { - this.encryptionFileUrl = newEncryptionFileUrl; - } - - @NonNull - public String getFirmwareNameCn() { - return firmwareNameCn == null ? "" : firmwareNameCn; - } - - public void setFirmwareNameCn(@NonNull String newFirmwareNameCn) { - this.firmwareNameCn = newFirmwareNameCn; - } - - - @NonNull - public String getFirmwareNameEn() { - return firmwareNameEn == null ? "" : firmwareNameEn; - } - - public void setFirmwareNameEn(@NonNull String newFirmwareNameEn) { - this.firmwareNameEn = newFirmwareNameEn; - } - - @NonNull - public String getFirmwareTag() { - return firmwareTag == null ? "" : firmwareTag; - } - - public void setFirmwareTag(@NonNull String newFirmwareTag) { - this.firmwareTag = newFirmwareTag; - } - - - @NonNull - public String getFirmwareVersion() { - return firmwareVersion == null ? "" : firmwareVersion; - } - - public void setFirmwareVersion(@NonNull String newFirmwareVersion) { - this.firmwareVersion = newFirmwareVersion; - } - - @NonNull - public String getFirmwareVersionCode() { - return firmwareVersionCode == null ? "" : firmwareVersionCode; - } - - public void setFirmwareVersionCode(@NonNull String newFirmwareVersionCode) { - this.firmwareVersionCode = newFirmwareVersionCode; - } - - - @NonNull - public String getFirmwareVersionDesc() { - return firmwareVersionDesc == null ? "" : firmwareVersionDesc; - } - - public void setFirmwareVersionDesc(@NonNull String newFirmwareVersionDesc) { - this.firmwareVersionDesc = newFirmwareVersionDesc; - } - - @NonNull - public String getFirmwareVersionId() { - return firmwareVersionId == null ? "" : firmwareVersionId; - } - - public void setFirmwareVersionId(@NonNull String newFirmwareVersionId) { - this.firmwareVersionId = newFirmwareVersionId; - } - - @NonNull - public String getFirmwareVersionType() { - return firmwareVersionType == null ? "" : firmwareVersionType; - } - - public void setFirmwareVersionType(@NonNull String newFirmwareVersionType) { - this.firmwareVersionType = newFirmwareVersionType; - } - @NonNull - public String getHardwareCpu() { - return hardwareCpu == null ? "" : hardwareCpu; - } - - public void setHardwareCpu(@NonNull String newHardwareCpu) { - this.hardwareCpu = newHardwareCpu; - } - - @NonNull - public String getHardwareModel() { - return hardwareModel == null ? "" : hardwareModel; - } - - public void setHardwareModel(@NonNull String newHardwareModel) { - this.hardwareModel = newHardwareModel; - } - - @NonNull - public String getMd5() { - return md5 == null ? "" : md5; - } - - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/CloudGatewayDriversBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/CloudGatewayDriversBean.java deleted file mode 100644 index b8adc53..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/CloudGatewayDriversBean.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.hdl.linkpm.sdk.ota.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * 浜戠缃戝叧椹卞姩瀵硅薄 - */ -public class CloudGatewayDriversBean implements Serializable { - /// 椹卞姩Id - private String driverId; - /// 椹卞姩鐗堟湰Id - private String driverVersionId; - /// 椹卞姩鐗堟湰缂栧彿 - private String driverVersionCode; - ///涓嶇煡閬撴槸鍟� - private String driverVersionType; - /// 鏇存柊鎻忚堪 - private String driverVersionDesc; - /// 鐗堟湰绫诲瀷 鍙敤鍊硷細 鏍囧噯鐗堬細STANDARD 鐗规畩鐗堬細SPECIAL,鍙敤鍊�:STANDARD,SPECIAL - /// 鏄惁浠樿垂 鍙敤鍊� 鍏嶈垂锛欶REE锛屼粯璐逛笉鑳借瘯鐢細NOT_FREE锛屼粯璐硅瘯鐢�3涓湀锛歁ONTHS_3锛屼粯璐硅瘯鐢�6涓湀锛歁ONTHS_6,鍙敤鍊�:FREE,NOT_FREE,MONTHS_3,MONTHS_6 - private String driverFree; - /// 鏍囩绫诲瀷 - private String driverTag; - /// 鏇存柊鏃堕棿 - private String modifyTime; - /// 鍙戝竷鐘舵�� 鍙敤鍊� 涓嬫灦锛歋OLD_OUT 鍙戝竷锛歅UBLISH,鍙敤鍊�:SOLD_OUT,PUBLISH - private String saleStatus; - /// 椹卞姩鏂囦欢鍦板潃 - private String driverFileUrl; - /// 椹卞姩鐗堟湰鍙� - private String driverVersion; - /// 涓嬭浇娆℃暟 - private String downloadCount; - /// 椹卞姩鐘舵�侊紝 0寮�鍙戞澘 1姝e紡鐗�2鍋滅敤 鍙敤鍊硷細BETA锛孯ELEASE,DISABLE鍙敤鍊�:BETA,RELEASE锛孌ISABLE - private String driverStatus; - /// 鏂囦欢MD5 - private String driverMd5; - ///涓嶇煡閬撴槸鍟� - private String enable; - - - @NonNull - public String getDriverId() { - return driverId == null ? "" : driverId; - } - - public void setDriverId(@NonNull String newDriverId) { - this.driverId = newDriverId; - } - - @NonNull - public String getDriverVersionId() { - return driverVersionId == null ? "" : driverVersionId; - } - - public void setDriverVersionId(@NonNull String newDriverVersionId) { - this.driverVersionId = newDriverVersionId; - } - - @NonNull - public String getDriverVersionCode() { - return driverVersionCode == null ? "" : driverVersionCode; - } - - public void setDriverVersionCode(@NonNull String newDriverVersionCode) { - this.driverVersionCode = newDriverVersionCode; - } - - @NonNull - public String getDriverVersionDesc() { - return driverVersionDesc == null ? "" : driverVersionDesc; - } - - public void setDriverVersionDesc(@NonNull String newDriverVersionDesc) { - this.driverVersionDesc = newDriverVersionDesc; - } - - - public void setDriverFree(@NonNull String newDriverFree) { - this.driverFree = newDriverFree; - } - - @NonNull - public String getDriverFree() { - return driverFree == null ? "" : driverFree; - } - - @NonNull - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } - - @NonNull - public String getDriverTag() { - return driverTag == null ? "" : driverTag; - } - - public void setDriverTag(@NonNull String newDriverTag) { - this.driverTag = newDriverTag; - } - - - @NonNull - public String getSaleStatus() { - return saleStatus == null ? "" : saleStatus; - } - - public void setSaleStatus(@NonNull String newSaleStatus) { - this.saleStatus = newSaleStatus; - } - - @NonNull - public String getDriverFileUrl() { - return driverFileUrl == null ? "" : driverFileUrl; - } - - public void setDriverFileUrl(@NonNull String newDriverFileUrl) { - this.driverFileUrl = newDriverFileUrl; - } - - @NonNull - public String getDownloadCount() { - return downloadCount == null ? "" : downloadCount; - } - - public void setDriverVersion(@NonNull String newDriverVersion) { - this.driverVersion = newDriverVersion; - } - - @NonNull - public String getDriverVersion() { - return driverVersion == null ? "" : driverVersion; - } - - @NonNull - public String getDriverStatus() { - return driverStatus == null ? "" : driverStatus; - } - - public void setDriverStatus(@NonNull String newDriverStatus) { - this.driverStatus = newDriverStatus; - } - - @NonNull - public String getDriverMd5() { - return driverMd5 == null ? "" : driverMd5; - } - - @NonNull - public String getDriverVersionType() { - return driverVersionType == null ? "" : driverVersionType; - } - - @NonNull - public String getEnable() { - return enable == null ? "" : enable; - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/DeviceFirmwareBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/DeviceFirmwareBean.java deleted file mode 100644 index f43c55a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/DeviceFirmwareBean.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.hdl.linkpm.sdk.ota.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/17/21. - * 璁惧鍥轰欢淇℃伅 - */ -public class DeviceFirmwareBean implements Serializable { - - private String protocolType;//鍗忚绫诲瀷 - private String deviceModel;//璁惧鍨嬪彿 - private String firmwareNameEn;//鍥轰欢鑻辨枃鍚嶇О - private String firmwareNameCn;//鍥轰欢涓枃鍚嶇О - private String imageId;//imageId - private String version;//鐗堟湰鍙� - private String localUrl;//鍗囩骇鍥轰欢鏂囦欢鏈湴璺緞 - private String oid;//鍥轰欢oid - - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(String oid) { - this.oid = oid; - } - - - public String getLocalUrl() { - return localUrl == null ? "" : localUrl; - } - - public void setLocalUrl(String localUrl) { - this.localUrl = localUrl; - } - - @NonNull - public String getProtocolType() { - return protocolType == null ? "" : protocolType; - } - - public void setProtocolType(@NonNull String protocolType) { - this.protocolType = protocolType; - } - - @NonNull - public String getDeviceModel() { - return deviceModel == null ? "" : deviceModel; - } - - public void setDeviceModel(@NonNull String deviceModel) { - this.deviceModel = deviceModel; - } - - @NonNull - public String getFirmwareNameEn() { - return firmwareNameEn == null ? "" : firmwareNameEn; - } - - public void setFirmwareNameEn(@NonNull String firmwareNameEn) { - this.firmwareNameEn = firmwareNameEn; - } - - @NonNull - public String getFirmwareNameCn() { - return firmwareNameCn == null ? "" : firmwareNameCn; - } - - public void setFirmwareNameCn(@NonNull String firmwareNameCn) { - this.firmwareNameCn = firmwareNameCn; - } - - @NonNull - public String getImageId() { - return imageId == null ? "" : imageId; - } - - public void setImageId(@NonNull String imageId) { - this.imageId = imageId; - } - - @NonNull - public String getVersion() { - return version == null ? "" : version; - } - - public void setVersion(@NonNull String version) { - this.version = version; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/DownloadUrlBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/DownloadUrlBean.java deleted file mode 100644 index 288d5a6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/DownloadUrlBean.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hdl.linkpm.sdk.ota.bean; - -import androidx.annotation.NonNull; - -/** - * Created by jlchen on 12/17/21. - */ -public class DownloadUrlBean { - - private String downloadUrl;//涓嬭浇鍦板潃 - - @NonNull - public String getDownloadUrl() { - return downloadUrl == null ? "" : downloadUrl; - } - - public void setDownloadUrl(@NonNull String downloadUrl) { - this.downloadUrl = downloadUrl; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/FirmwareBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/FirmwareBean.java deleted file mode 100644 index 20eb762..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/FirmwareBean.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.hdl.linkpm.sdk.ota.bean; - -import java.io.Serializable; -import java.util.List; - -public class FirmwareBean implements Serializable { - - /** - * firmwareName : 澶ч噾绌鸿皟 - * brandName : 澶ч噾 - * hardwareModel : MAC/GW-ZB.10 - * versions : [{"firmwareFileUrl":"http://hdl-hz-test.oss-cn-hangzhou.aliyuncs.com/20/2022/09/5566ad98-e377-4314-96d2-20ffadccf43f.bin","firmwareVersion":"1.1.0","firmwarePackageName":"coolbox_DaikinDUX200515"}] - */ - - private String firmwareName; - private String brandName; - private String hardwareModel; - private List<VersionsBean> versions; - - public String getFirmwareName() { - return firmwareName; - } - - public void setFirmwareName(String firmwareName) { - this.firmwareName = firmwareName; - } - - public String getBrandName() { - return brandName; - } - - public void setBrandName(String brandName) { - this.brandName = brandName; - } - - public String getHardwareModel() { - return hardwareModel; - } - - public void setHardwareModel(String hardwareModel) { - this.hardwareModel = hardwareModel; - } - - public List<VersionsBean> getVersions() { - return versions; - } - - public void setVersions(List<VersionsBean> versions) { - this.versions = versions; - } - - public static class VersionsBean implements Serializable { - /** - * firmwareFileUrl : http://hdl-hz-test.oss-cn-hangzhou.aliyuncs.com/20/2022/09/5566ad98-e377-4314-96d2-20ffadccf43f.bin - * firmwareVersion : 1.1.0 - * firmwarePackageName : coolbox_DaikinDUX200515 - */ - - private String firmwareFileUrl; - private String firmwareVersion; - private String firmwarePackageName; - private long thirdFirmwareVersionId; // 鍥轰欢鐗堟湰id - - public long getThirdFirmwareVersionId() { - return thirdFirmwareVersionId; - } - - public void setThirdFirmwareVersionId(long thirdFirmwareVersionId) { - this.thirdFirmwareVersionId = thirdFirmwareVersionId; - } - - public String getFirmwareFileUrl() { - return firmwareFileUrl; - } - - public void setFirmwareFileUrl(String firmwareFileUrl) { - this.firmwareFileUrl = firmwareFileUrl; - } - - public String getFirmwareVersion() { - return firmwareVersion; - } - - public void setFirmwareVersion(String firmwareVersion) { - this.firmwareVersion = firmwareVersion; - } - - public String getFirmwarePackageName() { - return firmwarePackageName; - } - - public void setFirmwarePackageName(String firmwarePackageName) { - this.firmwarePackageName = firmwarePackageName; - } - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/GatewayDriverBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/GatewayDriverBean.java deleted file mode 100644 index 4d573f1..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/GatewayDriverBean.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.hdl.linkpm.sdk.ota.bean; - - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/17/21. - * <p> - * 缃戝叧璁惧椹卞姩 - */ -public class GatewayDriverBean implements Serializable { - - private String driverCode;//椹卞姩缂栫爜 - private String driverName; - private String driverNameEn;//椹卞姩鑻辨枃鍚嶇О - private String driverNameCn;//椹卞姩涓枃鍚嶇О - private String imageId;//imageId - private String version;//鐗堟湰鍙� - private String localUrl;//鍗囩骇椹卞姩鏂囦欢鏈湴璺緞 - - public String getLocalUrl() { - return localUrl == null ? "" : localUrl; - } - - public void setLocalUrl(String localUrl) { - this.localUrl = localUrl; - } - - @NonNull - public String getDriverCode() { - return driverCode == null ? "" : driverCode; - } - - public void setDriverCode(@NonNull String driverCode) { - this.driverCode = driverCode; - } - - @NonNull - public String getDriverName() { - return driverName == null ? "" : driverName; - } - - public void setDriverName(@NonNull String driverName) { - this.driverName = driverName; - } - - @NonNull - public String getDriverNameEn() { - return driverNameEn == null ? "" : driverNameEn; - } - - public void setDriverNameEn(@NonNull String driverNameEn) { - this.driverNameEn = driverNameEn; - } - - @NonNull - public String getDriverNameCn() { - return driverNameCn == null ? "" : driverNameCn; - } - - public void setDriverNameCn(@NonNull String driverNameCn) { - this.driverNameCn = driverNameCn; - } - - @NonNull - public String getImageId() { - return imageId == null ? "" : imageId; - } - - public void setImageId(@NonNull String imageId) { - this.imageId = imageId; - } - - @NonNull - public String getVersion() { - return version == null ? "" : version; - } - - public void setVersion(@NonNull String version) { - this.version = version; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/PassDataBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/PassDataBean.java deleted file mode 100644 index b595f66..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/bean/PassDataBean.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.hdl.linkpm.sdk.ota.bean; - -import java.io.Serializable; - -public class PassDataBean implements Serializable { - - /** - * Device_ID : 1 - * DeviceAddr : 60a423fffe93cf89 - * Epoint : 200 - * Data_ID : 64513 - * Data : {"PassData":"07020000030b1621"} - */ - - private int Device_ID; - private String DeviceAddr; - private int Epoint; - private int Data_ID; - private DataBean Data; - - public int getDevice_ID() { - return Device_ID; - } - - public void setDevice_ID(int Device_ID) { - this.Device_ID = Device_ID; - } - - public String getDeviceAddr() { - return DeviceAddr; - } - - public void setDeviceAddr(String DeviceAddr) { - this.DeviceAddr = DeviceAddr; - } - - public int getEpoint() { - return Epoint; - } - - public void setEpoint(int Epoint) { - this.Epoint = Epoint; - } - - public int getData_ID() { - return Data_ID; - } - - public void setData_ID(int Data_ID) { - this.Data_ID = Data_ID; - } - - public DataBean getData() { - return Data; - } - - public void setData(DataBean Data) { - this.Data = Data; - } - - public static class DataBean implements Serializable { - /** - * PassData : 07020000030b1621 - */ - - private String PassData; - - public String getPassData() { - return PassData; - } - - public void setPassData(String PassData) { - this.PassData = PassData; - } - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/controller/HDLPMOtaController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/controller/HDLPMOtaController.java deleted file mode 100644 index 663f873..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/ota/controller/HDLPMOtaController.java +++ /dev/null @@ -1,475 +0,0 @@ -package com.hdl.linkpm.sdk.ota.controller; - -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.core.api.HDLCloudHomeApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.ota.bean.CloudDeviceFirmwaresBean; -import com.hdl.linkpm.sdk.ota.bean.CloudGatewayDriversBean; -import com.hdl.linkpm.sdk.ota.bean.DeviceFirmwareBean; -import com.hdl.linkpm.sdk.ota.bean.DownloadUrlBean; -import com.hdl.linkpm.sdk.ota.bean.FirmwareBean; -import com.hdl.linkpm.sdk.ota.bean.GatewayDriverBean; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.schedulers.Schedulers; -import io.reactivex.rxjava3.subscribers.DisposableSubscriber; -import okhttp3.ResponseBody; - -/** - * Created by jlchen on 12/17/21. - * OTA 缃戝叧銆佽澶囧浐浠舵煡璇㈠拰涓嬭浇鐩稿叧绠$悊 - */ -public class HDLPMOtaController { - /** - * instance - */ - private volatile static HDLPMOtaController instance; - - /** - * getInstance - * - * @return HDLPMOtaController - */ - public static synchronized HDLPMOtaController getInstance() { - if (instance == null) { - synchronized (HDLPMOtaController.class) { - if (instance == null) { - instance = new HDLPMOtaController(); - } - } - } - return instance; - } - - /** - * 鍘熺敓璁惧鑾峰彇鍥轰欢鍗囩骇鍖呬笅杞藉湴鍧� - * - * @param firmwareVersionId 鍥轰欢鐗堟湰Id - * @return downloadUrl - */ - public Disposable getNativeDeviceFirmwareDownloadUrl(String firmwareVersionId, IResponseCallBack<DownloadUrlBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("firmwareVersionId", firmwareVersionId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_NativeDeviceFirmwareDownloadUrl); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<DownloadUrlBean>() { - @Override - public void onResponse(DownloadUrlBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * Link缃戝叧椹卞姩鍒楄〃鑾峰彇 - * - * @param homeId 浣忓畢id - * @param oid 缃戝叧璁惧oid - * @param callBack - * @return - */ - public Disposable getGatewayDrivers(String homeId, String oid, IResponseCallBack<List<GatewayDriverBean>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("oid", oid); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_GatewayDrivers); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<GatewayDriverBean>>() { - @Override - public void onResponse(List<GatewayDriverBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * Link缃戝叧椹卞姩->鑾峰彇瀛樺偍鍦ㄤ簯绔殑椹卞姩鍒嗛〉鍒楄〃 - * - * @param driveCode 椹卞姩缂栧彿鎴栭┍鍔ㄥ悕绉� - * @param osImageId 椹卞姩绫诲瀷id - * @param callBack - * @return - */ - public Disposable getCloudGatewayDrivers(String driveCode, String osImageId, IResponseCallBack<CloudGatewayDriversBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("driveCode", driveCode); - json.addProperty("osImageId", osImageId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_CloudGatewayDrivers); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<CloudGatewayDriversBean>() { - @Override - public void onResponse(CloudGatewayDriversBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * Link缃戝叧椹卞姩鍗囩骇OTA鍛戒护涓嬪彂 - * - * @param homeId 浣忓畢id - * @param oid 缃戝叧璁惧oid - * @param driverVersionId 椹卞姩鐗堟湰id - * @param callBack - * @return - */ - public Disposable upgradeGatewayDriver(String homeId, String oid, String driverVersionId, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("oid", oid); - json.addProperty("driverVersionId", driverVersionId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GatewayDriverUpgrade); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鑾峰彇IARCC涓夋柟鍥轰欢鍒嗛〉 - * - * @param json 璇锋眰鏁版嵁 - * @param callBack 鍥炶皟 - * @return - */ - public Disposable getACIARCCFirmware(String json, IResponseCallBack<List<FirmwareBean>> callBack) { - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_FIRMWARE_PAGE); - return HxHttp.builder() - .url(requestUrl) - .raw(json) - .build() - .post() - .subscribeWith(new HDLResponse<List<FirmwareBean>>() { - @Override - public void onResponse(List<FirmwareBean> list) { - if (callBack != null) { - callBack.onSuccess(list); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇IARCC涓夋柟鍥轰欢鍒嗙被 - * - * @param json 璇锋眰鏁版嵁 - * @param callBack 鍥炶皟 - * @return - */ - public Disposable getACIARCCFirmwareList(String json, IResponseCallBack<List<FirmwareBean>> callBack) { - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_FIRMWARE_LIST); - return HxHttp.builder() - .url(requestUrl) - .raw(json) - .build() - .post() - .subscribeWith(new HDLResponse<List<FirmwareBean>>() { - @Override - public void onResponse(List<FirmwareBean> list) { - if (callBack != null) { - callBack.onSuccess(list); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 涓嬭浇IARCC鍥轰欢 - * - * @param requestUrl 璇锋眰鍦板潃 - * @param callBack 鍥炶皟 - * @return - */ - public Disposable downloadCloudACIARCCFirmware(String requestUrl, IResponseCallBack<ResponseBody> callBack) { - return HxHttp.builder() - .url(requestUrl) - .build() - .download() - .observeOn(Schedulers.io()) - .subscribeWith(new DisposableSubscriber<ResponseBody>() { - @Override - public void onNext(ResponseBody responseBody) { - try { - if (callBack != null) { - callBack.onSuccess(responseBody); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - @Override - public void onError(Throwable t) { - HDLExceptionSubmitUtils.submit(requestUrl, null, t); - } - - @Override - public void onComplete() { - - } - }); - } - - /** - * LINK缃戝叧鑾峰彇椹卞姩鍗囩骇鍖呬笅杞藉湴鍧� - * - * @param driverVersionId 椹卞姩鐗堟湰Id - * @return - */ - public Disposable getLinkDeviceDriverDownloadUrl(String driverVersionId, IResponseCallBack<DownloadUrlBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("driverVersionId", driverVersionId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_LinkDeviceDriverDownloadUrl); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<DownloadUrlBean>() { - @Override - public void onResponse(DownloadUrlBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鑾峰彇璁惧鍥轰欢鍒楄〃鑾峰彇 - * - * @param homeId 浣忓畢id - * @param deviceOidId oid浜戠id - * @param callBack - * @return - */ - public Disposable getDeviceFirmwares(String homeId, String deviceOidId, IResponseCallBack<List<DeviceFirmwareBean>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("deviceOidId", deviceOidId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_DeviceFirmwares); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<DeviceFirmwareBean>>() { - @Override - public void onResponse(List<DeviceFirmwareBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇璁惧鍥轰欢鍒楄〃鑾峰彇->鑾峰彇瀛樺偍鍦ㄤ簯绔殑鍥轰欢鍒嗛〉鍒楄〃 - * - * @param hardwareModel 纭欢鍨嬪彿 - * @param osImageId 绯荤粺闀滃儚id - * @param callBack - * @return - */ - public Disposable getCloudDeviceFirmwares(String hardwareModel, String osImageId, IResponseCallBack<List<CloudDeviceFirmwaresBean>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("hardwareModel", hardwareModel); - json.addProperty("osImageId", osImageId); - json.addProperty("protocolType", "ZIGBEE");//鍗忚绫诲瀷,鍙敤鍊�:BUSPRO,KNX,ZIGBEE,OTHER - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_CloudDeviceFirmwares); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<CloudDeviceFirmwaresBean>>() { - @Override - public void onResponse(List<CloudDeviceFirmwaresBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * Link璁惧鍥轰欢鍗囩骇OTA鍛戒护涓嬪彂 - * - * @param homeId 浣忓畢id - * @param deviceOidId 璁惧id - * @param firmwareVersionId 鍥轰欢鐗堟湰id - * @param callBack - * @return - */ - public Disposable upgradeDeviceFirmware(String homeId, String deviceOidId, String firmwareVersionId, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("deviceOidId", deviceOidId); - json.addProperty("firmwareVersionId", firmwareVersionId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_DeviceFirmwareUpgrade); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * LINK璁惧鑾峰彇鍥轰欢鍗囩骇鍖呬笅杞藉湴鍧� - * - * @param firmwareVersionId 鍥轰欢鐗堟湰Id - * @return - */ - public Disposable getLinkDeviceFirmwareDownloadUrl(String firmwareVersionId, IResponseCallBack<DownloadUrlBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("firmwareVersionId", firmwareVersionId); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_OTA_GET_LinkDeviceFirmwareDownloadUrl); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<DownloadUrlBean>() { - @Override - public void onResponse(DownloadUrlBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/HDLLinkPMProject.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/HDLLinkPMProject.java deleted file mode 100644 index be995c9..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/HDLLinkPMProject.java +++ /dev/null @@ -1,378 +0,0 @@ -package com.hdl.linkpm.sdk.project; - -import com.google.gson.JsonArray; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.home.bean.GatewayBindBean; -import com.hdl.linkpm.sdk.home.bean.GatewayInfoBean; -import com.hdl.linkpm.sdk.home.bean.HomeInfoBean; -import com.hdl.linkpm.sdk.home.controller.HDLPMHomeController; -import com.hdl.linkpm.sdk.project.bean.HousePageRequestBean; -import com.hdl.linkpm.sdk.project.bean.IrDeviceBrandBean; -import com.hdl.linkpm.sdk.project.bean.IrDeviceCodeBean; -import com.hdl.linkpm.sdk.project.bean.IrDeviceTypeBean; -import com.hdl.linkpm.sdk.project.bean.NewProjectRequestBean; -import com.hdl.linkpm.sdk.project.callback.DriverDetailListCallBack; -import com.hdl.linkpm.sdk.project.callback.DriverDownLoadCallBack; -import com.hdl.linkpm.sdk.project.callback.DriverTypeListCallBack; -import com.hdl.linkpm.sdk.project.callback.IEmployeeInfoCallBack; -import com.hdl.linkpm.sdk.project.callback.IProjectHouseListCallBack; -import com.hdl.linkpm.sdk.project.callback.IProjectInfoListCallBack; -import com.hdl.linkpm.sdk.project.controller.HDLPMProjectController; - -import java.util.List; - - -/** - * Created by jlchen on 12/8/21. - * 椤圭洰绠$悊鐩稿叧 - */ -public class HDLLinkPMProject { - //instance - private volatile static HDLLinkPMProject instance; - - /** - * getInstance - * - * @return HDLLinkProject - */ - public static synchronized HDLLinkPMProject getInstance() { - if (instance == null) { - synchronized (HDLLinkPMProject.class) { - if (instance == null) { - instance = new HDLLinkPMProject(); - } - } - } - return instance; - } - - - /** - * 鑾峰彇鎸囧畾鍏徃鍛樺伐鍒楄〃 鏀寔鍚嶇О妯$硦鏌ヨ - * - * @param companyId 鍏徃ID - * @param userName 鍚嶇О妯$硦鏌ヨ - * @param callBack - * @return - */ - public void getDebuggerList(String companyId, String userName, IEmployeeInfoCallBack callBack) { - HDLPMProjectController.getInstance().getDebuggerList(companyId, userName, callBack); - } - - /** - * 娣诲姞璋冭瘯浜哄憳銆佽浆绉昏皟璇曚汉鍛� - * - * @param houseId 浣忓畢id - * @param userId 鐢ㄦ埛id - * @param callBack - * @return - */ - public void changeHomeDebugger(String houseId, String userId, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().changeHomeDebugger(houseId, userId, callBack); - } - - /** - * 鎵归噺娣诲姞璋冭瘯浜哄憳銆佽浆绉昏皟璇曚汉鍛� - * - * @param houseIds 浣忓畢id 鍒楄〃 - * @param userId 鐢ㄦ埛id - * @param communityCode 绀惧尯code - * @param callBack - * @return - */ - public void batchChangeHomeDebugger(List<String> houseIds, String userId, String communityCode, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().batchChangeHomeDebugger(houseIds, userId, communityCode, callBack); - } - - /** - * 鑾峰彇椤圭洰鍒楄〃銆佹寚瀹氶」鐩被鍨嬫煡璇㈡墍鏈夎皟璇曠姸鎬� - * - * @param projectTypes 鏁扮粍 椤圭洰绫诲瀷 ProjectType.Home銆丳rojectType.RealEstate銆丳rojectType.PublicBuilding銆丳rojectType.Hotel - * @param pageNo - * @param pageSize - * @param callBack - * @return - */ - public void getProjectList(List<String> projectTypes, int pageNo, int pageSize, IProjectInfoListCallBack callBack) { - HDLPMProjectController.getInstance().getProjectList(projectTypes, "", null, pageNo, pageSize, callBack); - } - - /** - * 鑾峰彇椤圭洰鍒楄〃 - * 鏀寔鏍规嵁椤圭洰绫诲瀷 - * 鏀寔鏍规嵁椤圭洰鍚嶅瓧妯$硦鏌ヨ - * 鏀寔鏇村姞璋冭瘯鐘舵�侀泦鍚堟煡璇� - * - * @param projectTypes 鏁扮粍 椤圭洰绫诲瀷 ProjectType.Home銆丳rojectType.RealEstate銆丳rojectType.PublicBuilding銆丳rojectType.Hotel - * @param communityName 閫氳繃椤圭洰鍚嶇О妯$硦鏌ヨ - * @param debugStatus 鏁扮粍 璋冭瘯鐘舵�� To_Be_Debugged(0, "寰呰皟璇�")銆丏ebugging(1, "璋冭瘯涓�")銆乄AIT_DELIVERED(3, "寰呬氦浠�")銆丏elivered(4, "宸蹭氦浠�")銆両NITIAL_TATE(5,"鍒濆鎬�") - * @param pageNo - * @param pageSize - * @param callBack - * @return - */ - public void getProjectList(List<String> projectTypes, String communityName, List<String> debugStatus, int pageNo, int pageSize, IProjectInfoListCallBack callBack) { - HDLPMProjectController.getInstance().getProjectList(projectTypes, communityName, debugStatus, pageNo, pageSize, callBack); - } - - public void getRedebugProjectList(String communityName,String companyId,String debugUserId, int pageNo, int pageSize, IProjectInfoListCallBack callBack) { - HDLPMProjectController.getInstance().getReDebugProjectList(communityName,companyId, debugUserId, pageNo, pageSize, callBack); - } - - public void getProjectListExcuse(List<String> projectTypes, String communityName, List<String> debugStatus, int pageNo, int pageSize, IProjectInfoListCallBack callBack) { - HDLPMProjectController.getInstance().getProjectListExecute(projectTypes, communityName, debugStatus, pageNo, pageSize, callBack); - } - - public void addDownloadCount(String driverVersionId) { - HDLPMProjectController.getInstance().addDownloadCount(driverVersionId); - } - - public void addDownloadFirmwareCount(String firmwareVersionId) { - HDLPMProjectController.getInstance().addDownloadFirmwareCount(firmwareVersionId); - } - - public void addDownloadThirdCount(String thirdFirmwareVersionId) { - HDLPMProjectController.getInstance().addDownloadThirdCount(thirdFirmwareVersionId); - } - - - /** - * 鏂板缓椤圭洰 - * - * @param newProjectRequestBean 椤圭洰淇℃伅瀵硅薄 - * @param callBack - * @return - */ - public void addNewHouseProject(NewProjectRequestBean newProjectRequestBean, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().addNewHouseProject(newProjectRequestBean, callBack); - } - - /** - * 浜や粯椤圭洰 鎵�鏈夋埧灞嬪浜庡凡浜や粯鐘舵�佹墠閫氳繃 鍚﹀垯鎻愮ず灏氭湭鏈夋湭浜や粯鐨勬埧灞� - * 閽堝閰掑簵鍜屽湴浜ч」鐩� - * - * @param communityId 灏忓尯ID - * @param callBack - * @return - */ - public void deliveryRoject(String communityId, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().deliveryRoject(communityId, callBack); - } - - /** - * 鎾ゅ洖浜や粯鐨勯」鐩� 宸蹭氦浠樼殑椤圭洰鍙樹负寰呬氦浠� 閽堝閰掑簵鍜屽湴浜ч」鐩� - * - * @param communityId 灏忓尯ID - * @param callBack - * @return - */ - public void withdrawDeliveryProject(String communityId, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().withdrawDeliveryProject(communityId, callBack); - } - - /******************************鎴垮眿绠$悊******************************/ - /** - * 鑾峰彇椤圭洰鐨勬埧灞嬩俊鎭垪琛紝鍒嗛〉鏌ヨ - * - * @param requestBean 璇锋眰鍙傛暟瀵硅薄 - * @param callBack - * @return - */ - public void getProjecHouseList(HousePageRequestBean requestBean, IProjectHouseListCallBack callBack) { - HDLPMProjectController.getInstance().getProjecHouseList(requestBean, callBack); - } - public void getProjecHouseListExecute(HousePageRequestBean requestBean, IProjectHouseListCallBack callBack) { - HDLPMProjectController.getInstance().getProjecHouseListExecute(requestBean, callBack); - } - - /** - * 缁戝畾鏋佸厜鎺ㄩ�� - * - * @param communityCode 椤圭洰code - * @param debugStatus 璋冭瘯鐘舵�� 0锛氬緟璋冭瘯 1锛氳皟璇曚腑 2锛氬緟楠屾敹 3锛氬凡瀹屾垚 4锛氬凡浜や粯锛屼负绌哄垯涓嶈繃婊� - * @param houseIds 鎴垮眿id闆嗗悎 - * @param callBack - * @return - */ - - /** - * - * @param deviceName 璁惧鍚嶇О - * @param pushToken App鐨勬帹閫乀oken锛屽湪鏋佸厜涓篟egId 璁惧绫诲瀷锛屽彲鐢ㄥ�硷細Android銆両OS銆乄inPhone - * @param software 杞欢鏉ユ簮锛孍voyo銆丱N銆丱N_Plus銆丏ebugTreasure - * @param callBack - */ - public void bindJPushId(String deviceName, String pushToken, String software, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().bindJPushId(deviceName, pushToken, software, callBack); - } - - /** - * - * @param homeId 浣忓畢id - * @param homeName 浣忓畢鍚嶇О - * @param callBack - */ - public void syncHome(String homeId, String homeName, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().updateHouseName(homeId, homeName, callBack); - } - - - - /** - * 瑙g粦鏋佸厜鎺ㄩ�� - * - * @param callBack - * @return - */ - public void unBindJPushId(IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().unBindJPushId(callBack); - } - - /** - * 鎵归噺鏇存柊鎴垮眿璋冭瘯鐘舵�� - * - * @param communityCode 椤圭洰code - * @param debugStatus 璋冭瘯鐘舵�� 0锛氬緟璋冭瘯 1锛氳皟璇曚腑 2锛氬緟楠屾敹 3锛氬凡瀹屾垚 4锛氬凡浜や粯锛屼负绌哄垯涓嶈繃婊� - * @param houseIds 鎴垮眿id闆嗗悎 - * @param callBack - * @return - */ - public void batchChangeHouseDebugstatus(String communityCode, int debugStatus, List<String> houseIds, IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().batchChangeHouseDebugstatus(communityCode, debugStatus, houseIds, callBack); - } - - /** - * 鑾峰彇椹卞姩鍒嗛〉鍒楄〃 - * - * @param driverTypeId 椹卞姩绫诲瀷id - * @param callBack - * @return - */ - public void getDriverList(String driverTypeId, DriverTypeListCallBack callBack) { - HDLPMProjectController.getInstance().driverList(driverTypeId, callBack); - } - - /** - * 鑾峰彇椹卞姩鍒嗛〉鍒楄〃 - * - * @param driverId 椹卞姩绫诲瀷id - * @param callBack - * @return - */ - public void getVersionList(String driverId, DriverDetailListCallBack callBack) { - HDLPMProjectController.getInstance().versionList(driverId, callBack); - } - - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鍒楄〃 - * - * @param deviceType 璁惧绫诲瀷 - * @param callBack - * @return - */ - public void getIrDeviceTypeList(String deviceType, IResponseCallBack<List<IrDeviceTypeBean>> callBack) { - HDLPMProjectController.getInstance().getIrDeviceTypeList(deviceType, callBack); - } - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鐨勫搧鐗屽垪琛� - * - * @param deviceTypeId 璁惧绫诲瀷涓婚敭Id - * @param callBack - * @return - */ - public void getIrDeviceBrandList(String deviceTypeId, IResponseCallBack<List<IrDeviceBrandBean>> callBack) { - HDLPMProjectController.getInstance().getIrDeviceBrandList(deviceTypeId, callBack); - } - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鐨勫搧鐗岀孩澶栫爜搴撳垪琛� - * - * @param brandId 鍝佺墝涓婚敭Id - * @param callBack - * @return - */ - public void getIrDeviceCodeList(String brandId, IResponseCallBack<List<IrDeviceCodeBean>> callBack) { - HDLPMProjectController.getInstance().getIrDeviceCodeList(brandId, callBack); - } - - /** - * 椹卞姩涓婁紶 - * - * @param url 椹卞姩涓嬭浇璺緞 - * @param callBack - * @return - */ - public void downLoadDriver(String url, DriverDownLoadCallBack callBack) { - HDLPMProjectController.getInstance().downLoadDriver(url, callBack); - } - - - - - /******************************鏁版嵁涓婁紶浜戠******************************/ - /** - * house琛ㄧ殑鏁版嵁娌℃湁鍚屾鍒癶ome琛ㄣ�佹暟鎹瓨鍦ㄤ袱寮犺〃閲岄潰锛岄渶瑕佸鎴风璋冩帴鍙e悓姝� - * - * @param homeInfoBean 浣忓畢Info - * @param callBack - * @return - */ - public void synchHouseToHome(HomeInfoBean homeInfoBean, IDefaultCallBack callBack) { - HDLPMHomeController.getInstance().synchHouseToHome(homeInfoBean, callBack); - } - - /** - * 缁戝畾缃戝叧鍒颁綇瀹� - * - * @param bean 缃戝叧淇℃伅 - * @param callBack - * @return - */ - public void bindGateway(GatewayBindBean bean, IResponseCallBack<GatewayInfoBean> callBack) { - HDLPMHomeController.getInstance().bindGateway(bean, callBack); - } - - /** - * 璁惧鍩烘湰淇℃伅(oid) - * @param homeId - * @param devicesInfo - * @param callBack - */ - public void fullUpdateDeviceInfo(String homeId, JsonArray devicesInfo,IDefaultCallBack callBack){ - HDLPMProjectController.getInstance().fullUpdateDeviceInfo(homeId, devicesInfo,callBack); - } - - /** - * 鏇存柊鍔熻兘淇℃伅锛屽叏閲� - * @param homeId - * @param funtionListInfo - * @param callBack - */ - public void fullUpdateFunctionInfo(String homeId ,String gatewayId,JsonArray funtionListInfo ,IDefaultCallBack callBack){ - HDLPMProjectController.getInstance().fullUpdateFunctionListInfo(homeId,gatewayId,funtionListInfo,callBack); - } - public void fullUpdateSceneInfo(String homeId ,JsonArray data ,IDefaultCallBack callBack){ - HDLPMProjectController.getInstance().fullUpdateSceneListInfo(homeId,data,callBack); - } - public void fullUpdateLogicInfo(String homeId ,JsonArray data ,IDefaultCallBack callBack){ - HDLPMProjectController.getInstance().fullUpdateLogicListInfo(homeId,data,callBack); - } - public void fullUpdateUidInfo(String homeId ,JsonArray data ,IDefaultCallBack callBack){ - HDLPMProjectController.getInstance().fullUpdateUidInfo(homeId,data,callBack); - } - public void fullUpdateSecuritysListInfo(String homeId,String gatewayId ,JsonArray data ,IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().fullUpdateSecuritysListInfo(homeId, gatewayId, data, callBack); - } - public void fullUpdateGroupControlListInfo(String homeId,String gatewayId ,JsonArray data ,IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().fullUpdateSecuritysListInfo(homeId, gatewayId, data, callBack); - } - - public void fullAddGroupControlList(String homeId,String gatewayId ,JsonArray data ,IDefaultCallBack callBack) { - HDLPMProjectController.getInstance().fullAddGroupControlList(homeId, gatewayId, data, callBack); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveDetailBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveDetailBean.java deleted file mode 100644 index 308a17d..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveDetailBean.java +++ /dev/null @@ -1,215 +0,0 @@ - -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/5/13 - * description: - */ -public class DriveDetailBean implements Serializable { - private String driverVersionId; - private String driverId; - private String driverVersionCode; - private String driverVersionType; - private String driverVersionTypeDesc; - private String driverFree; - private String driverFreeDesc; - private String driverTag; - private String driverTagDesc; - private String driverVersionDesc; - private String modifyTime; - private String saleStatus; - private String saleStatusDesc; - private String driverFileUrl; - private String driverVersion; - private String downloadCount; - private String driverStatus; - private String driverStatusDesc; - private String driverMd5; - private String enable; - private boolean isExit; - /** - * 鐢ㄤ簬鍒ゆ柇褰撳墠椹卞姩鏄惁瀹夎杩� 瀹夎杩噄tem灏卞彨鍗囩骇 娌℃湁瀹夎灏卞彨瀹夎 - */ - private boolean isInstall; - - public boolean isInstall() { - return isInstall; - } - - public void setInstall(@NonNull boolean install) { - isInstall = install; - } - - public boolean isExit() { - return isExit; - } - - public void setExit(@NonNull boolean exit) { - isExit = exit; - } - - public String getDriverVersionId() { - return driverVersionId == null ? "" : driverVersionId; - } - - public void setDriverVersionId(@NonNull String driverVersionId) { - this.driverVersionId = driverVersionId; - } - - public String getDriverId() { - return driverId == null ? "" : driverId; - } - - public void setDriverId(@NonNull String driverId) { - this.driverId = driverId; - } - - public String getDriverVersionCode() { - return driverVersionCode == null ? "" : driverVersionCode; - } - - public void setDriverVersionCode(@NonNull String driverVersionCode) { - this.driverVersionCode = driverVersionCode; - } - - public String getDriverVersionType() { - return driverVersionType == null ? "" : driverVersionType; - } - - public void setDriverVersionType(@NonNull String driverVersionType) { - this.driverVersionType = driverVersionType; - } - - public String getDriverVersionTypeDesc() { - return driverVersionTypeDesc == null ? "" : driverVersionTypeDesc; - } - - public void setDriverVersionTypeDesc(@NonNull String driverVersionTypeDesc) { - this.driverVersionTypeDesc = driverVersionTypeDesc; - } - - public String getDriverFree() { - return driverFree == null ? "" : driverFree; - } - - public void setDriverFree(@NonNull String driverFree) { - this.driverFree = driverFree; - } - - public String getDriverFreeDesc() { - return driverFreeDesc == null ? "" : driverFreeDesc; - } - - public void setDriverFreeDesc(@NonNull String driverFreeDesc) { - this.driverFreeDesc = driverFreeDesc; - } - - public String getDriverTag() { - return driverTag == null ? "" : driverTag; - } - - public void setDriverTag(@NonNull String driverTag) { - this.driverTag = driverTag; - } - - public String getDriverTagDesc() { - return driverTagDesc == null ? "" : driverTagDesc; - } - - public void setDriverTagDesc(@NonNull String driverTagDesc) { - this.driverTagDesc = driverTagDesc; - } - - public String getDriverVersionDesc() { - return driverVersionDesc == null ? "" : driverVersionDesc; - } - - public void setDriverVersionDesc(@NonNull String driverVersionDesc) { - this.driverVersionDesc = driverVersionDesc; - } - - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } - - public void setModifyTime(@NonNull String modifyTime) { - this.modifyTime = modifyTime; - } - - public String getSaleStatus() { - return saleStatus == null ? "" : saleStatus; - } - - public void setSaleStatus(@NonNull String saleStatus) { - this.saleStatus = saleStatus; - } - - public String getSaleStatusDesc() { - return saleStatusDesc == null ? "" : saleStatusDesc; - } - - public void setSaleStatusDesc(@NonNull String saleStatusDesc) { - this.saleStatusDesc = saleStatusDesc; - } - - public String getDriverFileUrl() { - return driverFileUrl == null ? "" : driverFileUrl; - } - - public void setDriverFileUrl(@NonNull String driverFileUrl) { - this.driverFileUrl = driverFileUrl; - } - - public String getDriverVersion() { - return driverVersion == null ? "" : driverVersion; - } - - public void setDriverVersion(@NonNull String driverVersion) { - this.driverVersion = driverVersion; - } - - public String getDownloadCount() { - return downloadCount == null ? "" : downloadCount; - } - - public void setDownloadCount(@NonNull String downloadCount) { - this.downloadCount = downloadCount; - } - - public String getDriverStatus() { - return driverStatus == null ? "" : driverStatus; - } - - public void setDriverStatus(@NonNull String driverStatus) { - this.driverStatus = driverStatus; - } - - public String getDriverStatusDesc() { - return driverStatusDesc == null ? "" : driverStatusDesc; - } - - public void setDriverStatusDesc(@NonNull String driverStatusDesc) { - this.driverStatusDesc = driverStatusDesc; - } - - public String getDriverMd5() { - return driverMd5 == null ? "" : driverMd5; - } - - public void setDriverMd5(@NonNull String driverMd5) { - this.driverMd5 = driverMd5; - } - - public String getEnable() { - return enable == null ? "" : enable; - } - - public void setEnable(@NonNull String enable) { - this.enable = enable; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveDetailListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveDetailListBean.java deleted file mode 100644 index c325a2c..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveDetailListBean.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/5/13 - * description: - */ -public class DriveDetailListBean implements Serializable { - private List<DriveDetailBean> list = new ArrayList<>(); - private String totalCount; - private String totalPage; - private String pageNo; - private String pageSize; - - public List<DriveDetailBean> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<DriveDetailBean> list) { - this.list = list; - } - - public String getTotalCount() { - return totalCount == null ? "" : totalCount; - } - - public void setTotalCount(@NonNull String totalCount) { - this.totalCount = totalCount; - } - - public String getTotalPage() { - return totalPage == null ? "" : totalPage; - } - - public void setTotalPage(@NonNull String totalPage) { - this.totalPage = totalPage; - } - - public String getPageNo() { - return pageNo == null ? "" : pageNo; - } - - public void setPageNo(@NonNull String pageNo) { - this.pageNo = pageNo; - } - - public String getPageSize() { - return pageSize == null ? "" : pageSize; - } - - public void setPageSize(@NonNull String pageSize) { - this.pageSize = pageSize; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveTypeBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveTypeBean.java deleted file mode 100644 index f80d161..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveTypeBean.java +++ /dev/null @@ -1,132 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/5/13 - * description: - */ -public class DriveTypeBean implements Serializable { - private String driverId; - private String driverNameCn; - private String driverNameEn; - private String driverImgUrl; - private String driverTypeId; - private String driverTypeName; - private String driverCode; - private String brandId; - private String brandName; - private String modifyTime; - private String thirdDeviceState; - //缃戝叧涓槸鍚﹀凡缁忓畨瑁� - private boolean isExit; - //褰撳墠鐨勯┍鍔ㄧ増鏈� 浠庣綉鍏宠幏鍙� - private String driverCurrentVersion; - - public String getDriverCurrentVersion() { - return driverCurrentVersion == null ? "" : driverCurrentVersion; - } - - public void setDriverCurrentVersion(@NonNull String driverCurrentVersion) { - this.driverCurrentVersion = driverCurrentVersion; - } - - public boolean isExit() { - return isExit; - } - - public void setExit(@NonNull boolean exit) { - isExit = exit; - } - - public String getDriverId() { - return driverId == null ? "" : driverId; - } - - public void setDriverId(@NonNull String driverId) { - this.driverId = driverId; - } - - public String getDriverNameCn() { - return driverNameCn == null ? "" : driverNameCn; - } - - public void setDriverNameCn(@NonNull String driverNameCn) { - this.driverNameCn = driverNameCn; - } - - public String getDriverNameEn() { - return driverNameEn == null ? "" : driverNameEn; - } - - public void setDriverNameEn(@NonNull String driverNameEn) { - this.driverNameEn = driverNameEn; - } - - public String getDriverImgUrl() { - return driverImgUrl == null ? "" : driverImgUrl; - } - - public void setDriverImgUrl(@NonNull String driverImgUrl) { - this.driverImgUrl = driverImgUrl; - } - - public String getDriverTypeId() { - return driverTypeId == null ? "" : driverTypeId; - } - - public void setDriverTypeId(@NonNull String driverTypeId) { - this.driverTypeId = driverTypeId; - } - - public String getDriverTypeName() { - return driverTypeName == null ? "" : driverTypeName; - } - - public void setDriverTypeName(@NonNull String driverTypeName) { - this.driverTypeName = driverTypeName; - } - - public String getDriverCode() { - return driverCode == null ? "" : driverCode; - } - - public void setDriverCode(@NonNull String driverCode) { - this.driverCode = driverCode; - } - - public String getBrandId() { - return brandId == null ? "" : brandId; - } - - public void setBrandId(@NonNull String brandId) { - this.brandId = brandId; - } - - public String getBrandName() { - return brandName == null ? "" : brandName; - } - - public void setBrandName(@NonNull String brandName) { - this.brandName = brandName; - } - - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } - - public void setModifyTime(@NonNull String modifyTime) { - this.modifyTime = modifyTime; - } - - public String getThirdDeviceState() { - return thirdDeviceState == null ? "" : thirdDeviceState; - } - - public void setThirdDeviceState(@NonNull String thirdDeviceState) { - this.thirdDeviceState = thirdDeviceState; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveTypeListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveTypeListBean.java deleted file mode 100644 index 77625cd..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/DriveTypeListBean.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2022/5/13 - * description: - */ -public class DriveTypeListBean implements Serializable { - private List<DriveTypeBean> list = new ArrayList<>(); - private String totalCount; - private String totalPage; - private String pageNo; - private String pageSize; - - public List<DriveTypeBean> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<DriveTypeBean> list) { - this.list = list; - } - - public String getTotalCount() { - return totalCount == null ? "" : totalCount; - } - - public void setTotalCount(@NonNull String totalCount) { - this.totalCount = totalCount; - } - - public String getTotalPage() { - return totalPage == null ? "" : totalPage; - } - - public void setTotalPage(@NonNull String totalPage) { - this.totalPage = totalPage; - } - - public String getPageNo() { - return pageNo == null ? "" : pageNo; - } - - public void setPageNo(@NonNull String pageNo) { - this.pageNo = pageNo; - } - - public String getPageSize() { - return pageSize == null ? "" : pageSize; - } - - public void setPageSize(@NonNull String pageSize) { - this.pageSize = pageSize; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/EmployeeInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/EmployeeInfoBean.java deleted file mode 100644 index 3b19bfb..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/EmployeeInfoBean.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.user.bean.HDLLoginBean; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/8/21. - * 鍛樺伐淇℃伅 - */ -public class EmployeeInfoBean implements Serializable { - /// 鐢ㄦ埛鍞竴ID - private String userId; - /// 鍛樺伐鍚嶅瓧 - private String userName; - // 鍛樺伐澶村儚 - private String headIcon; - private String accountName; - private String userAccount; - - public String getAccountName() { - return accountName == null ? "" : accountName; - } - - public void setAccountName(@NonNull String accountName) { - this.accountName = accountName; - } - - public String getUserAccount() { - return userAccount == null ? "" : userAccount; - } - - public void setUserAccount(@NonNull String userAccount) { - this.userAccount = userAccount; - } - - public String getHeadIcon() { - return headIcon == null ? "" : headIcon; - } - - public void setHeadIcon(@NonNull String headIcon) { - this.headIcon = headIcon; - } - - @NonNull - public String getUserId() { - return userId == null ? "" : userId; - } - - public void setUserId(@NonNull String userId) { - this.userId = userId; - } - - @NonNull - public String getUserName() { - return userName == null ? "" : userName; - } - - public void setUserName(@NonNull String userName) { - this.userName = userName; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/HousePageRequestBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/HousePageRequestBean.java deleted file mode 100644 index 20d4f66..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/HousePageRequestBean.java +++ /dev/null @@ -1,94 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/9/21. - */ -public class HousePageRequestBean implements Serializable { - //椤圭洰缂栫爜 - private String communityCode; -// //0锛氬緟璋冭瘯 1锛氳皟璇曚腑 3锛氬緟楠屾敹 4锛氬凡浜や粯锛屼负绌哄垯涓嶈繃婊� -// private String debugStatus = "1"; - //璋冭瘯鐘舵�侀泦鍚� - private List<String> statusList = new ArrayList<>();//0锛氬緟璋冭瘯 1锛氳皟璇曚腑 3锛氬緟楠屾敹 4锛氬凡浜や粯锛屼负绌哄垯涓嶈繃婊� - - //鎴峰瀷鎴垮瀷id锛屼负绌哄垯涓嶈繃婊� - private String houseLayoutId; -// //鎴垮眿鍚嶇О - private String houseName; - //褰撳墠椤� - private int pageNo = 1; - //椤甸潰澶у皬 - private int pageSize = 10; - //璋冭瘯鍛樺伐璐﹀彿id - private String debugUserId; - - @NonNull - public String getCommunityCode() { - return communityCode == null ? "" : communityCode; - } - - public void setCommunityCode(@NonNull String communityCode) { - this.communityCode = communityCode; - } - - @NonNull - public List<String> getStatusList() { - if (statusList == null) { - return new ArrayList<>(); - } - return statusList; - } - - public void setStatusList(@NonNull List<String> statusList) { - this.statusList = statusList; - } - - @NonNull - public String getHouseLayoutId() { - return houseLayoutId == null ? "" : houseLayoutId; - } - - public void setHouseLayoutId(@NonNull String houseLayoutId) { - this.houseLayoutId = houseLayoutId; - } - - @NonNull - public String getHouseName() { - return houseName == null ? "" : houseName; - } - - public void setHouseName(@NonNull String houseName) { - this.houseName = houseName; - } - - public int getPageNo() { - return pageNo; - } - - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } - - @NonNull - public String getDebugUserId() { - return debugUserId == null ? "" : debugUserId; - } - - public void setDebugUserId(@NonNull String debugUserId) { - this.debugUserId = debugUserId; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceBrandBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceBrandBean.java deleted file mode 100644 index 70a22ec..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceBrandBean.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/3/6 - * description: - */ -public class IrDeviceBrandBean implements Serializable { - private String id; - private String brandName; - private String deviceTypeId; - - public IrDeviceBrandBean(String id, String brandName, String deviceTypeId) { - this.id = id; - this.brandName = brandName; - this.deviceTypeId = deviceTypeId; - } - - public String getId() { - return id == null ? "" : id; - } - - public void setId(@NonNull String id) { - this.id = id; - } - - public String getBrandName() { - return brandName == null ? "" : brandName; - } - - public void setBrandName(@NonNull String brandName) { - this.brandName = brandName; - } - - public String getDeviceTypeId() { - return deviceTypeId == null ? "" : deviceTypeId; - } - - public void setDeviceTypeId(@NonNull String deviceTypeId) { - this.deviceTypeId = deviceTypeId; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceCodeBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceCodeBean.java deleted file mode 100644 index a7fdb9d..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceCodeBean.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/3/6 - * description: - */ -public class IrDeviceCodeBean implements Serializable { - private String irCode; - private String brandId; - private String irIndex; - - public IrDeviceCodeBean(String irCode, String brandId, String irIndex) { - this.irCode = irCode; - this.brandId = brandId; - this.irIndex = irIndex; - } - - public String getIrCode() { - return irCode == null ? "" : irCode; - } - - public void setIrCode(@NonNull String irCode) { - this.irCode = irCode; - } - - public String getBrandId() { - return brandId == null ? "" : brandId; - } - - public void setBrandId(@NonNull String brandId) { - this.brandId = brandId; - } - - public String getIrIndex() { - return irIndex == null ? "" : irIndex; - } - - public void setIrIndex(@NonNull String irIndex) { - this.irIndex = irIndex; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceTypeBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceTypeBean.java deleted file mode 100644 index 8fc35b6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/IrDeviceTypeBean.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by Zoro - * Created on 2023/3/6 - * description: - */ -public class IrDeviceTypeBean implements Serializable { - private String id; - private String deviceType; - - public IrDeviceTypeBean(String id, String deviceType) { - this.id = id; - this.deviceType = deviceType; - } - - public String getId() { - return id == null ? "" : id; - } - - public void setId(@NonNull String id) { - this.id = id; - } - - public String getDeviceType() { - return deviceType == null ? "" : deviceType; - } - - public void setDeviceType(@NonNull String deviceType) { - this.deviceType = deviceType; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/NewProjectRequestBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/NewProjectRequestBean.java deleted file mode 100644 index bfb07b7..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/NewProjectRequestBean.java +++ /dev/null @@ -1,110 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/9/21. - * 椤圭洰璇︾粏淇℃伅 - */ -public class NewProjectRequestBean implements Serializable { - private String address;//璇︾粏鍦板潃 - private String communityName;//椤圭洰鍚嶇О - private String companyId;//鍏徃ID - private String debugEndDate;//璋冭瘯缁撴潫鏃ユ湡 - private String debugStartDate;//璋冭瘯寮�濮嬫棩鏈� - private String debugUserId;//璋冭瘯鍛樺伐璐﹀彿id - private ProjectLocationBean location;//鎵�鍦ㄥ湴鍖� - private String projectType;//0锛氬灞呴」鐩� 1锛氬湴浜ч」鐩� 2锛氬叕寤洪」鐩� 3锛氶厭搴楅」鐩�,鍙敤鍊�:Home,RealEstate,PublicBuilding,Hotel - private String protocolType;//BUSPRO,KNX,ZIGBEE - private Boolean isMyProjects = true;//鏄惁鎴戠殑椤圭洰 - - @NonNull - public String getAddress() { - return address == null ? "" : address; - } - - public void setAddress(@NonNull String address) { - this.address = address; - } - - @NonNull - public String getCommunityName() { - return communityName == null ? "" : communityName; - } - - public void setCommunityName(@NonNull String communityName) { - this.communityName = communityName; - } - - @NonNull - public String getCompanyId() { - return companyId == null ? "" : companyId; - } - - public void setCompanyId(@NonNull String companyId) { - this.companyId = companyId; - } - - @NonNull - public String getDebugEndDate() { - return debugEndDate == null ? "" : debugEndDate; - } - - public void setDebugEndDate(@NonNull String debugEndDate) { - this.debugEndDate = debugEndDate; - } - - @NonNull - public String getDebugStartDate() { - return debugStartDate == null ? "" : debugStartDate; - } - - public void setDebugStartDate(@NonNull String debugStartDate) { - this.debugStartDate = debugStartDate; - } - - @NonNull - public String getDebugUserId() { - return debugUserId == null ? "" : debugUserId; - } - - public void setDebugUserId(@NonNull String debugUserId) { - this.debugUserId = debugUserId; - } - - public ProjectLocationBean getLocation() { - return location; - } - - public void setLocation(ProjectLocationBean location) { - this.location = location; - } - - @NonNull - public String getProjectType() { - return projectType == null ? "" : projectType; - } - - public void setProjectType(@NonNull String projectType) { - this.projectType = projectType; - } - - @NonNull - public String getProtocolType() { - return protocolType == null ? "" : protocolType; - } - - public void setProtocolType(@NonNull String protocolType) { - this.protocolType = protocolType; - } - - public Boolean getIsMyProjects() { - return isMyProjects; - } - - public void setIsMyProjects(Boolean myProjects) { - isMyProjects = myProjects; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectHouseBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectHouseBean.java deleted file mode 100644 index 7be78d3..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectHouseBean.java +++ /dev/null @@ -1,321 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -import androidx.annotation.NonNull; - -/** - * Created by jlchen on 12/9/21. - * 椤圭洰浣忓畢璇︾粏淇℃伅 - */ -public class ProjectHouseBean implements Serializable { - private String houseId;//鎴垮眿ID - private String buildName;//妤兼爧鍚嶇О - private String buildNum;//妤兼爧鍙� - /** - * To_Be_Debugged(0, "寰呰皟璇�"), - * Debugging(1, "璋冭瘯涓�"), - * To_Be_Accepted(2, "寰呴獙鏀�"), - * WAIT_DELIVERED(3, "璋冭瘯瀹屾垚"), - * Delivered(4, "宸蹭氦浠�"), - * INITIAL_TATE(5,"鍒濆鎬�"), - * ACCEPTANCE(6,"楠屾敹"), - * SECONDARY_DEBUGGIN(7,"浜屾璋冭瘯"), - */ - private int debugStatus;//0锛氬緟璋冭瘯 1锛氳皟璇曚腑 2锛氬緟楠屾敹 3锛氬凡瀹屾垚 4锛氬凡浜や粯,5锛氬垵濮嬫��,6: 楠屾敹,7: 浜屾璋冭瘯 - private String houseFullName;//浣忓畢鍏ㄧ▼ - private String houseLayoutId;//鎴垮瀷鎴栨埛鍨婭D - private String houseLayoutName;//鎴垮瀷鎴栨埛鍨嬪悕绉� - private String houseDesc;//浣忓畢鎻忚堪 - private String houseName;//浣忓畢鍚嶇О - private String houseNo;//鎴峰彿 - private String housePhoneNumber;//搴ф満 - private String unitName;//鍗曞厓鍚嶇О - private String unitNum;//鍗曞厓鍙� - private String floorName;//妤煎眰鍚嶇О - private String floorNum;//妤煎眰鍙� - private String userId;//璋冭瘯鍛樺伐璐﹀彿ID - private String userName;//璋冭瘯鍛樺伐璐﹀彿鍚嶇О -// private String spaceInfo; - private String debugTime;//璋冭瘯鏃堕棿 - private String backupTime;//澶囦唤鏃堕棿 - private String configUrl;//璋冭瘯杞欢閰嶇疆url - private String qrCode;//浜岀淮鐮佸浘鐗囧湴鍧� - private String templateId;//妯℃澘id - private String communityName; - private String communityCode; - private String localSecret;//鏈湴閫氫俊鍔犲瘑瀵嗛挜 2021-12-31 鏂板 - private boolean showChoose = false;//鏄惁鏄剧ず鎵归噺鐨勯�夋嫨 - private boolean isChoose = false;//鏄惁閫変腑 - /** - * 鏄惁鍒涘缓瀹跺眳椤圭洰 - */ - private boolean homeDataSync = false; - - private boolean hasUploadDevice = false;//鏄惁宸茬粡澶囦唤鍒颁簯绔� - private String uploadDeviceTime;//澶囦唤鏃堕棿 - - public boolean isHomeDataSync() { - return homeDataSync; - } - - public void setHomeDataSync(@NonNull boolean homeDataSync) { - this.homeDataSync = homeDataSync; - } - - public String getCommunityCode() { - return communityCode == null ? "" : communityCode; - } - - public void setCommunityCode(@NonNull String communityCode) { - this.communityCode = communityCode; - } - - public boolean isHasUploadDevice() { - return hasUploadDevice; - } - - public void setHasUploadDevice(boolean hasUploadDevice) { - this.hasUploadDevice = hasUploadDevice; - } - - public String getUploadDeviceTime() { - return uploadDeviceTime == null ? "" : uploadDeviceTime; - } - - public void setUploadDeviceTime(String uploadDeviceTime) { - this.uploadDeviceTime = uploadDeviceTime; - } - - public boolean isShowChoose() { - return showChoose; - } - - public void setShowChoose(@NonNull boolean showChoose) { - this.showChoose = showChoose; - } - - public boolean isChoose() { - return isChoose; - } - - public void setChoose(@NonNull boolean choose) { - isChoose = choose; - } - - @NonNull - public String getHouseId() { - return houseId == null ? "" : houseId; - } - - public void setHouseId(@NonNull String houseId) { - this.houseId = houseId; - } - - @NonNull - public String getBuildName() { - return buildName == null ? "" : buildName; - } - - public void setBuildName(@NonNull String buildName) { - this.buildName = buildName; - } - - @NonNull - public String getBuildNum() { - return buildNum == null ? "" : buildNum; - } - - public void setBuildNum(@NonNull String buildNum) { - this.buildNum = buildNum; - } - - public int getDebugStatus() { - return debugStatus; - } - - public void setDebugStatus(int debugStatus) { - this.debugStatus = debugStatus; - } - - @NonNull - public String getHouseFullName() { - return houseFullName == null ? "" : houseFullName; - } - - public void setHouseFullName(@NonNull String houseFullName) { - this.houseFullName = houseFullName; - } - - @NonNull - public String getHouseLayoutId() { - return houseLayoutId == null ? "" : houseLayoutId; - } - - public void setHouseLayoutId(@NonNull String houseLayoutId) { - this.houseLayoutId = houseLayoutId; - } - - @NonNull - public String getHouseLayoutName() { - return houseLayoutName == null ? "" : houseLayoutName; - } - - public void setHouseLayoutName(@NonNull String houseLayoutName) { - this.houseLayoutName = houseLayoutName; - } - - @NonNull - public String getHouseDesc() { - return houseDesc == null ? "" : houseDesc; - } - - public void setHouseDesc(@NonNull String houseDesc) { - this.houseDesc = houseDesc; - } - - @NonNull - public String getHouseName() { - return houseName == null ? "" : houseName; - } - - public void setHouseName(@NonNull String houseName) { - this.houseName = houseName; - } - - @NonNull - public String getHouseNo() { - return houseNo == null ? "" : houseNo; - } - - public void setHouseNo(@NonNull String houseNo) { - this.houseNo = houseNo; - } - - @NonNull - public String getHousePhoneNumber() { - return housePhoneNumber == null ? "" : housePhoneNumber; - } - - public void setHousePhoneNumber(@NonNull String housePhoneNumber) { - this.housePhoneNumber = housePhoneNumber; - } - - @NonNull - public String getUnitName() { - return unitName == null ? "" : unitName; - } - - public void setUnitName(@NonNull String unitName) { - this.unitName = unitName; - } - - @NonNull - public String getUnitNum() { - return unitNum == null ? "" : unitNum; - } - - public void setUnitNum(@NonNull String unitNum) { - this.unitNum = unitNum; - } - - @NonNull - public String getFloorName() { - return floorName == null ? "" : floorName; - } - - public void setFloorName(@NonNull String floorName) { - this.floorName = floorName; - } - - @NonNull - public String getFloorNum() { - return floorNum == null ? "" : floorNum; - } - - public void setFloorNum(@NonNull String floorNum) { - this.floorNum = floorNum; - } - - @NonNull - public String getUserId() { - return userId == null ? "" : userId; - } - - public void setUserId(@NonNull String userId) { - this.userId = userId; - } - - @NonNull - public String getUserName() { - return userName == null ? "" : userName; - } - - public void setUserName(@NonNull String userName) { - this.userName = userName; - } - - @NonNull - public String getDebugTime() { - return debugTime == null ? "" : debugTime; - } - - public void setDebugTime(@NonNull String debugTime) { - this.debugTime = debugTime; - } - - @NonNull - public String getConfigUrl() { - return configUrl == null ? "" : configUrl; - } - - public void setConfigUrl(@NonNull String configUrl) { - this.configUrl = configUrl; - } - - @NonNull - public String getQrCode() { - return qrCode == null ? "" : qrCode; - } - - public void setQrCode(@NonNull String qrCode) { - this.qrCode = qrCode; - } - - @NonNull - public String getTemplateId() { - return templateId == null ? "" : templateId; - } - - public void setTemplateId(@NonNull String templateId) { - this.templateId = templateId; - } - - @NonNull - public String getCommunityName() { - return communityName == null ? "" : communityName; - } - - public void setCommunityName(@NonNull String communityName) { - this.communityName = communityName; - } - - public String getBackupTime() { - return backupTime == null ? "" : backupTime; - } - - public void setBackupTime(String backupTime) { - this.backupTime = backupTime; - } - - @NonNull - public String getLocalSecret() { - return localSecret == null ? "" : localSecret; - } - - public void setLocalSecret(@NonNull String localSecret) { - this.localSecret = localSecret; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectHouseListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectHouseListBean.java deleted file mode 100644 index 26539f0..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectHouseListBean.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.core.bean.BasePageInfoBean; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/9/21. - * 浣忓畢鍒楄〃瀵硅薄 - */ -public class ProjectHouseListBean extends BasePageInfoBean { - private List<ProjectHouseBean> list = new ArrayList<>(); - - @NonNull - public List<ProjectHouseBean> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<ProjectHouseBean> list) { - this.list = list; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectInfoBean.java deleted file mode 100644 index 40132a9..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectInfoBean.java +++ /dev/null @@ -1,317 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/9/21. - * 椤圭洰璇︾粏淇℃伅 - */ -public class ProjectInfoBean implements Serializable { - - private String communityId;//椤圭洰ID涓婚敭 - private String projectType;//0锛氬灞呴」鐩� 1锛氬湴浜ч」鐩� 2锛氬叕寤洪」鐩� 3锛氶厭搴楅」鐩�,鍙敤鍊�:Home,RealEstate,PublicBuilding,Hotel - private String projectTypeName;//椤圭洰绫诲瀷鍚嶇О - private String projectTypeSub;//椤圭洰瀛愮被鍨� - private String projectTypeSubName;//椤圭洰瀛愮被鍨嬪悕绉� - private String communityCode;//椤圭洰缂栫爜 - private String communityName;//椤圭洰鍚嶇О - private String protocolType;//0锛歜uspro 1锛歬nx 2锛歾igbee,鍙敤鍊�:BUSPRO,KNX,ZIGBEE - /** - * To_Be_Debugged(0, "寰呰皟璇�"), - * Debugging(1, "璋冭瘯涓�"), - * To_Be_Accepted(2, "寰呴獙鏀�"), - * WAIT_DELIVERED(3, "璋冭瘯瀹屾垚"), - * Delivered(4, "宸蹭氦浠�"), - * INITIAL_TATE(5,"鍒濆鎬�"), - * ACCEPTANCE(6,"楠屾敹"), - * SECONDARY_DEBUGGIN(7,"浜屾璋冭瘯"), - */ - private String debugStatus;//0锛氬緟璋冭瘯 1锛氳皟璇曚腑 2锛氬緟楠屾敹 3锛氬凡瀹屾垚 4锛氬凡浜や粯,5锛氬垵濮嬫��,6: 楠屾敹,7: 浜屾璋冭瘯 - private ProjectLocationBean location;//鎵�鍦ㄥ湴鍖� - private String address;//璇︾粏鍦板潃 - private String debugUserName;//璋冭瘯鍛樺伐鍚嶇О - private String debugUserId;//璋冭瘯鍛樺伐璐﹀彿id - private String companyName;//鍏徃鍚嶇О - private String companyId;//鍏徃ID - private String businessType;//涓氬姟绫诲瀷锛圫IGNED_PROJECT:绛剧害椤圭洰锛� DEBUG_CENTER:璋冭瘯涓績锛� - private String businessTypeName;//涓氬姟绫诲瀷鍚嶇О - private Boolean isMyCompanyProject;//鏄惁鏄嚜宸卞叕鍙哥殑椤圭洰 true鏌ヨ嚜宸遍」鐩� - private String businessStatus;//涓氬姟绫诲瀷锛堢绾﹂」鐩�佽皟璇曢」鐩級 - private String debugStartDate;//璋冭瘯寮�濮嬫棩鏈� - private String debugEndDate;//璋冭瘯缁撴潫鏃ユ湡 - private String houseCount;//椤圭洰涓嬫埧灞嬫�绘暟 - private String deliveryHouseCount;//椤圭洰涓嬫埧灞嬩氦浠樻�绘暟 - private String residueDay;//鍓╀綑澶╂暟 - private List<String> houseIds = new ArrayList<>();//浜屾璋冭瘯杩斿洖鐨� - private String houseId;//瀹跺眳鍜屽叕寤烘墠鏈� 浣忓畢ID - private String houseName;//瀹跺眳鍜屽叕寤烘墠鏈� 鎴垮眿鍚嶅瓧 2021-12-20 鏂板 - private String localSecret;//瀹跺眳鍜屽叕寤烘墠鏈� 鏈湴閫氫俊鍔犲瘑瀵嗛挜 2021-12-31 鏂板 - /** - * 鏄惁鍒涘缓瀹跺眳椤圭洰 - */ - private boolean homeDataSync = false; - - public boolean isHomeDataSync() { - return homeDataSync; - } - - public void setHomeDataSync(@NonNull boolean homeDataSync) { - this.homeDataSync = homeDataSync; - } - - public List<String> getHouseIds() { - if (houseIds == null) { - return houseIds = new ArrayList<>(); - } - return houseIds; - } - - public void setHouseIds(@NonNull List<String> houseIds) { - this.houseIds = houseIds; - } - - @NonNull - public String getCommunityId() { - return communityId == null ? "" : communityId; - } - - public void setCommunityId(@NonNull String communityId) { - this.communityId = communityId; - } - - @NonNull - public String getProjectType() { - return projectType == null ? "" : projectType; - } - - public void setProjectType(@NonNull String projectType) { - this.projectType = projectType; - } - - @NonNull - public String getProjectTypeName() { - return projectTypeName == null ? "" : projectTypeName; - } - - public void setProjectTypeName(@NonNull String projectTypeName) { - this.projectTypeName = projectTypeName; - } - - @NonNull - public String getProjectTypeSub() { - return projectTypeSub == null ? "" : projectTypeSub; - } - - public void setProjectTypeSub(@NonNull String projectTypeSub) { - this.projectTypeSub = projectTypeSub; - } - - @NonNull - public String getProjectTypeSubName() { - return projectTypeSubName == null ? "" : projectTypeSubName; - } - - public void setProjectTypeSubName(@NonNull String projectTypeSubName) { - this.projectTypeSubName = projectTypeSubName; - } - - @NonNull - public String getCommunityCode() { - return communityCode == null ? "" : communityCode; - } - - public void setCommunityCode(@NonNull String communityCode) { - this.communityCode = communityCode; - } - - @NonNull - public String getCommunityName() { - return communityName == null ? "" : communityName; - } - - public void setCommunityName(@NonNull String communityName) { - this.communityName = communityName; - } - - @NonNull - public String getProtocolType() { - return protocolType == null ? "" : protocolType; - } - - public void setProtocolType(@NonNull String protocolType) { - this.protocolType = protocolType; - } - - @NonNull - public String getDebugStatus() { - return debugStatus == null ? "" : debugStatus; - } - - public void setDebugStatus(@NonNull String debugStatus) { - this.debugStatus = debugStatus; - } - - public ProjectLocationBean getLocation() { - return location; - } - - public void setLocation(ProjectLocationBean location) { - this.location = location; - } - - @NonNull - public String getAddress() { - return address == null ? "" : address; - } - - public void setAddress(@NonNull String address) { - this.address = address; - } - - @NonNull - public String getDebugUserName() { - return debugUserName == null ? "" : debugUserName; - } - - public void setDebugUserName(@NonNull String debugUserName) { - this.debugUserName = debugUserName; - } - - @NonNull - public String getDebugUserId() { - return debugUserId == null ? "" : debugUserId; - } - - public void setDebugUserId(@NonNull String debugUserId) { - this.debugUserId = debugUserId; - } - - @NonNull - public String getCompanyName() { - return companyName == null ? "" : companyName; - } - - public void setCompanyName(@NonNull String companyName) { - this.companyName = companyName; - } - - @NonNull - public String getCompanyId() { - return companyId == null ? "" : companyId; - } - - public void setCompanyId(@NonNull String companyId) { - this.companyId = companyId; - } - - @NonNull - public String getHouseId() { - return houseId == null ? "" : houseId; - } - - public void setHouseId(@NonNull String houseId) { - this.houseId = houseId; - } - - @NonNull - public String getBusinessType() { - return businessType == null ? "" : businessType; - } - - public void setBusinessType(@NonNull String businessType) { - this.businessType = businessType; - } - - @NonNull - public String getBusinessTypeName() { - return businessTypeName == null ? "" : businessTypeName; - } - - public void setBusinessTypeName(@NonNull String businessTypeName) { - this.businessTypeName = businessTypeName; - } - - public Boolean getIsMyCompanyProject() { - return isMyCompanyProject; - } - - public void setIsMyCompanyProject(Boolean myCompanyProject) { - isMyCompanyProject = myCompanyProject; - } - - @NonNull - public String getBusinessStatus() { - return businessStatus == null ? "" : businessStatus; - } - - public void setBusinessStatus(@NonNull String businessStatus) { - this.businessStatus = businessStatus; - } - - @NonNull - public String getDebugStartDate() { - return debugStartDate == null ? "" : debugStartDate; - } - - public void setDebugStartDate(@NonNull String debugStartDate) { - this.debugStartDate = debugStartDate; - } - - @NonNull - public String getDebugEndDate() { - return debugEndDate == null ? "" : debugEndDate; - } - - public void setDebugEndDate(@NonNull String debugEndDate) { - this.debugEndDate = debugEndDate; - } - - @NonNull - public String getHouseCount() { - return houseCount == null ? "" : houseCount; - } - - public void setHouseCount(@NonNull String houseCount) { - this.houseCount = houseCount; - } - - @NonNull - public String getDeliveryHouseCount() { - return deliveryHouseCount == null ? "" : deliveryHouseCount; - } - - public void setDeliveryHouseCount(@NonNull String deliveryHouseCount) { - this.deliveryHouseCount = deliveryHouseCount; - } - - @NonNull - public String getResidueDay() { - return residueDay == null ? "" : residueDay; - } - - public void setResidueDay(@NonNull String residueDay) { - this.residueDay = residueDay; - } - - @NonNull - public String getHouseName() { - return houseName == null ? "" : houseName; - } - - public void setHouseName(@NonNull String houseName) { - this.houseName = houseName; - } - - @NonNull - public String getLocalSecret() { - return localSecret == null ? "" : localSecret; - } - - public void setLocalSecret(@NonNull String localSecret) { - this.localSecret = localSecret; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectInfoListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectInfoListBean.java deleted file mode 100644 index 2d99f61..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectInfoListBean.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.core.bean.BasePageInfoBean; - -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/9/21. - * 椤圭洰鍒楄〃瀵硅薄 - */ -public class ProjectInfoListBean extends BasePageInfoBean { - - private List<ProjectInfoBean> list = new ArrayList<>(); - - @NonNull - public List<ProjectInfoBean> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(@NonNull List<ProjectInfoBean> list) { - this.list = list; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectLocationBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectLocationBean.java deleted file mode 100644 index f34e2f3..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/ProjectLocationBean.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/9/21. - */ -public class ProjectLocationBean implements Serializable { - private String cityName;//甯傚悕绉� - private String cityCode;//甯傜紪鐮� - private String provinceCode;//鐪佺紪鐮� - private String provinceName;//鐪佸悕绉� - private String nationCode;//鍥藉缂栫爜 - private String nationName;//鍥藉鍚嶇О - - @NonNull - public String getCityName() { - return cityName == null ? "" : cityName; - } - - public void setCityName(@NonNull String cityName) { - this.cityName = cityName; - } - - @NonNull - public String getCityCode() { - return cityCode == null ? "" : cityCode; - } - - public void setCityCode(@NonNull String cityCode) { - this.cityCode = cityCode; - } - - @NonNull - public String getProvinceCode() { - return provinceCode == null ? "" : provinceCode; - } - - public void setProvinceCode(@NonNull String provinceCode) { - this.provinceCode = provinceCode; - } - - @NonNull - public String getProvinceName() { - return provinceName == null ? "" : provinceName; - } - - public void setProvinceName(@NonNull String provinceName) { - this.provinceName = provinceName; - } - - @NonNull - public String getNationCode() { - return nationCode == null ? "" : nationCode; - } - - public void setNationCode(@NonNull String nationCode) { - this.nationCode = nationCode; - } - - @NonNull - public String getNationName() { - return nationName == null ? "" : nationName; - } - - public void setNationName(@NonNull String nationName) { - this.nationName = nationName; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/PushNoticeInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/PushNoticeInfo.java deleted file mode 100644 index 12b2b46..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/bean/PushNoticeInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.hdl.linkpm.sdk.project.bean; - -import java.io.Serializable; - -/** - * Created by Zoro - * Created on 2021/6/8 - * description: - */ -public class PushNoticeInfo implements Serializable { - private String notificationId; - private String notificationContent; - private String msgId; - private String appkey; - private String notificationAlertType; - private String notificationTitle; - private String notificationExtras; - - public String getNotificationId() { - return notificationId == null ? "" : notificationId; - } - - public void setNotificationId(String notificationId) { - this.notificationId = notificationId; - } - - public String getNotificationContent() { - return notificationContent == null ? "" : notificationContent; - } - - public void setNotificationContent(String notificationContent) { - this.notificationContent = notificationContent; - } - - public String getMsgId() { - return msgId == null ? "" : msgId; - } - - public void setMsgId(String msgId) { - this.msgId = msgId; - } - - public String getAppkey() { - return appkey == null ? "" : appkey; - } - - public void setAppkey(String appkey) { - this.appkey = appkey; - } - - public String getNotificationAlertType() { - return notificationAlertType == null ? "" : notificationAlertType; - } - - public void setNotificationAlertType(String notificationAlertType) { - this.notificationAlertType = notificationAlertType; - } - - public String getNotificationTitle() { - return notificationTitle == null ? "" : notificationTitle; - } - - public void setNotificationTitle(String notificationTitle) { - this.notificationTitle = notificationTitle; - } - - public String getNotificationExtras() { - return notificationExtras; - } - - public void setNotificationExtras(String notificationExtras) { - this.notificationExtras = notificationExtras; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverDetailListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverDetailListCallBack.java deleted file mode 100644 index e4b9813..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverDetailListCallBack.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hdl.linkpm.sdk.project.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.project.bean.DriveDetailListBean; -import com.hdl.linkpm.sdk.project.bean.DriveTypeListBean; - -/** - * Created by zoro on 12/2/21. - */ -public interface DriverDetailListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(DriveDetailListBean bean); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverDownLoadCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverDownLoadCallBack.java deleted file mode 100644 index 7f650e9..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverDownLoadCallBack.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hdl.linkpm.sdk.project.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.project.bean.DriveDetailListBean; - -import okhttp3.ResponseBody; - -/** - * Created by zoro on 12/2/21. - */ -public interface DriverDownLoadCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(ResponseBody responseBody); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverTypeListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverTypeListCallBack.java deleted file mode 100644 index 7c3daaf..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/DriverTypeListCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.project.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.project.bean.DriveTypeListBean; -import com.hdl.linkpm.sdk.project.bean.EmployeeInfoBean; - -import java.util.List; - -/** - * Created by zoro on 12/2/21. - */ -public interface DriverTypeListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(DriveTypeListBean bean); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IEmployeeInfoCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IEmployeeInfoCallBack.java deleted file mode 100644 index 6d0041e..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IEmployeeInfoCallBack.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hdl.linkpm.sdk.project.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.project.bean.EmployeeInfoBean; - -import java.util.List; - -/** - * Created by jlchen on 12/2/21. - */ -public interface IEmployeeInfoCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<EmployeeInfoBean> list); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IProjectHouseListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IProjectHouseListCallBack.java deleted file mode 100644 index 1c7dfc2..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IProjectHouseListCallBack.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.hdl.linkpm.sdk.project.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.project.bean.ProjectHouseListBean; -import com.hdl.linkpm.sdk.project.bean.ProjectInfoListBean; - -/** - * Created by jlchen on 12/2/21. - */ -public interface IProjectHouseListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(ProjectHouseListBean bean); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IProjectInfoListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IProjectInfoListCallBack.java deleted file mode 100644 index 0c939e6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/callback/IProjectInfoListCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.project.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.project.bean.EmployeeInfoBean; -import com.hdl.linkpm.sdk.project.bean.ProjectInfoListBean; - -import java.util.List; - -/** - * Created by jlchen on 12/2/21. - */ -public interface IProjectInfoListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(ProjectInfoListBean bean); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/controller/HDLPMProjectController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/controller/HDLPMProjectController.java deleted file mode 100644 index 43dbbc8..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/controller/HDLPMProjectController.java +++ /dev/null @@ -1,1092 +0,0 @@ -package com.hdl.linkpm.sdk.project.controller; - -import android.text.TextUtils; - - -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.core.api.HDLCloudProjectApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.interceptor.HDLSmartHeader; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.project.bean.DriveDetailListBean; -import com.hdl.linkpm.sdk.project.bean.DriveTypeListBean; -import com.hdl.linkpm.sdk.project.bean.EmployeeInfoBean; -import com.hdl.linkpm.sdk.project.bean.HousePageRequestBean; -import com.hdl.linkpm.sdk.project.bean.IrDeviceBrandBean; -import com.hdl.linkpm.sdk.project.bean.IrDeviceCodeBean; -import com.hdl.linkpm.sdk.project.bean.IrDeviceTypeBean; -import com.hdl.linkpm.sdk.project.bean.ProjectHouseListBean; -import com.hdl.linkpm.sdk.project.bean.NewProjectRequestBean; -import com.hdl.linkpm.sdk.project.bean.ProjectInfoListBean; -import com.hdl.linkpm.sdk.project.callback.DriverDetailListCallBack; -import com.hdl.linkpm.sdk.project.callback.DriverDownLoadCallBack; -import com.hdl.linkpm.sdk.project.callback.DriverTypeListCallBack; -import com.hdl.linkpm.sdk.project.callback.IEmployeeInfoCallBack; -import com.hdl.linkpm.sdk.project.callback.IProjectHouseListCallBack; -import com.hdl.linkpm.sdk.project.callback.IProjectInfoListCallBack; -import com.hdl.linkpm.sdk.user.HDLLinkPMUser; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.functions.Consumer; -import okhttp3.ResponseBody; - -/** - * Created by jlchen on 12/8/21. - * 椤圭洰绠$悊鐩稿叧鐨勭綉缁滆姹� - */ -public class HDLPMProjectController { - /** - * instance - */ - private volatile static HDLPMProjectController instance; - - /** - * getInstance - * - * @return HDLProjectController - */ - public static synchronized HDLPMProjectController getInstance() { - if (instance == null) { - synchronized (HDLPMProjectController.class) { - if (instance == null) { - instance = new HDLPMProjectController(); - } - } - } - return instance; - } - - /** - * 鑾峰彇鎸囧畾鍏徃鍛樺伐鍒楄〃 鏀寔鍚嶇О妯$硦鏌ヨ - * - * @param companyId 鍏徃ID - * @param userName 鍚嶇О妯$硦鏌ヨ - * @param callBack - * @return - */ - public Disposable getDebuggerList(String companyId, String userName, IEmployeeInfoCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_DEBUGGER_GET); - JsonObject json = new JsonObject(); - json.addProperty("companyId", companyId); - json.addProperty("userName", userName); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<EmployeeInfoBean>>() { - @Override - public void onResponse(List<EmployeeInfoBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 娣诲姞璋冭瘯浜哄憳銆佽浆绉昏皟璇曚汉鍛� - * - * @param houseId 浣忓畢id - * @param userId 鐢ㄦ埛id - * @param callBack - * @return - */ - public Disposable changeHomeDebugger(String houseId, String userId, IDefaultCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_DEBUGGER_ADD); - JsonObject json = new JsonObject(); - json.addProperty("houseId", houseId); - json.addProperty("userId", userId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鎵归噺娣诲姞璋冭瘯浜哄憳銆佽浆绉昏皟璇曚汉鍛� - * - * @param houseIds 浣忓畢id 鍒楄〃 - * @param userId 鐢ㄦ埛id - * @param communityCode 绀惧尯code - * @param callBack - * @return - */ - public Disposable batchChangeHomeDebugger(List<String> houseIds, String userId, String communityCode, IDefaultCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_DEBUGGER_BATCHADD); - JsonObject json = new JsonObject(); - json.add("houseIds", HDLGsonUtils.toJsonArray(houseIds)); - json.addProperty("userId", userId); - json.addProperty("communityCode", communityCode); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /******************************缃戝叧椹卞姩******************************/ - /** - * 鏂板缓椤圭洰 - * - * @param callBack - * @return - */ - public Disposable driverList(String driverTypeId, DriverTypeListCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_GET_DRIVERLIST); - JsonObject json = new JsonObject(); - json.addProperty("driverTypeId", driverTypeId); - json.addProperty("pageNo", "1"); - json.addProperty("pageSize", "100"); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<DriveTypeListBean>() { - @Override - public void onResponse(DriveTypeListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鏂板缓椤圭洰 - * - * @param callBack - * @return - */ - public Disposable versionList(String driverId, DriverDetailListCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_GET_VERSIONLIST); - JsonObject json = new JsonObject(); - json.addProperty("driverId", driverId); - json.addProperty("pageNo", "1"); - json.addProperty("pageSize", "100"); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<DriveDetailListBean>() { - @Override - public void onResponse(DriveDetailListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鍒楄〃 - * - * @param callBack - * @return - */ - public Disposable getIrDeviceTypeList(String deviceType, IResponseCallBack<List<IrDeviceTypeBean>> callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_GET_IR_DEVICETYPELIST); - JsonObject json = new JsonObject(); - if (!TextUtils.isEmpty(deviceType)) { - json.addProperty("deviceType", deviceType); - } - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<IrDeviceTypeBean>>() { - @Override - public void onResponse(List<IrDeviceTypeBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鐨勫搧鐗屽垪琛� - * - * @param callBack - * @return - */ - public Disposable getIrDeviceBrandList(String deviceTypeId, IResponseCallBack<List<IrDeviceBrandBean>> callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_GET_IR_DEVICEBRANDLIST); - JsonObject json = new JsonObject(); - json.addProperty("deviceTypeId", deviceTypeId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<IrDeviceBrandBean>>() { - @Override - public void onResponse(List<IrDeviceBrandBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鏌ヨ绾㈠璁惧绫诲瀷鐨勫搧鐗岀孩澶栫爜搴撳垪琛� - * - * @param callBack - * @return - */ - public Disposable getIrDeviceCodeList(String brandId, IResponseCallBack<List<IrDeviceCodeBean>> callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_GET_IR_DEVICECODELIST); - JsonObject json = new JsonObject(); - json.addProperty("brandId", brandId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<IrDeviceCodeBean>>() { - @Override - public void onResponse(List<IrDeviceCodeBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - - /** - * 涓嬭浇椹卞姩 - * - * @param callBack - * @return - */ - public Disposable downLoadDriver(String url, DriverDownLoadCallBack callBack) { - return HxHttp.builder() - .url(url) - .headers(HDLSmartHeader.IGNORE_SIGN_HEADER, 1) - .build() - .download() - .subscribe(new Consumer<ResponseBody>() { - @Override - public void accept(ResponseBody responseBody) throws Exception { - //缃戠粶璇锋眰鎴愬姛锛岃鍙栨枃浠朵繚瀛樺埌sd鍗� - callBack.onSuccess(responseBody); - } - }, new Consumer<Throwable>() { - @Override - public void accept(Throwable throwable) throws Exception { - /** - * 缃戠粶璇锋眰澶辫触 - * 鍏蜂綋鍙互鑷繁瀹炵幇 - */ - HDLExceptionSubmitUtils.submit(url, null, throwable); - if (callBack != null) { - callBack.onFailure(new HDLException(403, throwable.getMessage())); - } - } - }); - } - - - /******************************************************************/ - - - /******************************椤圭洰绠$悊******************************/ - /** - * 鑾峰彇椤圭洰鍒楄〃 - * - * @param projectTypes 鏁扮粍 椤圭洰绫诲瀷 ProjectType.Home銆丳rojectType.RealEstate銆丳rojectType.PublicBuilding銆丳rojectType.Hotel - * @param communityName 閫氳繃椤圭洰鍚嶇О妯$硦鏌ヨ - * @param debugStatus 鏁扮粍 璋冭瘯鐘舵�� To_Be_Debugged(0, "寰呰皟璇�")銆丏ebugging(1, "璋冭瘯涓�")銆乄AIT_DELIVERED(3, "寰呬氦浠�")銆丏elivered(4, "宸蹭氦浠�")銆両NITIAL_TATE(5,"鍒濆鎬�") - * @param pageNo - * @param pageSize - * @param callBack - * @return - */ - public Disposable getProjectList(List<String> projectTypes, String communityName, List<String> debugStatus, int pageNo, int pageSize, IProjectInfoListCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_PROJECT_GET_PAGE); - JsonObject json = new JsonObject(); - json.add("projectTypes", HDLGsonUtils.toJsonArray(projectTypes)); - json.addProperty("pageNo", pageNo); - json.addProperty("pageSize", pageSize); - if (debugStatus != null && debugStatus.size() > 0) { - json.add("debugStatus", HDLGsonUtils.toJsonArray(debugStatus)); - } - if (!TextUtils.isEmpty(communityName)) { - json.addProperty("communityName", communityName); - } - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<ProjectInfoListBean>() { - @Override - public void onResponse(ProjectInfoListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /******************************椤圭洰绠$悊******************************/ - /** - * 鑾峰彇椤圭洰鍒楄〃 - * - * @param companyId 鎵�灞炰紒涓氬崟浣峣d - * @param debugUserId 璋冭瘯鍛樺伐璐﹀彿id - * @param pageNo - * @param pageSize - * @param callBack - * @return - */ - public Disposable getReDebugProjectList(String communityName, String companyId, String debugUserId, int pageNo, int pageSize, IProjectInfoListCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_REDEBUG_GET_PAGE); - JsonObject json = new JsonObject(); - json.addProperty("companyId", companyId); - json.addProperty("debugUserId", debugUserId); - json.addProperty("pageNo", pageNo); - json.addProperty("pageSize", pageSize); - if (!TextUtils.isEmpty(communityName)) { - json.addProperty("communityName", communityName); - } - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<ProjectInfoListBean>() { - @Override - public void onResponse(ProjectInfoListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable getProjectListExecute(List<String> projectTypes, String communityName, List<String> debugStatus, int pageNo, int pageSize, IProjectInfoListCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_PROJECT_GET_PAGE); - JsonObject json = new JsonObject(); - json.add("projectTypes", HDLGsonUtils.toJsonArray(projectTypes)); - json.addProperty("pageNo", pageNo); - json.addProperty("pageSize", pageSize); - if (debugStatus != null && debugStatus.size() > 0) { - json.add("debugStatus", HDLGsonUtils.toJsonArray(debugStatus)); - } - if (!TextUtils.isEmpty(communityName)) { - json.addProperty("communityName", communityName); - } - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .executePost() - .subscribeWith(new HDLResponse<ProjectInfoListBean>() { - @Override - public void onResponse(ProjectInfoListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - - /** - * 鏂板缓椤圭洰 - * - * @param newProjectRequestBean 椤圭洰淇℃伅瀵硅薄 - * @param callBack - * @return - */ - public Disposable addNewHouseProject(NewProjectRequestBean newProjectRequestBean, IDefaultCallBack callBack) { - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_PROJECT_CREATE); - return HxHttp.builder() - .url(requestUrl) - .raw(HDLGsonUtils.toJson(newProjectRequestBean)) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, newProjectRequestBean, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 浜や粯椤圭洰 鎵�鏈夋埧灞嬪浜庡凡浜や粯鐘舵�佹墠閫氳繃 鍚﹀垯鎻愮ず灏氭湭鏈夋湭浜や粯鐨勬埧灞� - * 閽堝閰掑簵鍜屽湴浜ч」鐩� - * - * @param communityId 灏忓尯ID - * @param callBack - * @return - */ - public Disposable deliveryRoject(String communityId, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("communityId", communityId); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_PROJECT_DELIVERY_ROJECT); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鎾ゅ洖浜や粯鐨勯」鐩� 宸蹭氦浠樼殑椤圭洰鍙樹负寰呬氦浠� 閽堝閰掑簵鍜屽湴浜ч」鐩� - * - * @param communityId 灏忓尯ID - * @param callBack - * @return - */ - public Disposable withdrawDeliveryProject(String communityId, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("communityId", communityId); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_PROJECT_WITHDRAW_DELIVERY_PROJECT); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - - /******************************鎴垮眿绠$悊******************************/ - /** - * 鑾峰彇椤圭洰鐨勬埧灞嬩俊鎭垪琛紝鍒嗛〉鏌ヨ - * - * @param requestBean 璇锋眰鍙傛暟瀵硅薄 - * @param callBack - * @return - */ - public Disposable getProjecHouseList(HousePageRequestBean requestBean, IProjectHouseListCallBack callBack) { - String requestJsonStr = HDLGsonUtils.toJson(requestBean); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_PROJECT_GET_HOUSE_PAGE); - return HxHttp.builder() - .url(requestUrl) - .raw(requestJsonStr) - .build() - .post() - .subscribeWith(new HDLResponse<ProjectHouseListBean>() { - @Override - public void onResponse(ProjectHouseListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, requestBean, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - public Disposable getProjecHouseListExecute(HousePageRequestBean requestBean, IProjectHouseListCallBack callBack) { - String requestJsonStr = HDLGsonUtils.toJson(requestBean); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_PROJECT_GET_HOUSE_PAGE); - return HxHttp.builder() - .url(requestUrl) - .raw(requestJsonStr) - .build() - .executePost() - .subscribeWith(new HDLResponse<ProjectHouseListBean>() { - @Override - public void onResponse(ProjectHouseListBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, requestBean, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鎵归噺鏇存柊鎴垮眿璋冭瘯鐘舵�� - * - * @param communityCode 椤圭洰code - * @param debugStatus 璋冭瘯鐘舵�� 0锛氬緟璋冭瘯 1锛氳皟璇曚腑 2锛氬緟楠屾敹 3锛氬凡瀹屾垚 4锛氬凡浜や粯锛屼负绌哄垯涓嶈繃婊� - * @param houseIds 鎴垮眿id闆嗗悎 - * @param callBack - * @return - */ - public Disposable batchChangeHouseDebugstatus(String communityCode, int debugStatus, List<String> houseIds, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("communityCode", communityCode); - json.addProperty("debugStatus", debugStatus); - json.add("houseIds", HDLGsonUtils.toJsonArray(houseIds)); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_BATCH_UPDATE_STATUS); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 璁惧鍩烘湰淇℃伅(oid) - * - * @param homeId - * @param devicesInfo - * @param callBack - * @return - */ - public Disposable fullUpdateDeviceInfo(String homeId, JsonArray devicesInfo, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("devices", devicesInfo); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_DEVICE_FULL_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鏇存柊鍔熻兘淇℃伅锛屽叏閲� - */ - public Disposable fullUpdateFunctionListInfo(String homeId, String gatewayId, JsonArray functionListInfo, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.add("devices", functionListInfo); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_FUNCTION_FULL_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .executePost() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable fullUpdateSceneListInfo(String homeId, JsonArray data, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("scenes", data); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_SCENE_FULL_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .executePost() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable fullUpdateLogicListInfo(String homeId, JsonArray data, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("logics", data); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_LOGIC_FULL_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .executePost() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable fullUpdateUidInfo(String homeId, JsonArray data, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("rooms", data); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_ROOM_FULL_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .executePost() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable fullUpdateSecuritysListInfo(String homeId, String gatewayId, JsonArray data, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.add("securitys", data); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_SECURITY_FULL_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .executePost() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - public Disposable fullAddGroupControlList(String homeId, String gatewayId, JsonArray data, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId); - json.add("infos", data); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSE_GROUPCONTROL_FULL_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .executePost() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable updateHouseName(String homeId, String homeName, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("homeName", homeName); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_HOUSENAME_UPDATE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable addDownloadCount(String driverVersionId) { - JsonObject json = new JsonObject(); - json.addProperty("driverVersionId", driverVersionId); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_ADD_DOWNLOADCOUNT); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - } - }); - } - - public Disposable addDownloadFirmwareCount(String firmwareVersionId) { - JsonObject json = new JsonObject(); - json.addProperty("firmwareVersionId", firmwareVersionId); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_ADD_FIRMWARE_DOWNLOADCOUNT); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - } - }); - } - - public Disposable addDownloadThirdCount(String thirdFirmwareVersionId) { - JsonObject json = new JsonObject(); - json.addProperty("thirdFirmwareVersionId", thirdFirmwareVersionId); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_ADD_THIRD_DOWNLOADCOUNT); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - } - }); - } - - - /******************************鏋佸厜鎺ㄩ��******************************/ - - public Disposable bindJPushId(String deviceName, String pushToken, String software, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("deviceName", deviceName); - json.addProperty("deviceType", "Android"); - json.addProperty("produce", "true"); - json.addProperty("pushToken", pushToken); - json.addProperty("software", software); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_JPUSH_BIND); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - HDLLinkPMUser.getInstance().saveHDLJpushId(response); - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable unBindJPushId(IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("pushId", HDLLinkPMUser.getInstance().getHDLJpushId()); - String requestUrl = HDLCloudProjectApi.getRequestUrl(HDLCloudProjectApi.POST_JPUSH_UNBIND); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/DebugStatusIntType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/DebugStatusIntType.java deleted file mode 100644 index 36b0c39..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/DebugStatusIntType.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hdl.linkpm.sdk.project.type; - -import androidx.annotation.IntDef; -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -/** - * Created by jlchen on 12/9/21. - * 璋冭瘯鐘舵�� Int 绫诲瀷 - */ -@Retention(SOURCE) -@IntDef({DebugStatusIntType.To_Be_Debugged, DebugStatusIntType.Debugging, DebugStatusIntType.WAIT_DELIVERED, DebugStatusIntType.Delivered, DebugStatusIntType.INITIAL_TATE}) -public @interface DebugStatusIntType { - //0锛氬緟璋冭瘯 - int To_Be_Debugged = 0; - //1锛氳皟璇曚腑 - int Debugging = 1; - //3锛氬緟浜や粯 - int WAIT_DELIVERED = 3; - //4锛氬凡浜や粯 - int Delivered = 4; - //5锛氬垵濮嬫�� - int INITIAL_TATE = 5; -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/DebugStatusType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/DebugStatusType.java deleted file mode 100644 index 29a08d5..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/DebugStatusType.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.hdl.linkpm.sdk.project.type; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -/** - * Created by jlchen on 12/9/21. - * 璋冭瘯鐘舵�佺被鍨� 瀛楃涓� - */ -@Retention(SOURCE) -@StringDef({DebugStatusType.To_Be_Debugged, DebugStatusType.Debugging, DebugStatusType.WAIT_DELIVERED, DebugStatusType.Delivered, DebugStatusType.INITIAL_TATE}) -public @interface DebugStatusType { - //0锛氬緟璋冭瘯 - String To_Be_Debugged = "To_Be_Debugged"; - //1锛氳皟璇曚腑 - String Debugging = "Debugging"; - //3锛氬緟浜や粯 - String WAIT_DELIVERED = "WAIT_DELIVERED"; - //4锛氬凡浜や粯 - String Delivered = "Delivered"; - //5锛氬垵濮嬫�� - String INITIAL_TATE = "INITIAL_TATE"; -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/ProjectType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/ProjectType.java deleted file mode 100644 index c469677..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/ProjectType.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hdl.linkpm.sdk.project.type; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -/** - * Created by jlchen on 12/3/21. - * 椤圭洰绫诲瀷 Home銆丷ealEstate銆丳ublicBuilding銆丠otel - */ -@Retention(SOURCE) -@StringDef({ProjectType.Home, ProjectType.RealEstate, ProjectType.PublicBuilding, ProjectType.Hotel}) -public @interface ProjectType { - - //0: 瀹跺眳椤圭洰 - String Home = "Home"; - //1锛氬湴浜ч」鐩� - String RealEstate = "RealEstate"; - //2锛氬叕寤洪」鐩� - String PublicBuilding = "PublicBuilding"; - //3锛氶厭搴楅」鐩� - String Hotel = "Hotel"; -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/ProtocolType.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/ProtocolType.java deleted file mode 100644 index 0924d25..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/project/type/ProtocolType.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.hdl.linkpm.sdk.project.type; - -import androidx.annotation.StringDef; - -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.SOURCE; - -/** - * Created by jlchen on 12/3/21. - * 鍗忚绫诲瀷 BUSPRO銆並NX銆乑IGBEE - */ -@Retention(SOURCE) -@StringDef({ProtocolType.BUSPRO, ProtocolType.KNX, ProtocolType.ZIGBEE}) -public @interface ProtocolType { - //0锛歜uspro - String BUSPRO = "BUSPRO"; - //1锛欿NX - String KNX = "KNX"; - //2锛歓IGBEE - String ZIGBEE = "ZIGBEE"; -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/HDLLinkPMScene.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/HDLLinkPMScene.java deleted file mode 100644 index 3356360..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/HDLLinkPMScene.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.hdl.linkpm.sdk.scene; - -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.scene.bean.SceneInfoBean; -import com.hdl.linkpm.sdk.scene.controller.HDLPMSceneController; - -import java.util.List; - -/** - * Created by jlchen on 12/2/21. - */ -public class HDLLinkPMScene { - - //instance - private volatile static HDLLinkPMScene instance; - /** - * getInstance - * - * @return HDLLinkPMScene - */ - public static synchronized HDLLinkPMScene getInstance() { - if (instance == null) { - synchronized (HDLLinkPMScene.class) { - if (instance == null) { - instance = new HDLLinkPMScene(); - } - } - } - return instance; - } - - /***************5.鍦烘櫙澧炲垹鏀规煡绠$悊***************/ - /** - * 鍏ㄩ噺鍚屾鍦烘櫙 - * - * @param homeId 浣忓畢id - * @param sceneInfoBeanList 鍦烘櫙鍒楄〃 - * @param callBack - * @return - */ - public void fullSyncSceneList(String homeId, List<SceneInfoBean> sceneInfoBeanList, IDefaultCallBack callBack) { - HDLPMSceneController.getInstance().fullSyncSceneList(homeId, sceneInfoBeanList, callBack); - } - - /** - * 鑾峰彇鍦烘櫙鍒楄〃 - * - * @param homeId 浣忓畢id - * @param uid 鎴块棿uid,涓嶄紶榛樿鏌ュ叏閮� - * @param callBack - * @return - */ - public void getSceneList(String homeId, String uid, IResponseCallBack<List<SceneInfoBean>> callBack) { - HDLPMSceneController.getInstance().getSceneList(homeId, uid, callBack); - } - - /** - * 鍒犻櫎鍦烘櫙 - * - * @param homeId 浣忓畢id - * @param sids 鍦烘櫙sid鍒楄〃 - * @param callBack - * @return - */ - public void deleteScene(String homeId, List<String> sids, IDefaultCallBack callBack) { - HDLPMSceneController.getInstance().deleteScene(homeId, sids, callBack); - } - - /** - * 鎵ц鍦烘櫙 - * - * @param homeId 浣忓畢id - * @param sids 鍦烘櫙IDs - * @param callBack - * @return - */ - public void controlScene(String homeId, List<String> sids, IDefaultCallBack callBack) { - HDLPMSceneController.getInstance().controlScene(homeId, sids, callBack); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/bean/SceneInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/bean/SceneInfoBean.java deleted file mode 100644 index a27d2a6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/bean/SceneInfoBean.java +++ /dev/null @@ -1,138 +0,0 @@ -package com.hdl.linkpm.sdk.scene.bean; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.device.bean.StatusBean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -/** - * Created by jlchen on 12/11/21. - */ -public class SceneInfoBean implements Serializable { - - private String sid;//鍦烘櫙id(鏈湴妯″紡蹇呴渶) - private String gatewayId;//鍦烘櫙id(鏈湴妯″紡蹇呴渶) - private String name;//鍦烘櫙鍚嶇О - private List<String> uids = new ArrayList<>();//鎵�灞炴埧闂� - private String delay;//鍦烘櫙寤舵椂 - private String group;//鍒嗙粍 - private List<FunctionsBean> functions = new ArrayList<>();//鎵ц鍐呭 - private String userSceneId;//浜戠鍞竴Id,涓婁紶鍚庝簯绔墠浼氭湁 - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public String getGatewayId() { - return gatewayId == null ? "" : gatewayId; - } - - public void setGatewayId(@NonNull String gatewayId) { - this.gatewayId = gatewayId; - } - - @NonNull - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - @NonNull - public List<String> getUids() { - if (uids == null) { - return new ArrayList<>(); - } - return uids; - } - - public void setUids(@NonNull List<String> uids) { - this.uids = uids; - } - - @NonNull - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - @NonNull - public String getGroup() { - return group == null ? "" : group; - } - - public void setGroup(@NonNull String group) { - this.group = group; - } - - @NonNull - public List<FunctionsBean> getFunctions() { - if (functions == null) { - return new ArrayList<>(); - } - return functions; - } - - public void setFunctions(@NonNull List<FunctionsBean> functions) { - this.functions = functions; - } - - @NonNull - public String getUserSceneId() { - return userSceneId == null ? "" : userSceneId; - } - - public void setUserSceneId(@NonNull String userSceneId) { - this.userSceneId = userSceneId; - } - - public static class FunctionsBean implements Serializable{ - private String sid;//鍔熻兘id - private List<StatusBean> status = new ArrayList<>();//鎺у埗灞炴�� - private String delay;//寤舵椂 - - @NonNull - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(@NonNull String sid) { - this.sid = sid; - } - - @NonNull - public List<StatusBean> getStatus() { - if (status == null) { - return new ArrayList<>(); - } - return status; - } - - public void setStatus(@NonNull List<StatusBean> status) { - this.status = status; - } - - @NonNull - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/controller/HDLPMSceneController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/controller/HDLPMSceneController.java deleted file mode 100644 index 7a02243..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/scene/controller/HDLPMSceneController.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.hdl.linkpm.sdk.scene.controller; - -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.core.api.HDLCloudHomeApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.scene.bean.SceneInfoBean; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; - -/** - * Created by jlchen on 12/13/21. - * 鍦烘櫙鐩稿叧鐨勭綉缁滆姹� - */ -public class HDLPMSceneController { - /** - * instance - */ - private volatile static HDLPMSceneController instance; - - /** - * getInstance - * - * @return HDLPMSceneController - */ - public static synchronized HDLPMSceneController getInstance() { - if (instance == null) { - synchronized (HDLPMSceneController.class) { - if (instance == null) { - instance = new HDLPMSceneController(); - } - } - } - return instance; - } - -/***************5.鍦烘櫙澧炲垹鏀规煡绠$悊***************/ - /** - * 鍏ㄩ噺鍚屾鍦烘櫙 - * - * @param homeId 浣忓畢id - * @param sceneInfoBeanList 鍦烘櫙鍒楄〃 - * @param callBack - * @return - */ - public Disposable fullSyncSceneList(String homeId, List<SceneInfoBean> sceneInfoBeanList, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("scenes", HDLGsonUtils.toJsonArray(sceneInfoBeanList)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_SCENE_LIST_FULL_SYNC); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇鍦烘櫙鍒楄〃 - * - * @param homeId 浣忓畢id - * @param uid 鎴块棿uid,涓嶄紶榛樿鏌ュ叏閮� - * @param callBack - * @return - */ - public Disposable getSceneList(String homeId, String uid, IResponseCallBack<List<SceneInfoBean>> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("uid", uid); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_SCENE_LIST_GET); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<SceneInfoBean>>() { - @Override - public void onResponse(List<SceneInfoBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鍒犻櫎鍦烘櫙 - * - * @param homeId 浣忓畢id - * @param sids 鍦烘櫙sid鍒楄〃 - * @param callBack - * @return - */ - public Disposable deleteScene(String homeId, List<String> sids, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("sids", HDLGsonUtils.toJsonArray(sids)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_SCENE_DELETE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鎵ц鍦烘櫙 - * - * @param homeId 浣忓畢id - * @param sids 鍦烘櫙IDs - * @param callBack - * @return - */ - public Disposable controlScene(String homeId, List<String> sids, IDefaultCallBack callBack) { - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.add("sids", HDLGsonUtils.toJsonArray(sids)); - String requestUrl = HDLCloudHomeApi.getRequestUrl(HDLCloudHomeApi.POST_SCENE_EXECUTE); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/GsonUtils.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/GsonUtils.java deleted file mode 100644 index 80d83e0..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/GsonUtils.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.hdl.linkpm.sdk.template; - -import androidx.annotation.NonNull; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.google.gson.JsonSyntaxException; -import com.google.gson.TypeAdapter; -import com.google.gson.TypeAdapterFactory; -import com.google.gson.reflect.TypeToken; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; -import com.google.gson.stream.JsonWriter; - -import java.io.IOException; -import java.lang.reflect.Type; - -/** - * Created by Tong on 2021/11/10. - */ -public class GsonUtils { - - private static Gson gson; - - public static <T> T copy(Object o, Class<T> type) { - return copy(o, TypeToken.get(type)); - } - - public static <T> T copy(Object o, TypeToken<T> type) { - return copy(o, type.getType()); - } - - public static <T> T copy(Object o, Type type) { - try { - Gson gson = getGson(); - return gson.fromJson(gson.toJson(o), type); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - public static <T> T fromJson(String json, Type type) { - try { - Gson gson = getGson(); - return gson.fromJson(json, type); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static <T> T fromJson(String json, Class<T> type) { - try { - Gson gson = getGson(); - return gson.fromJson(json, type); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static <T> T fromJson(String json) { - try { - Gson gson = getGson(); - return gson.fromJson(json, new TypeToken<T>() { - }.getType()); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - public static String toJson(Object object) { - try { - return getGson().toJson(object); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static JsonArray toJsonArray(Object object) { - try { - return GsonUtils.fromJson(GsonUtils.toJson(object), new TypeToken<JsonArray>() { - }.getType()); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - - public static Type getType(@NonNull final Type rawType, @NonNull final Type... typeArguments) { - return TypeToken.getParameterized(rawType, typeArguments).getType(); - } - - - public static Gson getGson() { - if (gson == null) { - gson = new GsonBuilder() - .disableHtmlEscaping() - .registerTypeAdapterFactory(new NullStringToEmptyAdapterFactory()) - .registerTypeAdapter(String.class, new StringAdapter()) - .registerTypeAdapter(Integer.class, new IntegerDefaultAdapter()) - .registerTypeAdapter(Double.class, new DoubleDefaultAdapter()) - .registerTypeAdapter(Long.class, new LongDefaultAdapter()) - .create(); - } - return gson; - } - - private static class StringAdapter implements JsonSerializer<String>, JsonDeserializer<String> { - @Override - public String deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - if (json instanceof JsonPrimitive) { - return json.getAsString(); - } else { - return json.toString(); - } - } - - @Override - public JsonElement serialize(String src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - - private static class IntegerDefaultAdapter implements JsonSerializer<Integer>, JsonDeserializer<Integer> { - @Override - public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - try { - if (json.getAsString().equals("") || json.getAsString().equals("null")) { - return 0; - } - } catch (Exception ignore) { - } - try { - return json.getAsInt(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - private static class DoubleDefaultAdapter implements JsonSerializer<Double>, JsonDeserializer<Double> { - @Override - public Double deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - try { - if (json.getAsString().equals("") || json.getAsString().equals("null")) { - return 0.00; - } - } catch (Exception ignore) { - } - try { - return json.getAsDouble(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public JsonElement serialize(Double src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - private static class LongDefaultAdapter implements JsonSerializer<Long>, JsonDeserializer<Long> { - @Override - public Long deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - try { - if (json.getAsString().equals("") || json.getAsString().equals("null")) { - return 0L; - } - } catch (Exception ignore) { - } - try { - return json.getAsLong(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public JsonElement serialize(Long src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - private static class NullStringToEmptyAdapterFactory implements TypeAdapterFactory { - - public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) { - Class<T> rawType = (Class<T>) type.getRawType(); - if (rawType != String.class) { - return null; - } - return (TypeAdapter<T>) new StringNullAdapter(); - } - } - - public static class StringNullAdapter extends TypeAdapter<String> { - - @Override - public String read(JsonReader reader) throws IOException { - if (reader.peek() == JsonToken.NULL) { - reader.nextNull(); - return ""; - } - return reader.nextString(); - } - - @Override - public void write(JsonWriter writer, String value) throws IOException { - if (value == null) { - writer.nullValue(); - return; - } - writer.value(value); - } - - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/HDLLinkPMTemplate.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/HDLLinkPMTemplate.java deleted file mode 100644 index e95f41d..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/HDLLinkPMTemplate.java +++ /dev/null @@ -1,630 +0,0 @@ -package com.hdl.linkpm.sdk.template;/* - *create by wxr - *date 2022/1/19 - */ - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.HDLLinkPMSdk; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.interceptor.HDLSmartHeader; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateDevice; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateSpatialInfo; -import com.hdl.linkpm.sdk.template.bean.TemplateDeviceBean; -import com.hdl.linkpm.sdk.template.bean.TemplateFunctionBean; -import com.hdl.linkpm.sdk.template.bean.TemplateGatewayBean; -import com.hdl.linkpm.sdk.template.bean.TemplateListResponseBean; -import com.hdl.linkpm.sdk.template.bean.TemplateLogicBean; -import com.hdl.linkpm.sdk.template.bean.TemplateRoomPackBean; -import com.hdl.linkpm.sdk.template.bean.TemplateSceneBean; -import com.hdl.linkpm.sdk.template.bean.TemplateSecurityBean; -import com.hdl.linkpm.sdk.template.callback.ICreateTemplateCallBack; -import com.hdl.linkpm.sdk.template.callback.IGetTemplateDeviceListCallBack; -import com.hdl.linkpm.sdk.template.callback.IGetTemplateGatewayListCallBack; -import com.hdl.linkpm.sdk.template.callback.IGetTemplateSpatialInfoCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateFunctionsCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateListCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateLogicCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateScenesCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateSecurityCallBack; -import com.hdl.linkpm.sdk.template.controller.HDLTemplateController; -import com.hdl.linkpm.sdk.utils.HDLFileUtils; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.functions.Consumer; -import okhttp3.ResponseBody; - -public class HDLLinkPMTemplate { - - /** - * instance - */ - private volatile static HDLLinkPMTemplate instance; - - /** - * getInstance - * - * @return HDLPMTemplateController - */ - public static synchronized HDLLinkPMTemplate getInstance() { - if (instance == null) { - synchronized (HDLLinkPMTemplate.class) { - if (instance == null) { - instance = new HDLLinkPMTemplate(); - } - } - } - return instance; - } - - /** - * 鍒涘缓妯℃澘 - * @param templateName 妯℃澘鍚嶇О - * @param communityCode 绀惧尯缂栫爜 - * @param houseLayoutId 鎴峰瀷id (瑕佽皟鐢ㄦ埛鍨嬪垪琛ㄧ殑鎺ュ彛) - * @param templateDesc 妯℃澘鎻忚堪 - * @param callBack 鍥炶皟 - */ - public void CreateTemplate(String templateName,String communityCode,String houseLayoutId,String templateDesc,ICreateTemplateCallBack callBack) { - HDLTemplateController.getInstance().CreateTemplate(templateName, communityCode, houseLayoutId, templateDesc, new ICreateTemplateCallBack() { - @Override - public void onSuccess(String templateId) { - callBack.onSuccess(templateId); - } - - @Override - public void onFailure(HDLException error) { - callBack.onFailure(error); - } - }); - } - - /** - * 娣诲姞璁惧(鍏ㄩ噺) - * @param templateExtendsId - * @param beans - * @param callBack - */ - public void UpdateTemplateDevices(String templateExtendsId,List<TemplateDeviceBean> beans,IDefaultCallBack callBack){ - HDLTemplateController.getInstance().UpdateTemplateDevices(templateExtendsId, beans, new IDefaultCallBack() { - @Override - public void onSuccess() { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 涓婁紶妯℃澘zb鏁版嵁鏂囦欢鏂囦欢 - * - * @param templateExtendsId 妯℃澘ID - * @param file 涓婁紶鐨勬枃浠� - * @param callBack - * @return - */ - public Disposable TemplateZbFileUpload(String templateExtendsId, File file, IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + "/iot-cloud/debug/backup/file/zigbeeDataUpload?templateExtendsId=" + templateExtendsId; - return HxHttp.builder() - .file(file, "file") - .url(requestUrl) - .build() - .upload() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { -// FileUtils.deleteFile(file);//涓嶇敤鍒犳帀鏈湴鏂囦欢 2022-09-28 17:24:06 - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLFileUtils.deleteFile(file); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 涓嬭浇妯℃澘zb鏁版嵁鏂囦欢鏂囦欢 - */ - public static boolean saveTempalteZbFile(ResponseBody zipData,File file) { - // 濡傛灉瀛樺湪灏卞厛鍒犻櫎鏁版嵁锛屾暟鎹細杩藉姞 - if(file.exists()){ - file.delete(); - file.deleteOnExit(); - } - InputStream is = null; - byte[] buf = new byte[4096]; - int len = 0; - FileOutputStream fos = null; - try { - is = zipData.byteStream(); - long total = zipData.contentLength(); - fos = new FileOutputStream(file); - long sum = 0; - while ((len = is.read(buf)) != -1) { - fos.write(buf, 0, len); - sum += len; - } - fos.flush(); - return true; - } catch (Exception e) { - e.printStackTrace(); - return false; - } finally { - try { - if (is != null) - is.close(); - } catch (IOException e) { - } - try { - if (fos != null) - fos.close(); - } catch (IOException e) { - } - } - } - - /** - * 鑾峰彇妯℃澘zb鏁版嵁鏂囦欢Url - * @return - */ - public Disposable getTempalteZbFileUrl(String templateExtendsId,File file, IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + "/iot-cloud/debug/backup/file/zigbeeDataNewestUrl"; - - - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String url) { - if (url == null) { - callBack.onSuccess(); - } else { - if (callBack != null) { - downloadTempalteZbFile(url, file, new IDefaultCallBack() { - @Override - public void onSuccess() { - callBack.onSuccess(); - - } - - @Override - public void onFailure(HDLException error) { - callBack.onFailure(error); - } - }); - } - } - } - @Override - public void onFailure(HDLException e) { - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 涓嬭浇妯℃澘zb鏁版嵁鏂囦欢鏂囦欢 - * @param callBack - * @return - */ - public Disposable downloadTempalteZbFile(String url,File file, IDefaultCallBack callBack) { - return HxHttp.builder() - .url(url) - .headers(HDLSmartHeader.IGNORE_SIGN_HEADER,1) - .build() - .download() - .subscribe(new Consumer<ResponseBody>() { - @Override - public void accept(ResponseBody responseBody) throws Exception { - //缃戠粶璇锋眰鎴愬姛锛岃鍙栨枃浠朵繚瀛樺埌sd鍗� -// callBack.onSuccess(responseBody); - //淇濆瓨鏂囦欢 -// File file = new File(getUserFilesPath() + "/" + templateBean.getTemplateExtendsId()); - - boolean saveResult = saveTempalteZbFile(responseBody,file); - if(saveResult) { - callBack.onSuccess(); - }else { - callBack.onFailure(new HDLException(0,"")); - } - } - }, new Consumer<Throwable>() { - @Override - public void accept(Throwable throwable) throws Exception { - /** - * 缃戠粶璇锋眰澶辫触 - * 鍏蜂綋鍙互鑷繁瀹炵幇 - */ - callBack.onFailure(new HDLException(404,"")); - } - }); - } - - - /** - * 鑾峰彇妯℃澘鍒楄〃 - * @param callBack - */ - public void GetTemplateList(int pageNo, int pageSize, ITemplateListCallBack callBack) { - HDLTemplateController.getInstance().GetTemplateList(pageNo,pageSize,new ITemplateListCallBack() { - @Override - public void onSuccess(TemplateListResponseBean templateListResponseBeans) { - callBack.onSuccess(templateListResponseBeans); - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鍒犻櫎妯℃澘 - * @param templateExtendsId 妯℃澘ID - * @param callBack - */ - public void DeleteTemplate(String templateExtendsId,IDefaultCallBack callBack){ - HDLTemplateController.getInstance().DeleteTemplate(templateExtendsId, new IDefaultCallBack() { - @Override - public void onSuccess() { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鏇存柊缃戝叧鏁版嵁(鍏ㄩ噺) - */ - public void UpdateTemplateGateway(String templateExtendsId , List<TemplateGatewayBean> gatewayBeans, - IDefaultCallBack callBack){ - HDLTemplateController.getInstance().UpdateTemplateGateway(templateExtendsId, gatewayBeans, new IDefaultCallBack() { - @Override - public void onSuccess() { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鏇存柊鎴块棿锛堟ゼ灞傦級淇℃伅(鍏ㄩ噺) - * @param templateExtendsId - * @param rooms - * @param callBack - * @return - */ - public void UpdateTemplateRoom(String templateExtendsId ,List<TemplateRoomPackBean.TemplateRoomInfoBean> rooms, - IDefaultCallBack callBack){ - HDLTemplateController.getInstance().UpdateTemplateRoom(templateExtendsId, rooms, new IDefaultCallBack() { - @Override - public void onSuccess() { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 娣诲姞鍔熻兘(鍏ㄩ噺) - * @param templateExtendsId 妯℃澘鍚嶇О - * @param functionInfoList 鍔熻兘鍒楄〃 - * @param callBack 鍥炶皟 - */ - public void UpdateTemplateFunctions(String templateExtendsId, List<TemplateFunctionBean> functionInfoList, - IDefaultCallBack callBack){ - HDLTemplateController.getInstance().UpdateTemplateFunctions(templateExtendsId, functionInfoList, new IDefaultCallBack() { - @Override - public void onSuccess() { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鏇存柊妯℃澘鍦烘櫙(鍏ㄩ噺) - * @param templateExtendsId - * @param sceneBeans - * @param callBack - */ - public void UpdataTemplateScenes(String templateExtendsId, List<TemplateSceneBean> sceneBeans, - IDefaultCallBack callBack){ - HDLTemplateController.getInstance().UpdataTemplateScenes(templateExtendsId, sceneBeans, new IDefaultCallBack() { - @Override - public void onSuccess() { - if(callBack != null){ - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if(callBack != null){ - callBack.onFailure(error); - } - } - }); - } - - /** - * 鏇存柊妯℃澘鑷姩鍖� (鍏ㄩ噺) - * @param templateExtendsId - * @param logicBeansJson - * @param callBack - */ - public void UpdataTemplateLogic(String templateExtendsId, JsonElement logicBeansJson,// List<TemplateLogicBean> logicBeans, - IDefaultCallBack callBack){ - HDLTemplateController.getInstance().UpdataTemplateLogic(templateExtendsId, logicBeansJson, new IDefaultCallBack() { - @Override - public void onSuccess() { - if(callBack != null){ - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if(callBack != null){ - callBack.onFailure(error); - } - } - }); - } - - /** - * 鏇存柊妯℃澘瀹夐槻 (鍏ㄩ噺) - * @param templateExtendsId - * @param securityInfos - * @param callBack - */ - public void UpdataTemplateSecurity(String templateExtendsId, JsonElement securityInfos ,IDefaultCallBack callBack ){ - HDLTemplateController.getInstance().UpdataTemplateSecurity(templateExtendsId, securityInfos, new IDefaultCallBack() { - @Override - public void onSuccess() { - if(callBack != null){ - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException error) { - if(callBack != null){ - callBack.onFailure(error); - } - } - }); - } - - /** - * 鑾峰彇鍖哄煙淇℃伅 - * @param templateExtendsId - * @param callBack - */ - public void GetTemplateAreaSpatialInfo(String templateExtendsId ,IGetTemplateSpatialInfoCallBack callBack){ - HDLTemplateController.getInstance().GetTemplateAreaSpatialInfo(templateExtendsId, new IGetTemplateSpatialInfoCallBack() { - @Override - public void onSuccess(List<CloudTemplateSpatialInfo> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鑾峰彇缃戝叧鍒楄〃 - * @param id - * @param callBack - */ - public void GetTemplateGatewayList(String id, IGetTemplateGatewayListCallBack callBack){ - HDLTemplateController.getInstance().GetTemplateGatewayList(id, new IGetTemplateGatewayListCallBack() { - @Override - public void onSuccess(List<TemplateGatewayBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鑾峰彇璁惧淇℃伅 - * @param templateId - * @param callBack - */ - public void GetTemplateDeviceList(String templateId,IGetTemplateDeviceListCallBack callBack){ - HDLTemplateController.getInstance().GetTemplateDeviceList(templateId, new IGetTemplateDeviceListCallBack() { - @Override - public void onSuccess(List<CloudTemplateDevice> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鑾峰彇鍔熻兘鍒楄〃 - * @param templateExtendsId - * @param callBack - */ - public void GetTemplateFunctions(String templateExtendsId , ITemplateFunctionsCallBack callBack){ - HDLTemplateController.getInstance().GetTemplateFunctions(templateExtendsId, new ITemplateFunctionsCallBack() { - @Override - public void onSuccess(List<TemplateFunctionBean> templateFunctionBean) { - if (callBack != null) { - callBack.onSuccess(templateFunctionBean); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鑾峰彇鍦烘櫙鍒楄〃 - * @param templateExtendsId - * @param callBack - */ - public void GetTemplateScenes(String templateExtendsId , ITemplateScenesCallBack callBack){ - HDLTemplateController.getInstance().GetTemplateScenes(templateExtendsId, new ITemplateScenesCallBack() { - @Override - public void onSuccess(List<TemplateSceneBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鑾峰彇瀹夐槻鍒楄〃 - * @param templateExtendsId - * @param callBack - */ - public void GetTemplateSecurity(String templateExtendsId , ITemplateSecurityCallBack callBack){ - HDLTemplateController.getInstance().GetTemplateSecurity(templateExtendsId, new ITemplateSecurityCallBack() { - @Override - public void onSuccess(List<TemplateSecurityBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - } - ); - } - - /** - * 鑾峰彇閫昏緫鍒楄〃 - * @param templateExtendsId - * @param callBack - */ - public void GetTemplateLogic(String templateExtendsId ,ITemplateLogicCallBack callBack){ - HDLTemplateController.getInstance().GetTemplateLogic(templateExtendsId, new ITemplateLogicCallBack() { - @Override - public void onSuccess(List<TemplateLogicBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - } - ); - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/CloudTemplateDevice.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/CloudTemplateDevice.java deleted file mode 100644 index 640dd8a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/CloudTemplateDevice.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean;/* - *create by wxr - *date 2022/2/11 - */ - -import java.io.Serializable; - -public class CloudTemplateDevice implements Serializable { - private String templateOidId;// 妯℃澘璁惧id (浜戠id) string - private String templateExtendsId;// 瀵瑰簲鐨勬ā鏉縤d long - private String templateDeviceOidModelId;// model id 妯℃澘璁惧鍨嬪彿 string - private String templateDeviceOidImageId;// 妯℃澘璁惧闀滃儚id string - private String firmwareVersion;// 鍥轰欢鐗堟湰 string - private String hardwareVersion;// 纭欢鐗堟湰 string - private String serialNumber;// 璁惧搴忓垪鍙� string - private String templateDeviceOidAddr;// 鐗╃悊璁惧 mac string - private String templateDeviceOidManufacturer;// 璁惧鍒堕�犲晢 string - private String templateDeviceOidName;// 妯℃澘璁惧鍚嶇О string - private String templateDeviceOidDesc; // 妯℃澘璁惧鎻忚堪 string - private String templateRoomId; // 妯℃澘鎴块棿id string - private String templateOidIcon; // 妯℃澘璁惧鍥剧墖 string - private String extInfo; //-- 瀛樺偍璁惧閲岄潰鐨勫姛鑳藉垪琛紝鐩墠璁ㄨ浣跨敤 json 浼犻�� (涓�鏉℃暟鎹氨鏄涓寜閿紝琛ㄧず涓�涓户鐢靛櫒) string - private String linkOid; - - public String getLinkOid() { - return linkOid; - } - - public void setLinkOid(String linkOid) { - this.linkOid = linkOid; - } - - public String getTemplateOidId() { - return templateOidId == null ? "" : templateOidId; - } - - public void setTemplateOidId(String templateOidId) { - this.templateOidId = templateOidId; - } - - public String getTemplateExtendsId() { - return templateExtendsId == null ? "" : templateExtendsId; - } - - public void setTemplateExtendsId(String templateExtendsId) { - this.templateExtendsId = templateExtendsId; - } - - public String getTemplateDeviceOidModelId() { - return templateDeviceOidModelId == null ? "" : templateDeviceOidModelId; - } - - public void setTemplateDeviceOidModelId(String templateDeviceOidModelId) { - this.templateDeviceOidModelId = templateDeviceOidModelId; - } - - public String getTemplateDeviceOidImageId() { - return templateDeviceOidImageId == null ? "" : templateDeviceOidImageId; - } - - public void setTemplateDeviceOidImageId(String templateDeviceOidImageId) { - this.templateDeviceOidImageId = templateDeviceOidImageId; - } - - public String getFirmwareVersion() { - return firmwareVersion == null ? "" : firmwareVersion; - } - - public void setFirmwareVersion(String firmwareVersion) { - this.firmwareVersion = firmwareVersion; - } - - public String getHardwareVersion() { - return hardwareVersion == null ? "" : hardwareVersion; - } - - public void setHardwareVersion(String hardwareVersion) { - this.hardwareVersion = hardwareVersion; - } - - public String getSerialNumber() { - return serialNumber == null ? "" : serialNumber; - } - - public void setSerialNumber(String serialNumber) { - this.serialNumber = serialNumber; - } - - public String getTemplateDeviceOidAddr() { - return templateDeviceOidAddr == null ? "" : templateDeviceOidAddr; - } - - public void setTemplateDeviceOidAddr(String templateDeviceOidAddr) { - this.templateDeviceOidAddr = templateDeviceOidAddr; - } - - public String getTemplateDeviceOidManufacturer() { - return templateDeviceOidManufacturer == null ? "" : templateDeviceOidManufacturer; - } - - public void setTemplateDeviceOidManufacturer(String templateDeviceOidManufacturer) { - this.templateDeviceOidManufacturer = templateDeviceOidManufacturer; - } - - public String getTemplateDeviceOidName() { - return templateDeviceOidName == null ? "" : templateDeviceOidName; - } - - public void setTemplateDeviceOidName(String templateDeviceOidName) { - this.templateDeviceOidName = templateDeviceOidName; - } - - public String getTemplateDeviceOidDesc() { - return templateDeviceOidDesc == null ? "" : templateDeviceOidDesc; - } - - public void setTemplateDeviceOidDesc(String templateDeviceOidDesc) { - this.templateDeviceOidDesc = templateDeviceOidDesc; - } - - public String getTemplateRoomId() { - return templateRoomId == null ? "" : templateRoomId; - } - - public void setTemplateRoomId(String templateRoomId) { - this.templateRoomId = templateRoomId; - } - - public String getTemplateOidIcon() { - return templateOidIcon == null ? "" : templateOidIcon; - } - - public void setTemplateOidIcon(String templateOidIcon) { - this.templateOidIcon = templateOidIcon; - } - - public String getExtInfo() { - return extInfo == null ? "" : extInfo; - } - - public void setExtInfo(String extInfo) { - this.extInfo = extInfo; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/CloudTemplateSpatialInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/CloudTemplateSpatialInfo.java deleted file mode 100644 index f3d47bb..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/CloudTemplateSpatialInfo.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean;/* - *create by wxr - *date 2022/2/11 - */ - -import java.io.Serializable; - -public class CloudTemplateSpatialInfo implements Serializable { -// -- templateRoomId 鎴块棿浜戠id string - private String templateRoomId; -//-- templateExtendsId 妯℃澘id string - private String templateExtendsId; -//-- templateRoomName 妯℃澘鎴块棿鍚嶇О string - private String templateRoomName; -//-- templateRoomType 妯℃澘鎴块棿绫诲瀷 string - private String templateRoomType; -//-- templateRoomImage 妯℃澘鎴块棿鍥剧墖 string - private String templateRoomImage; -//-- parentId 妯℃澘鎴块棿瀵瑰簲妤煎眰id string - private String parentId; -//-- uid uid string - private String uid; - - public String getTemplateRoomId() { - return templateRoomId == null ? "" : templateRoomId; - } - - public void setTemplateRoomId(String templateRoomId) { - this.templateRoomId = templateRoomId; - } - - public String getTemplateExtendsId() { - return templateExtendsId == null ? "" : templateExtendsId; - } - - public void setTemplateExtendsId(String templateExtendsId) { - this.templateExtendsId = templateExtendsId; - } - - public String getTemplateRoomName() { - return templateRoomName == null ? "" : templateRoomName; - } - - public void setTemplateRoomName(String templateRoomName) { - this.templateRoomName = templateRoomName; - } - - public String getTemplateRoomType() { - return templateRoomType == null ? "" : templateRoomType; - } - - public void setTemplateRoomType(String templateRoomType) { - this.templateRoomType = templateRoomType; - } - - public String getTemplateRoomImage() { - return templateRoomImage == null ? "" : templateRoomImage; - } - - public void setTemplateRoomImage(String templateRoomImage) { - this.templateRoomImage = templateRoomImage; - } - - public String getParentId() { - return parentId == null ? "" : parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public String getUid() { - return uid == null ? "" : uid; - } - - public void setUid(String uid) { - this.uid = uid; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateBean.java deleted file mode 100644 index 064cb3d..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateBean.java +++ /dev/null @@ -1,314 +0,0 @@ - -package com.hdl.linkpm.sdk.template.bean; -/* - *create by wxr - *date 2022/1/23 - */ - -import com.hdl.linkpm.sdk.template.GsonUtils; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.UUID; - -public class TemplateBean implements Serializable,Cloneable { - - @Override - public TemplateBean clone() throws CloneNotSupportedException { - try { - TemplateBean tt = GsonUtils.copy(this, TemplateBean.class); - if (tt != null) { - return tt; - } - } catch (Exception e) { - e.printStackTrace(); - return (TemplateBean) super.clone(); - } - return (TemplateBean) super.clone(); - } - - - public String getDebugFlag() { - return debugFlag; - } - - public void setDebugFlag(String debugFlag) { - this.debugFlag = debugFlag; - } - - private String debugFlag ; - - private String templateExtendsId;// 妯℃澘id string - private String templateName;// 妯℃澘鍚嶇О string - private String projectType;// 椤圭洰绫诲瀷 string - private String houseLayoutId;// 鎴峰瀷id string - private String houseLayoutName;// 鎴峰瀷鍚嶇О string - private String templateSourcePlatform;// 鏉ユ簮 string - private String templateSourceDesc;// 搴旂敤杞欢 string - private String modifyTime;// 鏇存柊鏃堕棿 long - - -// /** -// * 宸茬粡鍖归厤瀹為檯璁惧杩囩殑妯℃澘 -// */ -// List<TemplateDeviceBean> alreadyMatchedTemplateList = new ArrayList<>(); -// -// public List<TemplateDeviceBean> getAlreadyMatchedTemplateList() { -// return alreadyMatchedTemplateList; -// } -// -// public void setAlreadyMatchedTemplateList(List<TemplateDeviceBean> alreadyMatchedTemplateList) { -// this.alreadyMatchedTemplateList = alreadyMatchedTemplateList; -// } - /** - * 鐢ㄦ潵璁板綍鐪熷疄璁惧涓媠id瀵瑰簲妯℃澘鍔熻兘鐨剆id - */ - private HashMap<String,String> sidMap = new HashMap<>(); - - public HashMap<String, String> getSidMap() { - return sidMap; - } - - public void setSidMap(HashMap<String, String> sidMap) { - this.sidMap = sidMap; - } - -// /** -// * 宸茬粡閰嶇疆鐨勮澶囩殑mac鍒楄〃 鏂扮殑鏂瑰紡涓嶉渶瑕佸湪杩欓噷璁板綍锛� 鍦ㄥ叾浠栧湴鏂硅褰� 2022骞�5鏈�22鏃� 22:40:33 -// */ -// private List<String> matchMacList = new ArrayList<>(); -// -// public List<String> getMatchMacList() { -// if (matchMacList == null) { -// return new ArrayList<>(); -// } -// return matchMacList; -// } - - /** - * 淇濆瓨鏈湴鏃朵娇鐢ㄧ殑ID - */ - private String localId; - public String getLocalId() { - if(localId == null || localId.equals("")){ - localId = UUID.randomUUID().toString().replace("-",""); - } - return localId; - } - - public void setLocalId(String localId) { - this.localId = localId; - } - - - public String getTemplateExtendsId() { - return templateExtendsId == null ? "" : templateExtendsId; - } - public void setTemplateExtendsId(String templateExtendsId) { - this.templateExtendsId = templateExtendsId; - } - - public String getTemplateName() { - return templateName == null ? "" : templateName; - } - - public void setTemplateName(String templateName) { - this.templateName = templateName; - } - - public String getProjectType() { - return projectType == null ? "" : projectType; - } - - public void setProjectType(String projectType) { - this.projectType = projectType; - } - - public String getHouseLayoutId() { - return houseLayoutId == null ? "" : houseLayoutId; - } - - public void setHouseLayoutId(String houseLayoutId) { - this.houseLayoutId = houseLayoutId; - } - - public String getHouseLayoutName() { - return houseLayoutName == null ? "" : houseLayoutName; - } - - public void setHouseLayoutName(String houseLayoutName) { - this.houseLayoutName = houseLayoutName; - } - - public String getTemplateSourcePlatform() { - return templateSourcePlatform == null ? "" : templateSourcePlatform; - } - - public void setTemplateSourcePlatform(String templateSourcePlatform) { - this.templateSourcePlatform = templateSourcePlatform; - } - - public String getTemplateSourceDesc() { - return templateSourceDesc == null ? "" : templateSourceDesc; - } - - public void setTemplateSourceDesc(String templateSourceDesc) { - this.templateSourceDesc = templateSourceDesc; - } - - public String getModifyTime() { - return modifyTime == null ? "" : modifyTime; - } - - public void setModifyTime(String modifyTime) { - this.modifyTime = modifyTime; - } - - private boolean inLocal = false; - private boolean inCloud = false; - - public boolean isInLocal() { - return inLocal; - } - - public void setInLocal(boolean inLocal) { - this.inLocal = inLocal; - } - - public boolean isInCloud() { - return inCloud; - } - - public void setInCloud(boolean inCloud) { - this.inCloud = inCloud; - } - - //缃戝叧娑堟伅 - private List<TemplateGatewayBean> gatewayList = new ArrayList<>(); - //鎴块棿淇℃伅 - private List<TemplateRoomPackBean.TemplateRoomInfoBean> spatilaInfo = new ArrayList<>(); - //璁惧淇℃伅 - private List<TemplateDeviceBean> deviceList = new ArrayList<>(); - //鍔熻兘淇℃伅 - private List<TemplateFunctionBean> functionList = new ArrayList<>(); - //鍦烘櫙淇℃伅 - private List<TemplateSceneBean> sceneList = new ArrayList<>(); - //瀹夐槻淇℃伅 - private List<TemplateSecurityBean> securityList = new ArrayList<>(); - - //鑷姩鍖栦俊鎭� - private List<TemplateLogicBean> logicList = new ArrayList<>(); - - - public List<TemplateGatewayBean> getGatewayList() { - if (gatewayList == null) { - return new ArrayList<>(); - } - return gatewayList; - } - - public void setGatewayList(List<TemplateGatewayBean> gatewayList) { - this.gatewayList = gatewayList; - } - - public List<TemplateRoomPackBean.TemplateRoomInfoBean> getSpatilaInfo() { - if (spatilaInfo == null) { - return new ArrayList<>(); - } - return spatilaInfo; - } - - public List<TemplateRoomPackBean.TemplateRoomInfoBean> getRoomList() { - List<TemplateRoomPackBean.TemplateRoomInfoBean> roomInfoBeans = new ArrayList<>(); - for (TemplateRoomPackBean.TemplateRoomInfoBean bean : getSpatilaInfo()) { -// if (bean.getRoomType().equals("ROOM")) - { - roomInfoBeans.add((bean)); - } - } - return roomInfoBeans; - } - - public List<TemplateRoomPackBean.TemplateRoomInfoBean> getFloorList() { - List<TemplateRoomPackBean.TemplateRoomInfoBean> roomInfoBeans = new ArrayList<>(); - for (TemplateRoomPackBean.TemplateRoomInfoBean bean : getSpatilaInfo()) { - if (bean.getRoomType().equals("FLOOR")) - { - roomInfoBeans.add((bean)); - } - } - return roomInfoBeans; - } - - public void setSpatilaInfo(List<TemplateRoomPackBean.TemplateRoomInfoBean> spatilaInfo) { - this.spatilaInfo = spatilaInfo; - } - - /** - * 妯℃澘璁惧鍒楄〃 - * @return 妯℃澘璁惧鍒楄〃 - */ - public List<TemplateDeviceBean> getDeviceList() { - if (deviceList == null) { - return new ArrayList<>(); - } - return deviceList; - } - - public void setDeviceList(List<TemplateDeviceBean> deviceList) { - this.deviceList = deviceList; - } - - public List<TemplateFunctionBean> getFunctionList() { - if (functionList == null) { - return new ArrayList<>(); - } - return functionList; - } - - public void setFunctionList(List<TemplateFunctionBean> functionList) { - this.functionList = functionList; - } - - public List<TemplateSceneBean> getSceneList() { - if (sceneList == null) { - return new ArrayList<>(); - } - return sceneList; - } - - public void setSceneList(List<TemplateSceneBean> sceneList) { - this.sceneList = sceneList; - } - - public List<TemplateLogicBean> getLogicList() { - if (logicList == null) { - return new ArrayList<>(); - } - return logicList; - } - - public void setLogicList(List<TemplateLogicBean> logicList) { - this.logicList = logicList; - } - - - public List<TemplateSecurityBean> getSecurityList() { - if (securityList == null) { - return new ArrayList<>(); - } - return securityList; - } - - public void setSecurityList(List<TemplateSecurityBean> securityList) { - this.securityList = securityList; - } - - - - - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateDeviceBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateDeviceBean.java deleted file mode 100644 index 5397f61..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateDeviceBean.java +++ /dev/null Binary files differ diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateDeviceExtInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateDeviceExtInfoBean.java deleted file mode 100644 index 22d48f9..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateDeviceExtInfoBean.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean;/* - *create by wxr - *date 2022/3/1 - */ - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -public class TemplateDeviceExtInfoBean implements Serializable { - private List<String> deviceDir = new ArrayList<>(); - - private HashMap<String,String> deviceCommand = new HashMap<>(); - - public List<String> getDeviceDir() { - if (deviceDir == null) { - return new ArrayList<>(); - } - return deviceDir; - } - - public void setDeviceDir(List<String> deviceDir) { - this.deviceDir = deviceDir; - } - - public HashMap<String, String> getDeviceCommand() { - return deviceCommand; - } - - public void setDeviceCommand(HashMap<String, String> deviceCommand) { - this.deviceCommand = deviceCommand; - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateFunctionBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateFunctionBean.java deleted file mode 100644 index cd7f4ff..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateFunctionBean.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean;/* - *create by wxr - *date 2022/1/19 - */ - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -public class TemplateFunctionBean implements Serializable { - //鎴块棿 - private List<String> uids = new ArrayList<>(); - //鍔熻兘Id - private String sid; - //鍔熻兘鍚嶇О - private String name; - //鍔熻兘绫诲瀷 - private String spk; - //璁惧瀵瑰簲鐨刼id - private String oid; - //鐗╃悊璁惧(妯″潡)鍨嬪彿 false闈炲繀椤� - private String omodel; - //-- extend 鎵╁睍淇℃伅 false闈炲繀椤� - private String extend; - - public List<String> getUids() { - return uids; - } - - public void setUids(List<String> uids) { - this.uids = uids; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSpk() { - return spk == null ? "" : spk; - } - - public void setSpk(String spk) { - this.spk = spk; - } - - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(String oid) { - this.oid = oid; - } - - public String getOmodel() { - return omodel == null ? "" : omodel; - } - - public void setOmodel(String omodel) { - this.omodel = omodel; - } - - public String getExtend() { - return extend == null ? "" : extend; - } - - public void setExtend(String extend) { - this.extend = extend; - } - - public List<TemplateFunctionAttribute> getAttributes() { - if (attributes == null) { - return new ArrayList<>(); - } - return attributes; - } - - public void setAttributes(List<TemplateFunctionAttribute> attributes) { - this.attributes = attributes; - } - - //灞炴�� false闈炲繀椤� - private List<TemplateFunctionAttribute> attributes = new ArrayList<>(); - - - /** - * 鍔熻兘灞炴�у璞� - */ - public static class TemplateFunctionAttribute implements Serializable { - //---- key 鏍囪瘑 false闈炲繀椤� - private String key; - //---- data_type 鏁版嵁绫诲瀷 false闈炲繀椤� - private String data_type; - //---- value 鍊� false闈炲繀椤� - private List<String> value = new ArrayList<>(); - //---- max 鏈�澶� false闈炲繀椤� - private String max; - //---- min 鏈�灏� false闈炲繀椤� - private String min; - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getData_type() { - return data_type; - } - - public void setData_type(String data_type) { - this.data_type = data_type; - } - - public List<String> getValue() { - if (value == null) { - return new ArrayList<>(); - } - return value; - } - - public void setValue(@NonNull List<String> value) { - this.value = value; - } - - public String getMax() { - return max; - } - - public void setMax(String max) { - this.max = max; - } - - public String getMin() { - return min; - } - - public void setMin(String min) { - this.min = min; - } - - public String getSort() { - return sort; - } - - public void setSort(String sort) { - this.sort = sort; - } - - //---- sort 鎺掑簭 false闈炲繀椤� - private String sort; - - } - - -} - diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateGatewayBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateGatewayBean.java deleted file mode 100644 index b2de95e..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateGatewayBean.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean;/* - *create by wxr - *date 2022/2/15 - */ - -import java.io.Serializable; - -public class TemplateGatewayBean implements Serializable { - - /** - * 缃戝叧鍨嬪彿 - */ - private String deviceModel; - /** - * 缃戝叧澶囨敞 - */ - private String deviceName; - /** - * 缃戝叧oid - */ - private String oid; - /** - * 鏄惁涓荤綉鍏� true false - */ - private String master; - /** - * 鏄惁鍔犲瘑 - */ - private boolean isLocalEncrypt; - /** - * 鏄惁鏈湴缃戝叧 - */ - private boolean isLocalGateWay; - - /** - * 鐪熷疄鐨勮澶噈ac - */ - private String realDeviceMac = ""; - - public String getRealDeviceMac() { - return realDeviceMac == null ? "" : realDeviceMac; - } - - public void setRealDeviceMac(String realDeviceMac) { - this.realDeviceMac = realDeviceMac; - } - - public String getDeviceModel() { - return deviceModel == null ? "" : deviceModel; - } - - public void setDeviceModel(String deviceModel) { - this.deviceModel = deviceModel; - } - - public String getDeviceName() { - return deviceName == null ? "" : deviceName; - } - - public void setDeviceName(String deviceName) { - this.deviceName = deviceName; - } - - public String getOid() { - return oid == null ? "" : oid; - } - - public void setOid(String oid) { - this.oid = oid; - } - - public String getMaster() { - return master == null ? "" : master; - } - - public void setMaster(String master) { - this.master = master; - } - - public boolean isLocalEncrypt() { - return isLocalEncrypt; - } - - public void setLocalEncrypt(boolean localEncrypt) { - isLocalEncrypt = localEncrypt; - } - - public boolean isLocalGateWay() { - return isLocalGateWay; - } - - public void setLocalGateWay(boolean localGateWay) { - isLocalGateWay = localGateWay; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateListResponseBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateListResponseBean.java deleted file mode 100644 index 06eac28..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateListResponseBean.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean; -/* - *create by wxr - *date 2022/1/23 - */ - -import java.util.ArrayList; -import java.util.List; - -public class TemplateListResponseBean { - private List<TemplateBean> list = new ArrayList<>(); - private int totalCount; - private int totalPage; - private int pageNo; - private int pageSize; - - public List<TemplateBean> getList() { - if (list == null) { - return new ArrayList<>(); - } - return list; - } - - public void setList(List<TemplateBean> list) { - this.list = list; - } - - public int getTotalCount() { - return totalCount; - } - - public void setTotalCount(int totalCount) { - this.totalCount = totalCount; - } - - public int getTotalPage() { - return totalPage; - } - - public void setTotalPage(int totalPage) { - this.totalPage = totalPage; - } - - public int getPageNo() { - return pageNo; - } - - public void setPageNo(int pageNo) { - this.pageNo = pageNo; - } - - public int getPageSize() { - return pageSize; - } - - public void setPageSize(int pageSize) { - this.pageSize = pageSize; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateLogicBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateLogicBean.java deleted file mode 100644 index 0950b5a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateLogicBean.java +++ /dev/null @@ -1,338 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -import androidx.annotation.NonNull; - -public class TemplateLogicBean implements Serializable { - //-- sid 鑷姩鍖栬澶囩 true string - private String sid; - //-- name 鑷姩鍖栧悕绉� true string - private String name; - //-- image 鍦烘櫙鍥剧墖 false string - private String image; - //-- tag 鍦烘櫙绫诲瀷 false string - private String tag; - //-- conditionLable 鑷姩鍖栨爣绛� false array<string> - private ArrayList<String> conditionLable = new ArrayList<>(); - //-- push_customer_message 鑷姩鍖栨墽琛屾帹閫佷俊鎭� false string - private String push_customer_message; - //-- relation 瑙﹀彂鏉′欢鍏崇郴 false array<long> - private String relation ; - //-- enable 鍚敤绂佺敤 true string - private boolean enable; - //-- cycle 鎵ц鍛ㄦ湡 false string - private TemplateLogicCycleBean cycle; - //---- type 閿� false string - //---- value 鍊� false array<string> - - //-- input 鑷姩鍖栬Е鍙戞潯浠� false array<object> - private List<TemplateLogicInputBean> input = new ArrayList<>(); - //---- sid sid false string - //---- condition_type 鏉′欢绫诲瀷 false string - //---- condition 鏉′欢 false array<object> - //------ key 鏉′欢key false string - //------ comparator 姣旇緝 false string - //------ data_type 鏁版嵁绫诲瀷 false string - //------ value 鏉′欢鍊� false string - - //-- output 鑷姩鍖栨墽琛屽姩浣� false string - private ArrayList<TemplateLogicOutputBean> output = new ArrayList<>(); - //---- sid sid false string - //---- target_type 鐩爣绫诲瀷 false string - //----- status 鍔ㄤ綔 false array<object> - //------- key 閿� false string - //------- value 鍊� false string - - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(String name) { - this.name = name; - } - - public String getImage() { - return image == null ? "" : image; - } - - public void setImage(String image) { - this.image = image; - } - - public String getTag() { - return tag == null ? "" : tag; - } - - public void setTag(String tag) { - this.tag = tag; - } - - public ArrayList<String> getConditionLable() { - if (conditionLable == null) { - return new ArrayList<>(); - } - return conditionLable; - } - - public void setConditionLable(ArrayList<String> conditionLable) { - this.conditionLable = conditionLable; - } - - public String getPush_customer_message() { - return push_customer_message == null ? "" : push_customer_message; - } - - public void setPush_customer_message(String push_customer_message) { - this.push_customer_message = push_customer_message; - } - - public String getRelation() { - return relation; - } - - public void setRelation(String relation) { - this.relation = relation; - } - - public boolean isEnable() { - return enable; - } - - public void setEnable(boolean enable) { - this.enable = enable; - } - - public TemplateLogicCycleBean getCycle() { - return cycle; - } - - public void setCycle(TemplateLogicCycleBean cycle) { - this.cycle = cycle; - } - - public List<TemplateLogicInputBean> getInput() { - if (input == null) { - return new ArrayList<>(); - } - return input; - } - - public void setInput(List<TemplateLogicInputBean> input) { - this.input = input; - } - - public ArrayList<TemplateLogicOutputBean> getOutput() { - if (output == null) { - return new ArrayList<>(); - } - return output; - } - - public void setOutput(ArrayList<TemplateLogicOutputBean> output) { - this.output = output; - } - - public static class TemplateLogicCycleBean { - - //---- type 閿� false string - private String type; - - //---- value 鍊� false array<string> - private List<String> value = new ArrayList<>(); - - public String getType() { - return type == null ? "" : type; - } - - public void setType(String type) { - this.type = type; - } - - public List<String> getValue() { - if (value == null) { - return new ArrayList<>(); - } - return value; - } - - public void setValue(List<String> value) { - this.value = value; - } - } - - public static class TemplateLogicInputBean { - - //---- sid sid false string - private String sid; - - //---- condition_type 鏉′欢绫诲瀷 false string - private String condition_type; - - //---- condition 鏉′欢 false array<object> - private ArrayList<TemplateLogicInputConditionBean> condition = new ArrayList<>(); - - public String getSid() { - return sid == null ? "0301056295720F16150100080000" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getCondition_type() { - return condition_type == null ? "" : condition_type; - } - - public void setCondition_type(String condition_type) { - this.condition_type = condition_type; - } - - public ArrayList<TemplateLogicInputConditionBean> getCondition() { - if (condition == null) { - return new ArrayList<>(); - } - return condition; - } - - public void setCondition(ArrayList<TemplateLogicInputConditionBean> condition) { - this.condition = condition; - } - } - - public static class TemplateLogicInputConditionBean { - //------ key 鏉′欢key false string - private String key; - - //------ comparator 姣旇緝 false string - private String comparator; - - //------ data_type 鏁版嵁绫诲瀷 false string - private String data_type; - - //------ value 鏉′欢鍊� false string - private String value; - - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getComparator() { - return comparator == null ? "" : comparator; - } - - public void setComparator(String comparator) { - this.comparator = comparator; - } - - public String getData_type() { - return data_type == null ? "" : data_type; - } - - public void setData_type(String data_type) { - this.data_type = data_type; - } - - public String getValue() { - return value == null ? "" : value; - } - - public void setValue(String value) { - this.value = value; - } - } - - public static class TemplateLogicOutputBean { - //---- sid sid false string - private String sid; - //---- target_type 鐩爣绫诲瀷 false string - private String target_type; - //----- status 鍔ㄤ綔 false array<object> - private ArrayList<TemplateLogicOutputStatusBean> status = new ArrayList<>(); - - private String name; - - private String delay; - - - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getTarget_type() { - return target_type == null ? "" : target_type; - } - - public void setTarget_type(String target_type) { - this.target_type = target_type; - } - - public ArrayList<TemplateLogicOutputStatusBean> getStatus() { - if (status == null) { - return new ArrayList<>(); - } - return status; - } - - public void setStatus(ArrayList<TemplateLogicOutputStatusBean> status) { - this.status = status; - } - } - public static class TemplateLogicOutputStatusBean { - //------- key 閿� false string - private String key; - //------- value 鍊� false string - private String value; - - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value == null ? "" : value; - } - - public void setValue(String value) { - this.value = value; - } - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateRoomPackBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateRoomPackBean.java deleted file mode 100644 index 0413813..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateRoomPackBean.java +++ /dev/null @@ -1,89 +0,0 @@ - -package com.hdl.linkpm.sdk.template.bean; -/* - *create by wxr - *date 2022/2/10 - */ - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; - -public class TemplateRoomPackBean implements Serializable { - private String templateExtendsId;// 妯℃澘id string - - //鍖哄煙闆嗗悎 - private List<TemplateRoomInfoBean> roomInfos = new ArrayList<>(); - - public String getTemplateExtendsId() { - return templateExtendsId == null ? "" : templateExtendsId; - } - - public void setTemplateExtendsId(String templateExtendsId) { - this.templateExtendsId = templateExtendsId; - } - - public List<TemplateRoomInfoBean> getRoomInfos() { - if (roomInfos == null) { - return new ArrayList<>(); - } - return roomInfos; - } - - public void setRoomInfos(List<TemplateRoomInfoBean> roomInfos) { - this.roomInfos = roomInfos; - } - - public static class TemplateRoomInfoBean implements Serializable{ -// -- name 妯℃澘鎴块棿鍚嶇О true string - private String name; -// -- roomImage 妯℃澘鎴块棿鍥剧墖 false string - private String roomImage; -// -- uid 鎴块棿鍞竴鏍囪瘑 true string - private String uid; -// -- roomType 鎴块棿绫诲瀷 [ROOM,FLOOR] true string - private String roomType; -// -- parentId 妤煎眰id false string - private String parentId; - - public String getName() { - return name == null ? "" : name; - } - - public void setName(String name) { - this.name = name; - } - - public String getRoomImage() { - return roomImage == null ? "" : roomImage; - } - - public void setRoomImage(String roomImage) { - this.roomImage = roomImage; - } - - public String getUid() { - return uid == null ? "" : uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getRoomType() { - return roomType == null ? "" : roomType; - } - - public void setRoomType(String roomType) { - this.roomType = roomType; - } - - public String getParentId() { - return parentId == null ? "" : parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateSceneBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateSceneBean.java deleted file mode 100644 index 5f0e350..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateSceneBean.java +++ /dev/null @@ -1,222 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.List; - -public class TemplateSceneBean implements Serializable { - private String name;//鍦烘櫙鍚嶇О - private String sid;//link璁惧sid - private String image;//鍦烘櫙鍥剧墖 - private String sceneType;//鍦烘櫙绫诲瀷 - private List<String> uids = new ArrayList<>();//鎴块棿uid - private transient List<String> roomIds = new ArrayList<>();//鎴块棿id - private String delay;//鍦烘櫙寤舵椂 - private String group;//鍦烘櫙鍒嗙粍 - private List<TemplateSceneFunctionBean> functions = new ArrayList<>();//鍦烘櫙鍔熻兘 - private boolean can_delete; - private ArrayList<TemplateSceneImageBean> imageBeans = new ArrayList<>(); - - public boolean isCan_delete() { - return can_delete; - } - - public void setCan_delete(boolean can_delete) { - this.can_delete = can_delete; - } - - public ArrayList<TemplateSceneImageBean> getImageBeans() { - if (imageBeans == null) { - return new ArrayList<>(); - } - return imageBeans; - } - - public void setImageBeans(ArrayList<TemplateSceneImageBean> imageBeans) { - this.imageBeans = imageBeans; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(String name) { - this.name = name; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getImage() { - return image == null ? "" : image; - } - - public void setImage(String image) { - this.image = image; - } - - public String getSceneType() { - return sceneType == null ? "" : sceneType; - } - - public void setSceneType(String sceneType) { - this.sceneType = sceneType; - } - - public List<String> getUids() { - if (uids == null) { - return new ArrayList<>(); - } - return uids; - } - - public void setUids(List<String> uids) { - this.uids = uids; - } - - public List<String> getRoomIds() { - if (roomIds == null) { - return new ArrayList<>(); - } - return roomIds; - } - - public void setRoomIds(List<String> roomIds) { - this.roomIds = roomIds; - } - - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(String delay) { - this.delay = delay; - } - - public String getGroup() { - return group == null ? "" : group; - } - - public void setGroup(String group) { - this.group = group; - } - - public List<TemplateSceneFunctionBean> getFunctions() { - if (functions == null) { - return new ArrayList<>(); - } - return functions; - } - - public void setFunctions(List<TemplateSceneFunctionBean> functions) { - this.functions = functions; - } - - public void addFunction(TemplateSceneFunctionBean function){ - this.functions.add(function); - } - - - /** - * 鍦烘櫙鐨勫姛鑳藉璞� - */ - public static class TemplateSceneFunctionBean implements Serializable { - private String sid;// link璁惧sid string - private String delay;// 寤惰繜鏃堕棿 string - private List<TemplateSceneFunctionStateBean> status = new ArrayList<>();// 璁惧鍔ㄤ綔 array<object> - - public String getSid() { - return sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getDelay() { - return delay; - } - - public void setDelay(String delay) { - this.delay = delay; - } - - public List<TemplateSceneFunctionStateBean> getStatus() { - return status; - } - - public void setStatus(List<TemplateSceneFunctionStateBean> status) { - this.status = status; - } - - public void addStatus(TemplateSceneFunctionStateBean stateBean){ - this.status.add(stateBean); - } - } - - /** - * 鍦烘櫙鐨勫姛鑳界殑灞炴�ц缃姸鎬� - */ - public static class TemplateSceneFunctionStateBean implements Serializable { - private String key; - private String value; - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } - - public static class TemplateSceneImageBean - { - private String imageId; - - private String cloudUrl; - - private String localUrl; - - public String getImageId() { - return imageId == null ? "" : imageId; - } - - public void setImageId(String imageId) { - this.imageId = imageId; - } - - public String getCloudUrl() { - return cloudUrl == null ? "" : cloudUrl; - } - - public void setCloudUrl(String cloudUrl) { - this.cloudUrl = cloudUrl; - } - - public String getLocalUrl() { - return localUrl == null ? "" : localUrl; - } - - public void setLocalUrl(String localUrl) { - this.localUrl = localUrl; - } - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateSecurityBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateSecurityBean.java deleted file mode 100644 index cc7a44a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/bean/TemplateSecurityBean.java +++ /dev/null @@ -1,275 +0,0 @@ -package com.hdl.linkpm.sdk.template.bean; - -import java.io.Serializable; -import java.util.ArrayList; - -import androidx.annotation.NonNull; - -public class TemplateSecurityBean implements Serializable { - // - private String sid; - //瀹夐槻鍚嶇О - private String name; - //enable甯冮槻銆乨isable鎾掗槻 - private String status; - //瀹夐槻绫诲瀷 - //"all"--鍏ㄥ畢甯冮槻锛�"normal"--鏅�氭ā寮�,"all_day":24灏忔椂,"mute"锛氶潤闊� - private String type; - - private String delay; - - private ArrayList<SecurityInput> input = new ArrayList<>(); - - private String output_delay; - - private ArrayList<SecurityOutput> output = new ArrayList<>(); - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getName() { - return name == null ? "" : name; - } - - public void setName(String name) { - this.name = name; - } - - public String getStatus() { - return status == null ? "" : status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getType() { - return type == null ? "" : type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(String delay) { - this.delay = delay; - } - - public ArrayList<SecurityInput> getInput() { - if (input == null) { - return new ArrayList<>(); - } - return input; - } - - public void setInput(ArrayList<SecurityInput> input) { - this.input = input; - } - - public String getOutput_delay() { - return output_delay == null ? "" : output_delay; - } - - public void setOutput_delay(String output_delay) { - this.output_delay = output_delay; - } - - public ArrayList<SecurityOutput> getOutput() { - if (output == null) { - return new ArrayList<>(); - } - return output; - } - - public void setOutput(ArrayList<SecurityOutput> output) { - this.output = output; - } - - public class SecurityOutput implements Serializable - { - private String target_type; - - private String sid; - - private ArrayList<OutputStatus> status = new ArrayList<OutputStatus>(); - - public String getTarget_type() { - return target_type == null ? "" : target_type; - } - - private String delay; - public String getDelay() { - return delay == null ? "" : delay; - } - - public void setDelay(@NonNull String delay) { - this.delay = delay; - } - - - public void setTarget_type(String target_type) { - this.target_type = target_type; - } - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public ArrayList<OutputStatus> getStatus() { - return status; - } - - public void setStatus(ArrayList<OutputStatus> status) { - this.status = status; - } - - public class OutputStatus - { - private String key; - - private String value; - - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value == null ? "" : value; - } - - public void setValue(String value) { - this.value = value; - } - } - } - - public class SecurityInput implements Serializable - { - private String sid; - - private String bypass; - - private ArrayList<InputCondition> condition = new ArrayList<>(); - - private ArrayList<InputStatus> status = new ArrayList<>(); - - public String getSid() { - return sid == null ? "" : sid; - } - - public void setSid(String sid) { - this.sid = sid; - } - - public String getBypass() { - return bypass == null ? "" : bypass; - } - - public void setBypass(String bypass) { - this.bypass = bypass; - } - - public ArrayList<InputCondition> getCondition() { - if (condition == null) { - return new ArrayList<>(); - } - return condition; - } - - public void setCondition(ArrayList<InputCondition> condition) { - this.condition = condition; - } - - public ArrayList<InputStatus> getStatus() { - return status; - } - - public void setStatus(ArrayList<InputStatus> status) { - this.status = status; - } - - public class InputStatus implements Serializable - { - private String key; - - private String value; - - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value == null ? "" : value; - } - - public void setValue(String value) { - this.value = value; - } - } - - public class InputCondition implements Serializable - { - private String key; - - private String comparator; - - private String data_type; - - private String value; - - public String getKey() { - return key == null ? "" : key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getComparator() { - return comparator == null ? "" : comparator; - } - - public void setComparator(String comparator) { - this.comparator = comparator; - } - - public String getData_type() { - return data_type == null ? "" : data_type; - } - - public void setData_type(String data_type) { - this.data_type = data_type; - } - - public String getValue() { - return value == null ? "" : value; - } - - public void setValue(String value) { - this.value = value; - } - } - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ICreateTemplateCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ICreateTemplateCallBack.java deleted file mode 100644 index c85f36a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ICreateTemplateCallBack.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; - -public interface ICreateTemplateCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(String templateId); - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateDeviceListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateDeviceListCallBack.java deleted file mode 100644 index e43cb9d..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateDeviceListCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/2/11 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateDevice; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateSpatialInfo; - -import java.util.List; - -public interface IGetTemplateDeviceListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<CloudTemplateDevice> data); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateGatewayListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateGatewayListCallBack.java deleted file mode 100644 index 33831da..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateGatewayListCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/2/11 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateDevice; -import com.hdl.linkpm.sdk.template.bean.TemplateGatewayBean; - -import java.util.List; - -public interface IGetTemplateGatewayListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<TemplateGatewayBean> data); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateSpatialInfoCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateSpatialInfoCallBack.java deleted file mode 100644 index 0da7fbe..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/IGetTemplateSpatialInfoCallBack.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/2/11 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateSpatialInfo; - -import java.util.List; - -public interface IGetTemplateSpatialInfoCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<CloudTemplateSpatialInfo> data); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateFunctionsCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateFunctionsCallBack.java deleted file mode 100644 index ff5bbd8..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateFunctionsCallBack.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/1/19 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.TemplateFunctionBean; - -import java.util.List; - -public interface ITemplateFunctionsCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<TemplateFunctionBean> templateFunctionBean); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateListCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateListCallBack.java deleted file mode 100644 index 92b5429..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateListCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/1/19 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.TemplateFunctionBean; -import com.hdl.linkpm.sdk.template.bean.TemplateListResponseBean; - -import java.util.List; - -public interface ITemplateListCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(TemplateListResponseBean templateListResponseBean); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateLogicCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateLogicCallBack.java deleted file mode 100644 index 598135d..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateLogicCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/2/12 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.TemplateLogicBean; -import com.hdl.linkpm.sdk.template.bean.TemplateSceneBean; - -import java.util.List; - -public interface ITemplateLogicCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<TemplateLogicBean> data); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateScenesCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateScenesCallBack.java deleted file mode 100644 index 0845ef6..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateScenesCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/2/12 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.TemplateFunctionBean; -import com.hdl.linkpm.sdk.template.bean.TemplateSceneBean; - -import java.util.List; - -public interface ITemplateScenesCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<TemplateSceneBean> data); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateSecurityCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateSecurityCallBack.java deleted file mode 100644 index 04af1ca..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateSecurityCallBack.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/2/12 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.TemplateLogicBean; -import com.hdl.linkpm.sdk.template.bean.TemplateSecurityBean; - -import java.util.List; - -public interface ITemplateSecurityCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<TemplateSecurityBean> data); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateSpatialInfoCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateSpatialInfoCallBack.java deleted file mode 100644 index 39739ad..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/callback/ITemplateSpatialInfoCallBack.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.hdl.linkpm.sdk.template.callback;/* - *create by wxr - *date 2022/2/11 - */ - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.template.bean.TemplateRoomPackBean; - -import java.util.List; - -public interface ITemplateSpatialInfoCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(List<TemplateRoomPackBean> templateRoomPackBeans); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/controller/HDLTemplateController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/controller/HDLTemplateController.java deleted file mode 100644 index 090fec5..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/template/controller/HDLTemplateController.java +++ /dev/null @@ -1,642 +0,0 @@ -package com.hdl.linkpm.sdk.template.controller;/* - *create by wxr - *date 2022/1/19 - */ - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.HDLLinkPMSdk; -import com.hdl.linkpm.sdk.core.api.HDLCloudUserApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateDevice; -import com.hdl.linkpm.sdk.template.bean.CloudTemplateSpatialInfo; -import com.hdl.linkpm.sdk.template.bean.TemplateDeviceBean; -import com.hdl.linkpm.sdk.template.bean.TemplateFunctionBean; -import com.hdl.linkpm.sdk.template.bean.TemplateGatewayBean; -import com.hdl.linkpm.sdk.template.bean.TemplateListResponseBean; -import com.hdl.linkpm.sdk.template.bean.TemplateLogicBean; -import com.hdl.linkpm.sdk.template.bean.TemplateRoomPackBean; -import com.hdl.linkpm.sdk.template.bean.TemplateSceneBean; -import com.hdl.linkpm.sdk.template.bean.TemplateSecurityBean; -import com.hdl.linkpm.sdk.template.callback.ICreateTemplateCallBack; -import com.hdl.linkpm.sdk.template.callback.IGetTemplateDeviceListCallBack; -import com.hdl.linkpm.sdk.template.callback.IGetTemplateGatewayListCallBack; -import com.hdl.linkpm.sdk.template.callback.IGetTemplateSpatialInfoCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateFunctionsCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateListCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateLogicCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateScenesCallBack; -import com.hdl.linkpm.sdk.template.callback.ITemplateSecurityCallBack; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; - -public class HDLTemplateController { - private volatile static HDLTemplateController instance; - - public static synchronized HDLTemplateController getInstance() { - if (instance == null) { - synchronized (HDLTemplateController.class) { - if (instance == null) { - instance = new HDLTemplateController(); - } - } - } - return instance; - } - - - /** - * 鍒涘缓妯℃澘 - * @param templateName - * @param communityCode - * @param houseLayoutId - * @param templateDesc - * @param callBack - * @return - */ - public Disposable CreateTemplate(String templateName, String communityCode, String houseLayoutId, String templateDesc, ICreateTemplateCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_CREATE; - JsonObject json = new JsonObject(); - json.addProperty("templateName", templateName); - json.addProperty("templateSourcePlatform", "app"); - json.addProperty("communityCode", communityCode); - json.addProperty("houseLayoutId", houseLayoutId); - json.addProperty("templateDesc", templateDesc); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - public Disposable GetTemplateList(int pageNo,int pageSize,ITemplateListCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_GET_LIST; - JsonObject json = new JsonObject(); - json.addProperty("pageNo",pageNo); - json.addProperty("pageSize",pageSize); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<TemplateListResponseBean>() { - @Override - public void onResponse(TemplateListResponseBean beans) { - if (callBack != null) { - callBack.onSuccess(beans); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - /** - * 鍒犻櫎妯℃澘 - * @param templateExtendsId 妯℃澘ID - * @param callBack - * @return - */ - public Disposable DeleteTemplate(String templateExtendsId,IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_DELETE; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鏇存柊缃戝叧鍒楄〃(鍏ㄩ噺) - * @param templateExtendsId - * @param gatewayBeans - * @param callBack - * @return - */ - public Disposable UpdateTemplateGateway(String templateExtendsId, List<TemplateGatewayBean> gatewayBeans,IDefaultCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_UPDATE_GATEWAY; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - json.add("beans", HDLGsonUtils.toJsonArray(gatewayBeans)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鏇存柊鎴块棿锛堟ゼ灞傦級淇℃伅(鍏ㄩ噺) - * @param templateExtendsId - * @param rooms - * @param callBack - * @return - */ - public Disposable UpdateTemplateRoom(String templateExtendsId ,List<TemplateRoomPackBean.TemplateRoomInfoBean> rooms, - IDefaultCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_UPDATE_ROOM; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - json.add("roomInfos", HDLGsonUtils.toJsonArray(rooms)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 娣诲姞璁惧(鍏ㄩ噺) - * @param templateExtendsId - * @param beans - * @param callBack - * @return - */ - public Disposable UpdateTemplateDevices(String templateExtendsId,List<TemplateDeviceBean> beans, - IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_UPDATE_DEVICES; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - json.add("beans", HDLGsonUtils.toJsonArray(beans)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 娣诲姞鍔熻兘(鍏ㄩ噺) - * @param templateExtendsId - * @param functionInfoList - * @param callBack - * @return - */ - public Disposable UpdateTemplateFunctions(String templateExtendsId, List<TemplateFunctionBean> functionInfoList, - IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_UPDATE_FUNCTIONS; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - json.add("deviceInfos", HDLGsonUtils.toJsonArray(functionInfoList)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鏇存柊妯℃澘鍦烘櫙(鍏ㄩ噺) - * @param templateExtendsId - * @param sceneBeans - * @param callBack - * @return - */ - public Disposable UpdataTemplateScenes(String templateExtendsId, List<TemplateSceneBean> sceneBeans, - IDefaultCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_UPDATE_SCENES; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - json.add("sceneInfos", HDLGsonUtils.toJsonArray(sceneBeans)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鏇存柊妯℃澘鑷姩鍖� (鍏ㄩ噺) - * @param templateExtendsId - * @param logicBeansJson - * @param callBack - * @return - */ - public Disposable UpdataTemplateLogic(String templateExtendsId, JsonElement logicBeansJson,// List<TemplateLogicBean> logicBeans, - IDefaultCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_UPDATE_LOGIC; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - json.add("logicInfos", logicBeansJson); -// json.add("logicInfos", HDLGsonUtils.toJsonArray(logicBeans)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鏇存柊妯℃澘瀹夐槻鍒楄〃 鍏ㄩ噺 - * @param templateExtendsId - * @param securityBeansJson - * @param callBack - * @return - */ - public Disposable UpdataTemplateSecurity(String templateExtendsId, JsonElement securityBeansJson,// List<TemplateLogicBean> logicBeans, - IDefaultCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPLATE_UPDATE_SECURITY; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - json.add("securityInfos", securityBeansJson); -// json.add("logicInfos", HDLGsonUtils.toJsonArray(logicBeans)); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鑾峰彇妯℃澘鍖哄煙淇℃伅鍒楄〃 - * @param templateExtendsId - * @param callBack - * @return - */ - public Disposable GetTemplateAreaSpatialInfo(String templateExtendsId, IGetTemplateSpatialInfoCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GET_TEMPLATE_SPATIAL_INFO; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<CloudTemplateSpatialInfo>>() { - @Override - public void onResponse(List<CloudTemplateSpatialInfo> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇缃戝叧鍒楄〃 - * @param templateExtendsId - * @param callBack - * @return - */ - public Disposable GetTemplateGatewayList(String templateExtendsId, IGetTemplateGatewayListCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GET_TEMPLATE_GATEWAY_LIST; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<TemplateGatewayBean>>() { - @Override - public void onResponse(List<TemplateGatewayBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇璁惧淇℃伅 - * @param templateExtendsId - * @param callBack - * @return - */ - public Disposable GetTemplateDeviceList(String templateExtendsId, IGetTemplateDeviceListCallBack callBack){ - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_TEMPALTE_GET_DEVICES; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<CloudTemplateDevice>>() { - @Override - public void onResponse(List<CloudTemplateDevice> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇鍔熻兘鍒楄〃 - * @param templateExtendsId - * @param callBack - * @return - */ - public Disposable GetTemplateFunctions(String templateExtendsId , ITemplateFunctionsCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GET_TEMPLATE_FUNCTION_LIST; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<TemplateFunctionBean>>() { - @Override - public void onResponse(List<TemplateFunctionBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇鍦烘櫙鍒楄〃 - * @param templateExtendsId - * @param callBack - * @return - */ - public Disposable GetTemplateScenes(String templateExtendsId , ITemplateScenesCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GET_TEMPLATE_SCENE_LIST; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<TemplateSceneBean>>() { - @Override - public void onResponse(List<TemplateSceneBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇瀹夐槻鍒楄〃 - * @param templateExtendsId - * @param callBack - * @return - */ - public Disposable GetTemplateSecurity(String templateExtendsId , ITemplateSecurityCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GET_TEMPLATE_SECURITY_LIST; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<TemplateSecurityBean>>() { - @Override - public void onResponse(List<TemplateSecurityBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鑾峰彇閫昏緫鍒楄〃 - * @param templateExtendsId - * @param callBack - * @return - */ - public Disposable GetTemplateLogic(String templateExtendsId , ITemplateLogicCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GET_TEMPLATE_LOGIC_LIST; - JsonObject json = new JsonObject(); - json.addProperty("templateExtendsId", templateExtendsId); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<List<TemplateLogicBean>>() { - @Override - public void onResponse(List<TemplateLogicBean> data) { - if (callBack != null) { - callBack.onSuccess(data); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/HDLLinkPMUser.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/HDLLinkPMUser.java deleted file mode 100644 index a26af67..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/HDLLinkPMUser.java +++ /dev/null @@ -1,542 +0,0 @@ -package com.hdl.linkpm.sdk.user; - -import android.text.TextUtils; - -import com.google.gson.JsonObject; -import com.google.gson.reflect.TypeToken; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IDefaultStrCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLErrorCode; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.user.bean.HDLLoginBean; -import com.hdl.linkpm.sdk.user.bean.HDLUserInfoBean; -import com.hdl.linkpm.sdk.user.bean.HDLUserRegionBean; -import com.hdl.linkpm.sdk.user.bean.ImageSubmitInfo; -import com.hdl.linkpm.sdk.user.bean.MqttInfo; -import com.hdl.linkpm.sdk.user.bean.NewVersionBean; -import com.hdl.linkpm.sdk.user.callback.ILoginCallBack; -import com.hdl.linkpm.sdk.user.callback.IMemberInfoBack; -import com.hdl.linkpm.sdk.user.callback.IOnReloginListener; -import com.hdl.linkpm.sdk.user.callback.IRegionByAccountCallBack; -import com.hdl.linkpm.sdk.user.controller.HDLPMUserController; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; -import com.hdl.linkpm.sdk.utils.HDLSDKLog; -import com.hdl.linkpm.sdk.utils.HDLSDKSPUtils; - -import java.io.File; -import java.util.Map; - -import io.reactivex.rxjava3.disposables.Disposable; - - -/** - * Created by jlchen on 12/2/21. - */ -public class HDLLinkPMUser { - private static final String TAG = "HDLLinkPMUser"; - private static final String HDLLINK_ISLOGIN_KEY = "hdllink_islogin";//鐧诲綍鐘舵�� - public static final String HDLLINK_USER_KEY = "hdllink_user";//鐢ㄦ埛淇℃伅 - private static final String HDLLINK_PUSHID_KEY = "hdllink_jpush_id";//鏋佸厜鎺ㄩ�佺粦瀹氬悗绔繑鍥瀒d - private static final String HDLLINK_ACCESSTOKEN_KEY = "hdllink_access_token";//鐢ㄦ埛token - private static final String HDLLINK_REFRESHTOKEN_KEY = "hdllink_refresh_token";//鐢ㄦ埛鍒锋柊token - private static final String HDLLINK_USERURL_KEY = "hdllink_user_url";//鐢ㄦ埛璇锋眰鍩熷悕鍦板潃 - private static final String HDLLINK_HOMEURL_KEY = "hdllink_home_url";//鐢ㄦ埛璇锋眰鍩熷悕鍦板潃 - /// 鐢ㄦ埛娉ㄥ唽鎵�鍦ㄦ湇鍔″櫒鍩熷悕鍦板潃 - private String userRegionUrl; - /// 浣忓畢鎵�鍦ㄦ湇鍔″櫒鍩熷悕鍦板潃 浣忓畢鐩稿叧鎺ュ彛閮界敤杩欎釜鍦板潃 - private String homeRegionUrl; - //鏄惁鐧诲綍鐘舵�� - private boolean isLogin = false; - /// 鐢ㄦ埛鏈夋晥韬唤Token - private String accessToken; - /// 鍒锋柊Token - private String refreshToken; - //鐧诲綍鎴愬姛鍚庣殑鐢ㄦ埛淇℃伅 - private HDLUserInfoBean mUser; - //褰撶敤鎴稟ccessToken 閿欒鍚庡彂鍑虹殑閫氱煡 鐧诲嚭澶勭悊 - private IOnReloginListener mOnReloginListener; - //instance - private volatile static HDLLinkPMUser instance; - - /** - * getInstance - * - * @return HDLSmartUser - */ - public static synchronized HDLLinkPMUser getInstance() { - if (instance == null) { - synchronized (HDLLinkPMUser.class) { - if (instance == null) { - instance = new HDLLinkPMUser(); - instance.loadData();//鍔犺浇缂撳瓨鐨凥DLUserBean瀵硅薄 - } - } - } - return instance; - } - - /** - * loadData 鍔犺浇缂撳瓨鐨凥DLUser瀵硅薄 - */ - private void loadData() { - //1. - isLogin = HDLSDKSPUtils.getBoolean(HDLLINK_ISLOGIN_KEY); - //2. - accessToken = HDLSDKSPUtils.getString(HDLLINK_ACCESSTOKEN_KEY); - //3. - refreshToken = HDLSDKSPUtils.getString(HDLLINK_REFRESHTOKEN_KEY); - //4. - userRegionUrl = HDLSDKSPUtils.getString(HDLLINK_USERURL_KEY); - //5. - homeRegionUrl = HDLSDKSPUtils.getString(HDLLINK_HOMEURL_KEY); - //6. - String userJsonStr = HDLSDKSPUtils.getString(HDLLINK_USER_KEY); - if (!TextUtils.isEmpty(userJsonStr)) //闃茬┖鍒ゆ柇 - { - mUser = HDLGsonUtils.fromJson(userJsonStr, new TypeToken<HDLUserInfoBean>() { - }.getType()); - if (mUser == null) { - saveLogin(false);//閲嶆柊鏍囪涓烘湭鐧诲綍 - } - } - } - - /** - * 鐧诲綍鎴愬姛鎴栬�呭埛鏂皌oken鍚� 淇濆瓨涓�娆DLUser瀵硅薄 - */ - private void saveHDLUserBean(HDLUserInfoBean user) { - String mUserJsonStr = HDLGsonUtils.toJson(user); //灏哃ist杞崲鎴怞son - HDLSDKSPUtils.put(HDLLINK_USER_KEY, mUserJsonStr); - } - - /** - * 淇濆瓨鏋佸厜鎺ㄩ�佺粦瀹氫箣鍚庣殑id - */ - public void saveHDLJpushId(String pushId) { - HDLSDKSPUtils.put(HDLLINK_PUSHID_KEY, pushId); - } - - /** - * 鑾峰彇鏋佸厜鎺ㄩ�佺粦瀹氫箣鍚庣殑id - */ - public String getHDLJpushId() { - return HDLSDKSPUtils.getString(HDLLINK_PUSHID_KEY); - } - - /** - * 淇濆瓨鐧诲綍鐘舵�� - * - * @param isLogin - */ - private void saveLogin(Boolean isLogin) { - HDLSDKSPUtils.put(HDLLINK_ISLOGIN_KEY, isLogin); - } - - /** - * 鐧诲綍鎴愬姛鍚庯紝鍒锋柊鍜屼繚瀛樼浉鍏崇敤鎴疯韩浠藉弬鏁� - * - * @param userBean - */ - private void loginSuccess(HDLLoginBean userBean) { - //1.淇濆瓨鐧诲綍鐘舵�� - saveLogin(true); - //2.淇濆瓨token - saveAccessToken(userBean.getHeaderPrefix() + userBean.getAccessToken()); - //3.淇濆瓨鍒锋柊token - saveRefreshToken(userBean.getRefreshToken()); - //4.淇濆瓨mUser瀵硅薄鍒扮紦瀛� - this.mUser = new HDLUserInfoBean(userBean); - saveHDLUserBean(this.mUser); - } - - private void saveAccessToken(String accessToken) { - this.accessToken = accessToken; - HDLSDKSPUtils.put(HDLLINK_ACCESSTOKEN_KEY, this.accessToken); - } - - private void saveRefreshToken(String refreshToken) { - this.refreshToken = refreshToken; - HDLSDKSPUtils.put(HDLLINK_REFRESHTOKEN_KEY, this.refreshToken); - } - - /** - * @param userBean - */ - public void updateRefreshToken(HDLLoginBean userBean) { - if (userBean == null) return; - //鍒锋柊token杩斿洖鐨勬暟鎹彲鑳戒笉甯ccount銆乽serPhone绛夌浉鍏冲弬鏁帮紝鎵�浠ヤ笉鑳芥洿鏂皍ser鍊笺�佸彧鏇存柊AccessToken鍜屽埛鏂癟oken鐨勫�煎氨濂戒簡 - //1.淇濆瓨鐧诲綍鐘舵�� - saveLogin(true); - //2.淇濆瓨token - saveAccessToken(userBean.getHeaderPrefix() + userBean.getAccessToken()); - //3.淇濆瓨鍒锋柊token - saveRefreshToken(userBean.getRefreshToken()); - } - - /** - * 娓呯┖鐧诲綍鐘舵�� - */ - private void removeAll() { - //1.璁剧疆鏈櫥褰曠姸鎬� - saveLogin(false); - //2.娓呯┖token - saveAccessToken(""); - //3.娓呯┖鍒锋柊token - saveRefreshToken(""); - //4.娓呯┖鐢ㄦ埛瀵硅薄 - saveHDLUserBean(new HDLUserInfoBean()); - } - - /** - * 閫氱煡閫�鍑洪噸鏂扮櫥褰� - * @param type: 0:姝e父閫�鍑� 1锛氭瀬鍏夋帹閫佸己鍒堕��鍑� - */ - private void notificationRelogin(int type) { - if (mOnReloginListener != null) { - mOnReloginListener.onReLogin(type); - } - } - - /** - * 閫�鍑虹櫥褰� - * @param type: 0:姝e父閫�鍑� 1锛氭瀬鍏夋帹閫佸己鍒堕��鍑� - */ - public void logout(int type) { - //1.娓呯┖鐧诲綍鐘舵�� - removeAll(); - //2.鍙戝嚭閲嶆柊鐧诲綍閫氱煡 - notificationRelogin(type); - } - - /****************************璇锋眰鎺ュ彛****************************/ - /** - * 鑾峰彇璐﹀彿鎵�鍦ㄥ尯鍩� - * - * @param account 璐﹀彿 - * @param callBack 缁撴灉鍥炶皟 - */ - public void regionByAccount(String account, IRegionByAccountCallBack callBack) { - HDLPMUserController.getInstance().regionByAccount(account, new IRegionByAccountCallBack() { - @Override - public void onSuccess(HDLUserRegionBean regionBean) { - if (regionBean != null) { - //鏌ヨ鎴愬姛璁板綍涓�娆� - setUserRegionUrl(regionBean.getRegionUrl()); - if (callBack != null) { - callBack.onSuccess(regionBean); - } - } else { - if (callBack != null) { - callBack.onFailure(HDLException.getErrorWithCode(HDLErrorCode.HDL_DATA_PARSING_ERROR)); - } - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 閫氳繃璐﹀彿鍜屽瘑鐮佺櫥褰� - * - * @param account 璐﹀彿 - * @param loginPwd 瀵嗙爜 - * @param callBack 缁撴灉鍥炶皟 - */ - public void loginByPassword(String account, String loginPwd, ILoginCallBack callBack) { - HDLPMUserController.getInstance().loginByPassword(account, loginPwd, new ILoginCallBack() { - @Override - public void onSuccess(HDLLoginBean loginBean) { - loginSuccess(loginBean); - if (callBack != null) { - callBack.onSuccess(loginBean); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /****************************璇锋眰鎺ュ彛****************************/ - /** - * 鑾峰彇璐﹀彿鎵�鍦ㄥ尯鍩� - * - * @param isBooleanB true=B,false=C - * @param account 璐﹀彿 - * @param callBack 缁撴灉鍥炶皟 - */ - public void regionByAccount(boolean isBooleanB, String account, IRegionByAccountCallBack callBack) { - HDLPMUserController.getInstance().regionByAccount(isBooleanB,account, new IRegionByAccountCallBack() { - @Override - public void onSuccess(HDLUserRegionBean regionBean) { - if (regionBean != null) { - //鏌ヨ鎴愬姛璁板綍涓�娆� - setUserRegionUrl(regionBean.getRegionUrl()); - if (callBack != null) { - callBack.onSuccess(regionBean); - } - } else { - if (callBack != null) { - callBack.onFailure(HDLException.getErrorWithCode(HDLErrorCode.HDL_DATA_PARSING_ERROR)); - } - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - - /** - * 閫氳繃璐﹀彿鍜屽瘑鐮佺櫥褰� - * - * @param isBooleanB true=B,false=C - * @param account 璐﹀彿 - * @param loginPwd 瀵嗙爜 - * @param callBack 缁撴灉鍥炶皟 - */ - public void loginByPassword(boolean isBooleanB, String account, String loginPwd, ILoginCallBack callBack) { - HDLPMUserController.getInstance().loginByPassword(isBooleanB, account, loginPwd, new ILoginCallBack() { - @Override - public void onSuccess(HDLLoginBean loginBean) { - loginSuccess(loginBean); - if (callBack != null) { - callBack.onSuccess(loginBean); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 鐧诲綍 - * 閫氳繃楠岃瘉鐮� - * - * @param account 鎵嬫満鎴栬�呴偖绠� - * @param vCode 楠岃瘉鐮� - * @param callBack 鍥炶皟 - * @return - */ - public void loginByCode(String account, String vCode, ILoginCallBack callBack) { - HDLPMUserController.getInstance().loginByCode(account, vCode, new ILoginCallBack() { - @Override - public void onSuccess(HDLLoginBean loginBean) { - loginSuccess(loginBean); - if (callBack != null) { - callBack.onSuccess(loginBean); - } - } - - @Override - public void onFailure(HDLException error) { - if (callBack != null) { - callBack.onFailure(error); - } - } - }); - } - - /** - * 閫氱敤 鍙戦�侀獙璇佺爜鏂规硶 - * LanguageTypeEnum CHINESE,ENGLISH - * - * @param verifyType 1:娉ㄥ唽 2锛氭壘鍥炲瘑鐮� 3锛氱粦瀹� 4:楠岃瘉鐮佺櫥闄� 5:鏁忔劅鏁版嵁 - * @param account 閭鎴栬�呮墜鏈哄彿 - * @param isPhone 鏄惁鎵嬫満 - * @param phoneZoneCode 鎵嬫満鍥藉鍖哄彿 - * @param languageType 璇█ - * @param callBack - * @return - */ - public void verificationCodeSend(int verifyType, String account, Boolean isPhone, String phoneZoneCode, String languageType, IDefaultCallBack callBack) { - HDLPMUserController.getInstance().verificationCodeSend(verifyType, account, isPhone, phoneZoneCode, languageType, callBack); - } - - /** - * 蹇樿瀵嗙爜锛岄噸缃瘑鐮� - * - * @param account 閭鎴栬�呮墜鏈哄彿 - * @param password 鏂板瘑鐮� - * @param vCode 楠岃瘉鐮� - * @param isPhone 鏄惁鎵嬫満 - * @param callBack 鍥炶皟 - */ - public void forgetPassword(String account, String password, String vCode, Boolean isPhone, IDefaultCallBack callBack) { - HDLPMUserController.getInstance().forgetPassword(account, password, vCode, isPhone, callBack); - } - - /** - * 鏇存敼涓汉瀵嗙爜 - * - * @param userId 褰撳墠鐢ㄦ埛ID - * @param loginOldPwd 鑰佸瘑鐮� - * @param loginPwd 鏂板瘑鐮� - * @param callBack 鍥炶皟 - */ - public void updateProgramPassword(String userId, String loginOldPwd, String loginPwd, IDefaultCallBack callBack) { - HDLPMUserController.getInstance().updateProgramPassword(userId, loginOldPwd, loginPwd, callBack); - } - - /** - * 鑾峰彇鐢ㄦ埛涓汉淇℃伅 - * - * @param callBack - */ - public void getMemberInfo(IMemberInfoBack callBack) { - HDLPMUserController.getInstance().getMemberInfo(callBack); - } - - /** - * 鏇存柊涓汉淇℃伅 - * memberHeadIcon銆乵emberName銆乵emberBirthday銆乴anguageType銆乵emberSex - * - * @param callBack - */ - public void updateMemberInfo(JsonObject updateInfo, IDefaultCallBack callBack) { - HDLPMUserController.getInstance().updateMemberInfo(updateInfo, callBack); - } - - /** - * 鑾峰彇鐢ㄦ埛澶村儚璺緞 - * - * @param memberHeadIconKey 鐢ㄦ埛澶村儚imageKey - * @param callBack - */ - public void getHeadImageUrl(String memberHeadIconKey, IDefaultStrCallBack callBack) { - HDLPMUserController.getInstance().getHeadImageUrl(memberHeadIconKey, callBack); - } - - /** - * 涓婁紶鐢ㄦ埛澶村儚 - * - * @param userId 鐢ㄦ埛id - * @param imageBytes 澶村儚鍥剧墖 - * @param callBack - * @return - */ - public void uploadUserHeadImage(String userId, byte[] imageBytes, IDefaultStrCallBack callBack) { - HDLPMUserController.getInstance().uploadUserHeadImage(userId, imageBytes, callBack); - } - - /** - * 涓婁紶鐢ㄦ埛澶村儚 - * - * @param file 鍥剧墖鏂囦欢 - * @param callBack - * @return - */ - public void uploadUserHeadImage(File file, IResponseCallBack<ImageSubmitInfo> callBack) { - HDLPMUserController.getInstance().uplfadUserHeadImage(file, callBack); - } - - - /** - * APP鐗堟湰妫�娴嬫洿鏂� - * - * @param appCode app缂栫爜 - * @param version 鐗堟湰鍙� - * @param callBack 濡傛灉onSuccess 鍥炶皟鐨刡ean涓虹┖锛屼唬琛ㄥ綋鍓嶇増鏈凡缁忔槸鏈�鏂扮増鏈紝娌℃湁鏂扮増鏈� - * @return - */ - public void checkAppVersion(String appCode, String version, IResponseCallBack<NewVersionBean> callBack) { - HDLPMUserController.getInstance().checkAppVersion(appCode, version, "Android", callBack); - } - - /** - * 灏忕▼搴弚gt鐗堟湰妫�娴嬫洿鏂� - * - * @param appCode app缂栫爜 - * @param wgtVersion 灏忕▼搴弚gt鐗堟湰鍙� - * @param callBack 濡傛灉onSuccess 鍥炶皟鐨刡ean涓虹┖锛屼唬琛ㄥ綋鍓嶇増鏈凡缁忔槸鏈�鏂扮増鏈紝娌℃湁鏂扮増鏈� - * @return - */ - public void checkWgtVersion(String appCode, String wgtVersion, IResponseCallBack<NewVersionBean> callBack) { - HDLPMUserController.getInstance().checkAppVersion(appCode, wgtVersion,"wgt", callBack); - } - - /** - * 鑾峰彇mqtt - */ - public void getMqttInfo(String attachClientId, String homeType, String deviceUuid, IResponseCallBack<MqttInfo>listener) { - HDLPMUserController.getInstance().getMqttInfo(attachClientId, homeType, deviceUuid, listener); - } - - /****************************璇锋眰鎺ュ彛****************************/ - - - public String getUserRegionUrl() { - if (TextUtils.isEmpty(userRegionUrl)) { - HDLSDKLog.e(TAG, "userRegionUrl null "); - } - return userRegionUrl; - } - - public void setUserRegionUrl(String userRegionUrl) { - this.userRegionUrl = userRegionUrl; - HDLSDKSPUtils.put(HDLLINK_USERURL_KEY, this.userRegionUrl); - } - - public boolean isLogin() { - return isLogin; - } - - public HDLUserInfoBean getUser() { - return mUser; - } - - public String getAccessToken() { - return accessToken; - } - - public String getRefreshToken() { - return refreshToken; - } - - public String getHomeRegionUrl() { - //濡傛灉娌¢厤缃綇瀹呯殑鍩熷悕璇锋眰鍦板潃鍒欓粯璁ょ敤鐢ㄦ埛鐨� - if (TextUtils.isEmpty(homeRegionUrl)) { - return getUserRegionUrl(); - } - return homeRegionUrl; - } - - /** - * 璁剧疆浣忓畢璇锋眰鐨勫湴鍧� - * - * @param homeRegionUrl - */ - public void setHomeRegionUrl(String homeRegionUrl) { - this.homeRegionUrl = homeRegionUrl; - HDLSDKSPUtils.put(HDLLINK_HOMEURL_KEY, homeRegionUrl); - } - -// private IOnReloginListener getOnReloginListener() { -// return mOnReloginListener; -// } - - public void setOnReloginListener(IOnReloginListener onReloginListener) { - mOnReloginListener = onReloginListener; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLLoginBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLLoginBean.java deleted file mode 100644 index a12ee1f..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLLoginBean.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/2/21. - * 鐧诲綍鍝嶅簲瀵硅薄 - */ -public class HDLLoginBean implements Serializable { - - ///鐢ㄦ埛鏈夋晥韬唤Token(涓嶇敤璁板綍浠�涔堟湁鏁堟湡,濡傛灉鐧婚檰澶辫触,灏辨嬁RefreshToken鍘诲埛鏂�) - private String accessToken; - /// 鐢ㄦ埛鏈夋晥韬唤Token杩囨湡鏃堕棿 - private String expiration; - /// 鍒锋柊accessToken鐢ㄧ殑token(涓嶇敤璁板綍浠�涔堟湁鏁堟湡,濡傛灉鍒锋柊澶辫触,灏辫涪浜哄嵆鍙�) - private String refreshToken; - /// 鍒锋柊Token杩囨湡鏃堕棿 - private String refreshExpiration; - /// 鐢ㄦ埛鍞竴ID - private String userId; - /// 鐧诲綍甯愬彿 - private String account; - /// 娣诲姞鍒癟oken澶撮儴鐨勪笢瑗�,璁よ瘉璇锋眰澶村墠缂�(涓嶈鐞嗗畠,鍙粰搴曞眰浣跨敤) - private String headerPrefix; - private String tokenUuid; - private String tokenType; - private String expiresIn; - private String refreshExpiresIn; - private String userType; - ///鐢ㄦ埛濮撳悕 - private String name; - private String userPhone; - /// 鐢ㄦ埛閭 - private String userEmail; - ///浼佷笟鍗曚綅id - private String companyId; - - ///瑙掕壊 - private String role; - - - @NonNull - public String getAccessToken() { - return accessToken == null ? "" : accessToken; - } - - public void setAccessToken(@NonNull String accessToken) { - this.accessToken = accessToken; - } - - @NonNull - public String getExpiration() { - return expiration == null ? "" : expiration; - } - - public void setExpiration(@NonNull String expiration) { - this.expiration = expiration; - } - - @NonNull - public String getRefreshToken() { - return refreshToken == null ? "" : refreshToken; - } - - public void setRefreshToken(@NonNull String refreshToken) { - this.refreshToken = refreshToken; - } - - @NonNull - public String getRefreshExpiration() { - return refreshExpiration == null ? "" : refreshExpiration; - } - - public void setRefreshExpiration(@NonNull String refreshExpiration) { - this.refreshExpiration = refreshExpiration; - } - - @NonNull - public String getUserId() { - return userId == null ? "" : userId; - } - - public void setUserId(@NonNull String userId) { - this.userId = userId; - } - - @NonNull - public String getAccount() { - return account == null ? "" : account; - } - - public void setAccount(@NonNull String account) { - this.account = account; - } - - @NonNull - public String getHeaderPrefix() { - return headerPrefix == null ? "" : headerPrefix; - } - - public void setHeaderPrefix(@NonNull String headerPrefix) { - this.headerPrefix = headerPrefix; - } - - @NonNull - public String getTokenUuid() { - return tokenUuid == null ? "" : tokenUuid; - } - - public void setTokenUuid(@NonNull String tokenUuid) { - this.tokenUuid = tokenUuid; - } - - @NonNull - public String getTokenType() { - return tokenType == null ? "" : tokenType; - } - - public void setTokenType(@NonNull String tokenType) { - this.tokenType = tokenType; - } - - @NonNull - public String getExpiresIn() { - return expiresIn == null ? "" : expiresIn; - } - - public void setExpiresIn(@NonNull String expiresIn) { - this.expiresIn = expiresIn; - } - - @NonNull - public String getRefreshExpiresIn() { - return refreshExpiresIn == null ? "" : refreshExpiresIn; - } - - public void setRefreshExpiresIn(@NonNull String refreshExpiresIn) { - this.refreshExpiresIn = refreshExpiresIn; - } - - @NonNull - public String getUserType() { - return userType == null ? "" : userType; - } - - public void setUserType(@NonNull String userType) { - this.userType = userType; - } - - @NonNull - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - @NonNull - public String getUserPhone() { - return userPhone == null ? "" : userPhone; - } - - public void setUserPhone(@NonNull String userPhone) { - this.userPhone = userPhone; - } - - @NonNull - public String getUserEmail() { - return userEmail == null ? "" : userEmail; - } - - public void setUserEmail(@NonNull String userEmail) { - this.userEmail = userEmail; - } - - @NonNull - public String getCompanyId() { - return companyId == null ? "" : companyId; - } - - public void setCompanyId(@NonNull String companyId) { - this.companyId = companyId; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLMemberInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLMemberInfoBean.java deleted file mode 100644 index 621f73a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLMemberInfoBean.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/4/21. - */ -public class HDLMemberInfoBean implements Serializable { - private String memberId; - private String memberName; - private String memberHeadIcon; - private String memberPhonePrefix; - private String memberPhone; - private String memberEmail; - private String memberSex; - private String memberBirthday; - private String languageType; - private String loginName; - private String region; - - @NonNull - public String getMemberId() { - return memberId == null ? "" : memberId; - } - - public void setMemberId(@NonNull String memberId) { - this.memberId = memberId; - } - - @NonNull - public String getMemberName() { - return memberName == null ? "" : memberName; - } - - public void setMemberName(@NonNull String memberName) { - this.memberName = memberName; - } - - @NonNull - public String getMemberHeadIcon() { - return memberHeadIcon == null ? "" : memberHeadIcon; - } - - public void setMemberHeadIcon(@NonNull String memberHeadIcon) { - this.memberHeadIcon = memberHeadIcon; - } - - @NonNull - public String getMemberPhonePrefix() { - return memberPhonePrefix == null ? "" : memberPhonePrefix; - } - - public void setMemberPhonePrefix(@NonNull String memberPhonePrefix) { - this.memberPhonePrefix = memberPhonePrefix; - } - - @NonNull - public String getMemberPhone() { - return memberPhone == null ? "" : memberPhone; - } - - public void setMemberPhone(@NonNull String memberPhone) { - this.memberPhone = memberPhone; - } - - @NonNull - public String getMemberEmail() { - return memberEmail == null ? "" : memberEmail; - } - - public void setMemberEmail(@NonNull String memberEmail) { - this.memberEmail = memberEmail; - } - - @NonNull - public String getMemberSex() { - return memberSex == null ? "" : memberSex; - } - - public void setMemberSex(@NonNull String memberSex) { - this.memberSex = memberSex; - } - - @NonNull - public String getMemberBirthday() { - return memberBirthday == null ? "" : memberBirthday; - } - - public void setMemberBirthday(@NonNull String memberBirthday) { - this.memberBirthday = memberBirthday; - } - - @NonNull - public String getLanguageType() { - return languageType == null ? "" : languageType; - } - - public void setLanguageType(@NonNull String languageType) { - this.languageType = languageType; - } - - @NonNull - public String getLoginName() { - return loginName == null ? "" : loginName; - } - - public void setLoginName(@NonNull String loginName) { - this.loginName = loginName; - } - - @NonNull - public String getRegion() { - return region == null ? "" : region; - } - - public void setRegion(@NonNull String region) { - this.region = region; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLUserInfoBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLUserInfoBean.java deleted file mode 100644 index 72f193a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLUserInfoBean.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/3/21. - */ -public class HDLUserInfoBean implements Serializable { - /// 鐢ㄦ埛鍞竴ID - private String userId; - /// 鐧诲綍甯愬彿 - private String account; - /// 鐢ㄦ埛绫诲瀷 - private String userType; - /// 鐢ㄦ埛鍚嶅瓧 - private String name; - /// 鐢ㄦ埛鎵嬫満鍙� - private String userPhone; - /// 鐢ㄦ埛閭 - private String userEmail; - ///浼佷笟鍗曚綅id - private String companyId; - /// headerPrefix - private String headerPrefix; - - - public HDLUserInfoBean() { - - } - public HDLUserInfoBean(HDLLoginBean loginBean) { - this.userId = loginBean.getUserId(); - this.account = loginBean.getAccount(); - this.userType = loginBean.getUserType(); - this.name = loginBean.getName(); - this.userPhone = loginBean.getUserPhone(); - this.userEmail = loginBean.getUserEmail(); - this.companyId = loginBean.getCompanyId(); - this.headerPrefix = loginBean.getHeaderPrefix(); - } - - @NonNull - public String getUserId() { - return userId == null ? "" : userId; - } - - public void setUserId(@NonNull String userId) { - this.userId = userId; - } - - @NonNull - public String getAccount() { - return account == null ? "" : account; - } - - public void setAccount(@NonNull String account) { - this.account = account; - } - - @NonNull - public String getUserType() { - return userType == null ? "" : userType; - } - - public void setUserType(@NonNull String userType) { - this.userType = userType; - } - - @NonNull - public String getName() { - return name == null ? "" : name; - } - - public void setName(@NonNull String name) { - this.name = name; - } - - @NonNull - public String getUserPhone() { - return userPhone == null ? "" : userPhone; - } - - public void setUserPhone(@NonNull String userPhone) { - this.userPhone = userPhone; - } - - @NonNull - public String getUserEmail() { - return userEmail == null ? "" : userEmail; - } - - public void setUserEmail(@NonNull String userEmail) { - this.userEmail = userEmail; - } - - @NonNull - public String getCompanyId() { - return companyId == null ? "" : companyId; - } - - public void setCompanyId(@NonNull String companyId) { - this.companyId = companyId; - } - - @NonNull - public String getHeaderPrefix() { - return headerPrefix == null ? "" : headerPrefix; - } - - public void setHeaderPrefix(@NonNull String headerPrefix) { - this.headerPrefix = headerPrefix; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLUserRegionBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLUserRegionBean.java deleted file mode 100644 index 1285fae..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/HDLUserRegionBean.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/3/21. - */ -public class HDLUserRegionBean implements Serializable { - private String regionId; - private String regionName; - private String regionMark; - private String regionMqttUrl; - private String regionSlbUrl; - private String regionUrl; - - @NonNull - public String getRegionId() { - return regionId == null ? "" : regionId; - } - - public void setRegionId(@NonNull String regionId) { - this.regionId = regionId; - } - - @NonNull - public String getRegionName() { - return regionName == null ? "" : regionName; - } - - public void setRegionName(@NonNull String regionName) { - this.regionName = regionName; - } - - @NonNull - public String getRegionMark() { - return regionMark == null ? "" : regionMark; - } - - public void setRegionMark(@NonNull String regionMark) { - this.regionMark = regionMark; - } - - @NonNull - public String getRegionMqttUrl() { - return regionMqttUrl == null ? "" : regionMqttUrl; - } - - public void setRegionMqttUrl(@NonNull String regionMqttUrl) { - this.regionMqttUrl = regionMqttUrl; - } - - @NonNull - public String getRegionSlbUrl() { - return regionSlbUrl == null ? "" : regionSlbUrl; - } - - public void setRegionSlbUrl(@NonNull String regionSlbUrl) { - this.regionSlbUrl = regionSlbUrl; - } - - @NonNull - public String getRegionUrl() { - return regionUrl == null ? "" : regionUrl; - } - - public void setRegionUrl(@NonNull String regionUrl) { - this.regionUrl = regionUrl; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/ImageSubmitInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/ImageSubmitInfo.java deleted file mode 100644 index 90f1e7b..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/ImageSubmitInfo.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import java.io.Serializable; - -/** - * Created by Zoro - * Created on 2021/5/21 - * description: - */ -public class ImageSubmitInfo implements Serializable { - private String url; - - public String getUrl() { - return url == null ? "" : url; - } - - public void setUrl(String url) { - this.url = url; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/MqttInfo.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/MqttInfo.java deleted file mode 100644 index 18f22b1..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/MqttInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import java.io.Serializable; - -/** - * Created by Zoro - * Created on 2022/11/7 - * description: - */ -public class MqttInfo implements Serializable { - private String clientId; - private String passWord; - private String url; - private String userName; - - public String getClientId() { - return clientId == null ? "" : clientId; - } - - public void setClientId(String clientId) { - this.clientId = clientId; - } - - public String getPassWord() { - return passWord == null ? "" : passWord; - } - - public void setPassWord(String passWord) { - this.passWord = passWord; - } - - public String getUrl() { - return url == null ? "" : url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getUserName() { - return userName == null ? "" : userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/NewVersionBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/NewVersionBean.java deleted file mode 100644 index 160623c..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/NewVersionBean.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import androidx.annotation.NonNull; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/15/21. - * 鏂扮増鏈鎯� - */ -public class NewVersionBean implements Serializable { - - private String version;//鏂扮殑鐗堟湰鍙� - private String appName;//app鍚嶇О - private String appCode;//app缂栫爜 - private boolean isEnforce;//鏄惁鏄己鍒舵洿鏂� - private String appMarket;//搴旂敤甯傚満鍚嶇О - private String releaseSystem;//鍙戝竷绯荤粺锛孖OS銆丄ndroid銆亀gt - private String updateDescription;//鏇存柊璇存槑json锛屽璇█鐢卞鎴风瑙f瀽 - private String packageUrl;//涓嬭浇鍦板潃 - private String remark;//澶囨敞 - private String limitGt;//minVersion 瑕佹眰瀹夸富App鐨勬渶浣庣増鏈彿 - private String limitLe;//maxVersion 闄愬埗瀹夸富App鐨勬渶楂樼増鏈彿 - private long size;//鏂囦欢澶у皬 - private String signMethod;//鏂囦欢绛惧悕绫诲瀷锛歮d5(32浣嶅皬鍐�) - private String sign;//鏂囦欢绛惧悕 - - - @NonNull - public String getVersion() { - return version == null ? "" : version; - } - - public void setVersion(@NonNull String version) { - this.version = version; - } - - @NonNull - public String getAppName() { - return appName == null ? "" : appName; - } - - public void setAppName(@NonNull String appName) { - this.appName = appName; - } - - @NonNull - public String getAppCode() { - return appCode == null ? "" : appCode; - } - - public void setAppCode(@NonNull String appCode) { - this.appCode = appCode; - } - - public boolean getIsEnforce() { - return isEnforce; - } - - public void setIsEnforce(boolean enforce) { - isEnforce = enforce; - } - - @NonNull - public String getAppMarket() { - return appMarket == null ? "" : appMarket; - } - - public void setAppMarket(@NonNull String appMarket) { - this.appMarket = appMarket; - } - - @NonNull - public String getReleaseSystem() { - return releaseSystem == null ? "" : releaseSystem; - } - - public void setReleaseSystem(@NonNull String releaseSystem) { - this.releaseSystem = releaseSystem; - } - - @NonNull - public String getUpdateDescription() { - return updateDescription == null ? "" : updateDescription; - } - - public void setUpdateDescription(@NonNull String updateDescription) { - this.updateDescription = updateDescription; - } - - @NonNull - public String getPackageUrl() { - return packageUrl == null ? "" : packageUrl; - } - - public void setPackageUrl(@NonNull String packageUrl) { - this.packageUrl = packageUrl; - } - - @NonNull - public String getRemark() { - return remark == null ? "" : remark; - } - - public void setRemark(@NonNull String remark) { - this.remark = remark; - } - - @NonNull - public String getLimitGt() { - return limitGt == null ? "" : limitGt; - } - - public void setLimitGt(@NonNull String limitGt) { - this.limitGt = limitGt; - } - - @NonNull - public String getLimitLe() { - return limitLe == null ? "" : limitLe; - } - - public void setLimitLe(@NonNull String limitLe) { - this.limitLe = limitLe; - } - - public boolean isEnforce() { - return isEnforce; - } - - public void setEnforce(boolean enforce) { - isEnforce = enforce; - } - - public long getSize() { - return size; - } - - public void setSize(long size) { - this.size = size; - } - - public String getSignMethod() { - return signMethod == null ? "" : signMethod; - } - - public void setSignMethod(String signMethod) { - this.signMethod = signMethod; - } - - public String getSign() { - return sign == null ? "" : sign; - } - - public void setSign(String sign) { - this.sign = sign; - } - - /** - * 鏇存柊璇存槑json锛屽璇█鏈夊鎴风瑙f瀽 - */ - public static class UpdateDescriptionBean implements Serializable { - private String Chinese;//涓枃鏇存柊璇存槑 - private String English;//鑻辨枃鏇存柊璇存槑 - - @NonNull - public String getChinese() { - return Chinese == null ? "" : Chinese; - } - - public void setChinese(@NonNull String chinese) { - Chinese = chinese; - } - - @NonNull - public String getEnglish() { - return English == null ? "" : English; - } - - public void setEnglish(@NonNull String english) { - English = english; - } - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/UploadImageRequest.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/UploadImageRequest.java deleted file mode 100644 index 9f6a055..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/bean/UploadImageRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.hdl.linkpm.sdk.user.bean; - -import java.io.Serializable; - -/** - * Created by jlchen on 12/10/21. - */ -public class UploadImageRequest implements Serializable { - private String prefix; - private String uid; - private String fileName; - private byte[] content; - - public UploadImageRequest() { - - } - - public UploadImageRequest(String prefix, String uid, String fileName, byte[] content) { - this.prefix = prefix; - this.uid = uid; - this.fileName = fileName; - this.content = content; - } - - public String getPrefix() { - return prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public String getUid() { - return uid; - } - - public void setUid(String uid) { - this.uid = uid; - } - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public byte[] getContent() { - return content; - } - - public void setContent(byte[] content) { - this.content = content; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/ILoginCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/ILoginCallBack.java deleted file mode 100644 index 4de6b92..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/ILoginCallBack.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hdl.linkpm.sdk.user.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.user.bean.HDLLoginBean; - -/** - * Created by jlchen on 12/2/21. - */ -public interface ILoginCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(HDLLoginBean loginBean); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IMemberInfoBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IMemberInfoBack.java deleted file mode 100644 index 28ce51b..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IMemberInfoBack.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hdl.linkpm.sdk.user.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.user.bean.HDLMemberInfoBean; - -/** - * Created by jlchen on 12/4/21. - */ -public interface IMemberInfoBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(HDLMemberInfoBean memberInfoBean); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IOnReloginListener.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IOnReloginListener.java deleted file mode 100644 index 9da0b32..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IOnReloginListener.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.hdl.linkpm.sdk.user.callback; - -/** - * Created by jlchen on 12/2/21. - * 褰撶敤鎴稟ccessToken 閿欒鍚庡彂鍑虹殑閫氱煡 鐧诲嚭澶勭悊 - */ -public interface IOnReloginListener { - /** - * TOKEN澶辫触 闇�瑕侀��鍑洪噸鏂扮櫥褰� - * @param type: 0:姝e父閫�鍑� 1锛氭瀬鍏夋帹閫佸己鍒堕��鍑� - */ - void onReLogin(int type); -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IRegionByAccountCallBack.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IRegionByAccountCallBack.java deleted file mode 100644 index b0c2d2a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/callback/IRegionByAccountCallBack.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.hdl.linkpm.sdk.user.callback; - -import com.hdl.linkpm.sdk.core.callback.IBaseCallBack; -import com.hdl.linkpm.sdk.user.bean.HDLUserRegionBean; - -/** - * Created by jlchen on 12/3/21. - */ -public interface IRegionByAccountCallBack extends IBaseCallBack { - /** - * 鎴愬姛鍥炶皟 - */ - void onSuccess(HDLUserRegionBean regionBean); -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/controller/HDLPMUserController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/controller/HDLPMUserController.java deleted file mode 100644 index b5502d4..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/user/controller/HDLPMUserController.java +++ /dev/null @@ -1,658 +0,0 @@ -package com.hdl.linkpm.sdk.user.controller; - -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.linkpm.sdk.HDLLinkPMSdk; -import com.hdl.linkpm.sdk.core.api.HDLCloudUserApi; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IDefaultStrCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.user.bean.HDLLoginBean; -import com.hdl.linkpm.sdk.user.bean.HDLMemberInfoBean; -import com.hdl.linkpm.sdk.user.bean.HDLUserRegionBean; -import com.hdl.linkpm.sdk.user.bean.ImageSubmitInfo; -import com.hdl.linkpm.sdk.user.bean.MqttInfo; -import com.hdl.linkpm.sdk.user.bean.NewVersionBean; -import com.hdl.linkpm.sdk.user.bean.UploadImageRequest; -import com.hdl.linkpm.sdk.user.callback.ILoginCallBack; -import com.hdl.linkpm.sdk.user.callback.IMemberInfoBack; -import com.hdl.linkpm.sdk.user.callback.IRegionByAccountCallBack; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; - -import java.io.File; - -import io.reactivex.rxjava3.disposables.Disposable; - -/** - * Created by jlchen on 12/3/21. - * B绔敤鎴风浉鍏崇殑缃戠粶璇锋眰 - */ -public class HDLPMUserController { - - /** - * instance - */ - private volatile static HDLPMUserController instance; - - /** - * getInstance - * - * @return HDLUserController - */ - public static synchronized HDLPMUserController getInstance() { - if (instance == null) { - synchronized (HDLPMUserController.class) { - if (instance == null) { - instance = new HDLPMUserController(); - } - } - } - return instance; - } - - /** - * 鑾峰彇璐﹀彿鎵�鍦ㄥ尯鍩� - * - * @param account - * @param callBack - * @return https://nearest.hdlchina.com/smart-footstone/region/regionByUserAccount - */ - public Disposable regionByAccount(String account, IRegionByAccountCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getInitUrl() + HDLCloudUserApi.POST_RegionByAccount; - return HxHttp.builder() - .url(requestUrl) - .params("account", account) - .build() - .post() - .subscribeWith(new HDLResponse<HDLUserRegionBean>() { - @Override - public void onResponse(HDLUserRegionBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, account, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鐧诲綍 - * 閫氳繃璐﹀彿鍜屽瘑鐮� - * - * @param account 鎵嬫満鎴栬�呴偖绠� - * @param loginPwd 瀵嗙爜 - * @param callBack - * @return - */ - public Disposable loginByPassword(String account, String loginPwd, ILoginCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_LOGIN); - JsonObject json = new JsonObject(); - json.addProperty("account", account); - json.addProperty("loginPwd", loginPwd); -// json.addProperty("platform", "APP"); - json.addProperty("grantType", "password"); - - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<HDLLoginBean>() { - @Override - public void onResponse(HDLLoginBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鑾峰彇璐﹀彿鎵�鍦ㄥ尯鍩� - * - * @param account - * @param callBack - * @return https://nearest.hdlcontrol.com/smart-footstone/region/regionByUserAccount - */ - public Disposable regionByAccount(boolean isBooleanB, String account, IRegionByAccountCallBack callBack) { - - - String requestUrl = HDLLinkPMSdk.getInitUrl() + HDLCloudUserApi.POST_RegionByAccount; - if (!isBooleanB) { - requestUrl = HDLLinkPMSdk.getInitUrl() + HDLCloudUserApi.C_POST_RegionByAccount; - } - String finalRequestUrl = requestUrl; - return HxHttp.builder() - .url(requestUrl) - .params("account", account) - .build() - .post() - .subscribeWith(new HDLResponse<HDLUserRegionBean>() { - @Override - public void onResponse(HDLUserRegionBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(finalRequestUrl, account, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 鐧诲綍 - * 閫氳繃璐﹀彿鍜屽瘑鐮� - * - * @param isBooleanB true=B,false=C - * @param account 鎵嬫満鎴栬�呴偖绠� - * @param loginPwd 瀵嗙爜 - * @param callBack 鍥炶皟 - * @return - - */ - public Disposable loginByPassword(boolean isBooleanB, String account, String loginPwd, ILoginCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_LOGIN); - if (!isBooleanB) { - requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.C_POST_LOGIN); - } - JsonObject json = new JsonObject(); - json.addProperty("account", account); - json.addProperty("loginPwd", loginPwd); -// json.addProperty("platform", "APP"); - json.addProperty("grantType", "password"); - - String finalRequestUrl = requestUrl; - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<HDLLoginBean>() { - @Override - public void onResponse(HDLLoginBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(finalRequestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - - /** - * 鐧诲綍 - * 閫氳繃楠岃瘉鐮� - * - * @param account 鎵嬫満鎴栬�呴偖绠� - * @param vCode 楠岃瘉鐮� - * @param callBack 鍥炶皟 - * @return - */ - public Disposable loginByCode(String account, String vCode, ILoginCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_LOGIN); - JsonObject json = new JsonObject(); - json.addProperty("account", account); - json.addProperty("verifyCode", vCode); -// json.addProperty("platform", "APP"); - json.addProperty("grantType", "verify"); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<HDLLoginBean>() { - @Override - public void onResponse(HDLLoginBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 閫氱敤 鍙戦�侀獙璇佺爜鏂规硶 - * LanguageTypeEnum CHINESE,ENGLISH - * - * @param verifyType 1:娉ㄥ唽 2锛氭壘鍥炲瘑鐮� 3锛氱粦瀹� 4:楠岃瘉鐮佺櫥闄� 5:鏁忔劅鏁版嵁 - * @param account 閭鎴栬�呮墜鏈哄彿 - * @param isPhone 鏄惁鎵嬫満 - * @param phoneZoneCode 鎵嬫満鍥藉鍖哄彿 - * @param languageType 璇█ - * @param callBack - * @return - */ - public Disposable verificationCodeSend(int verifyType, String account, Boolean isPhone, String phoneZoneCode, String languageType, IDefaultCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_VERIFICATION_CODE_SEND); - JsonObject json = new JsonObject(); - json.addProperty("verifyType", verifyType); - json.addProperty("languageType", languageType); - json.addProperty("expireSecond", 300);////楠岃瘉鐮佽繃鏈熸椂闂达紙绉掞級,榛樿5鍒嗛挓 - //鏄惁鎵嬫満 - if (isPhone) { - json.addProperty("phone", account); - json.addProperty("phonePrefix", phoneZoneCode); - } else { - json.addProperty("mail", account); - } - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - - } - - /** - * 蹇樿瀵嗙爜锛岄噸缃瘑鐮� - * - * @param account 閭鎴栬�呮墜鏈哄彿 - * @param password 鏂板瘑鐮� - * @param vCode 楠岃瘉鐮� - * @param isPhone 鏄惁鎵嬫満 - * @param callBack 鍥炶皟 - */ - public Disposable forgetPassword(String account, String password, String vCode, Boolean isPhone, IDefaultCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_FORGET_PROGRAM_PWD); - JsonObject json = new JsonObject(); - json.addProperty("loginPwd", password); - json.addProperty("verifyCode", vCode); - //鏄惁鎵嬫満 - if (isPhone) { - json.addProperty("userPhone", account); - } else { - json.addProperty("userEmail", account); - } - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鏇存敼涓汉瀵嗙爜 - * - * @param userId 褰撳墠鐢ㄦ埛ID - * @param loginOldPwd 鑰佸瘑鐮� - * @param loginPwd 鏂板瘑鐮� - * @param callBack 鍥炶皟 - */ - public Disposable updateProgramPassword(String userId, String loginOldPwd, String loginPwd, IDefaultCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_UPDATE_PROGRAM_PASSWORD); - JsonObject json = new JsonObject(); - json.addProperty("userId", userId); - json.addProperty("loginOldPwd", loginOldPwd); - json.addProperty("loginPwd", loginPwd); - json.addProperty("confirmLoginPwd", loginPwd); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇鐢ㄦ埛涓汉淇℃伅 - * - * @param callBack - */ - public Disposable getMemberInfo(IMemberInfoBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_GET_MEMBER_INFO); - return HxHttp.builder() - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<HDLMemberInfoBean>() { - @Override - public void onResponse(HDLMemberInfoBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, null, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鏇存柊涓汉淇℃伅 - * memberHeadIcon銆乵emberName銆乵emberBirthday銆乴anguageType銆乵emberSex - * - * @param callBack - */ - public Disposable updateMemberInfo(JsonObject updateInfo, IDefaultCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_UPDATE_MEMBER_INFO); - return HxHttp.builder() - .url(requestUrl) - .raw(updateInfo.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, updateInfo, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇鐢ㄦ埛澶村儚璺緞 - * - * @param memberHeadIconKey 鐢ㄦ埛澶村儚imageKey - * @param callBack - */ - public Disposable getHeadImageUrl(String memberHeadIconKey, IDefaultStrCallBack callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_GET_IMAGE_URL); - return HxHttp.builder() - .url(requestUrl) - .params("imageKey", memberHeadIconKey) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, memberHeadIconKey, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 涓婁紶鐢ㄦ埛澶村儚 - * - * @param userId 鐢ㄦ埛id - * @param imageBytes 澶村儚鍥剧墖 - * @param callBack - * @return - */ - public Disposable uploadUserHeadImage(String userId, byte[] imageBytes, IDefaultStrCallBack callBack) { - UploadImageRequest uploadImageRequest = new UploadImageRequest(); - uploadImageRequest.setPrefix("Icon" + System.currentTimeMillis()); - uploadImageRequest.setUid(userId); - uploadImageRequest.setFileName("HeadImage.png"); - uploadImageRequest.setContent(imageBytes); - - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_UPLOAD_IMAGE); - return HxHttp.builder() - .url(requestUrl) - .raw(HDLGsonUtils.toJson(uploadImageRequest)) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, uploadImageRequest, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 涓婁紶鐢ㄦ埛澶村儚(鏂�) - * - * @param file 鍥剧墖 - * @param callBack - * @return - */ - public Disposable uplfadUserHeadImage(File file, IResponseCallBack<ImageSubmitInfo> callBack) { - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_UPLOAD_IMAGE_NEW); - return HxHttp.builder() - .url(requestUrl) - .file(file) - .build() - .upload() - .subscribeWith(new HDLResponse<ImageSubmitInfo>() { - @Override - public void onResponse(ImageSubmitInfo response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, null, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - -// /** -// * 鐗堟湰妫�娴嬫洿鏂� -// * -// * @param appName app鍚嶇О -// * @param version 鐗堟湰鍙� -// * @param callBack 濡傛灉onSuccess 鍥炶皟鐨刡ean涓虹┖锛屼唬琛ㄥ綋鍓嶇増鏈凡缁忔槸鏈�鏂扮増鏈紝娌℃湁鏂扮増鏈� -// * @return -// */ -// public Disposable checkAppVersion(String appName, String version, IResponseCallBack<NewVersionBean> callBack) { -// JsonObject json = new JsonObject(); -// json.addProperty("appName", appName); -// json.addProperty("version", version); -// json.addProperty("version", version); -// String requestUrl = HDLLinkPMSdk.getRegionUrl() + HDLCloudUserApi.POST_APP_APPVERSION_CHECK; -// return HxHttp.builder() -// .url(requestUrl) -// .raw(json.toString()) -// .build() -// .post() -// .subscribeWith(new HDLResponse<NewVersionBean>() { -// @Override -// public void onResponse(NewVersionBean response) { -// if (callBack != null) { -// callBack.onSuccess(response); -// } -// } -// -// @Override -// public void onFailure(HDLException e) { -// if (callBack != null) { -// callBack.onFailure(e); -// } -// } -// }); -// } - - /** - * 鐗堟湰妫�娴嬫洿鏂� - * 鏀寔Android銆乮OS銆亀gt妫�娴� - * - * @param appCode app缂栫爜 - * @param version 鐗堟湰鍙� - * @param releaseSystem 鍙戝竷绯荤粺锛孖OS銆丄ndroid, wgt - * @param callBack 濡傛灉onSuccess 鍥炶皟鐨刡ean涓虹┖锛屼唬琛ㄥ綋鍓嶇増鏈凡缁忔槸鏈�鏂扮増鏈紝娌℃湁鏂扮増鏈� - * @return - */ - public Disposable checkAppVersion(String appCode, String version, String releaseSystem, IResponseCallBack<NewVersionBean> callBack) { - JsonObject json = new JsonObject(); - json.addProperty("appCode", appCode); - json.addProperty("version", version); - json.addProperty("releaseSystem", releaseSystem); - String requestUrl = HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.POST_APP_APPVERSION_CHECK); - return HxHttp.builder() - .url(requestUrl) - .raw(json.toString()) - .build() - .post() - .subscribeWith(new HDLResponse<NewVersionBean>() { - @Override - public void onResponse(NewVersionBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇mqtt淇℃伅 - * - * @return - */ - public static Disposable getMqttInfo(String attachClientId, String homeType, String deviceUuid, IResponseCallBack<MqttInfo> listener) { - return HxHttp.builder() - .url(HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.MQTT_INFO_URL)) - .params("attachClientId", attachClientId) - .params("homeType", homeType) - .params("deviceUuid", deviceUuid) - .build() - .post() - .subscribeWith(new HDLResponse<MqttInfo>() { - @Override - public void onResponse(MqttInfo response) { - if (listener != null) { - listener.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - JsonObject json = new JsonObject(); - json.addProperty("attachClientId", attachClientId); - json.addProperty("homeType", homeType); - json.addProperty("deviceUuid", deviceUuid); - HDLExceptionSubmitUtils.submit(HDLCloudUserApi.getRequestUrl(HDLCloudUserApi.MQTT_INFO_URL), json, e); - if (listener != null) { - listener.onFailure(e); - } - } - }); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLExceptionSubmitUtils.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLExceptionSubmitUtils.java deleted file mode 100644 index 9793b65..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLExceptionSubmitUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.hdl.linkpm.sdk.utils; - -import android.text.TextUtils; - -import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONObject; -import com.google.gson.JsonObject; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.exception.HDLLinkCopyException; -import com.hdl.log.enums.Level; -import com.hdl.log.utils.LogUtil; - -/** - * Created by Zoro - * Created on 2023/4/7 - * description: - */ -public class HDLExceptionSubmitUtils { - public static void submit(String requestUrl, JsonObject json, HDLException e) { - try { - LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); - } catch (Exception e1) { - - } - } - - public static void submit(String requestUrl, JsonObject json, Throwable e) { - try { - LogUtil.log(requestUrl, "code:" + e.getMessage() + "--msg:" + e.getMessage() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); - } catch (Exception e1) { - - } - } - - public static void submit(String requestUrl, Object json, HDLException e) { - try { - LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); - } catch (Exception e1) { - } - } - - public static void submit(String requestUrl, Object json, HDLLinkCopyException e) { - try { - JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(json)); - String utfStr = ""; - if (jsonObject != null) { - try { - byte[] data = jsonObject.getBytes("data"); - utfStr = new String(data); - } catch (Exception e1) { - - } - } - if (!TextUtils.isEmpty(utfStr)) { - LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json) + "--utf-8锛�" + utfStr, null, Level.high); - } else { - LogUtil.log(requestUrl, "code:" + e.getCode() + "--msg:" + e.getMsg() + "--params锛�" + HDLGsonUtils.toJson(json), null, Level.high); - - } - } catch (Exception e1) { - - } - } - -} \ No newline at end of file diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLFileUtils.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLFileUtils.java deleted file mode 100644 index 09e2ed4..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLFileUtils.java +++ /dev/null @@ -1,324 +0,0 @@ -package com.hdl.linkpm.sdk.utils; - -import android.content.Context; -import android.content.res.AssetManager; - -import java.io.BufferedOutputStream; -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -/** - * Created by hxb on 2022/2/24. - */ -public class HDLFileUtils { - - /** - * 鍒涘缓鏂囦欢澶� - * - * @param filesPath - * @return - */ - public static boolean createOrExistsPrivateFolder(String filesPath) { - File dir = new File(filesPath); - return createOrExistsFolder(dir); - } - - public static String getJson(String fileName, Context context) { - //灏唈son鏁版嵁鍙樻垚瀛楃涓� - StringBuilder stringBuilder = new StringBuilder(); - try { - //鑾峰彇assets璧勬簮绠$悊鍣� - AssetManager assetManager = context.getAssets(); - //閫氳繃绠$悊鍣ㄦ墦寮�鏂囦欢骞惰鍙� - BufferedReader bf = new BufferedReader(new InputStreamReader( - assetManager.open(fileName))); - String line; - while ((line = bf.readLine()) != null) { - stringBuilder.append(line); - } - } catch (IOException e) { - e.printStackTrace(); - } - return stringBuilder.toString(); - } - - /** - * 鍒涘缓鏂囦欢澶� - * - * @param file - * @return - */ - public static boolean createOrExistsFolder(File file) { - if (file == null) - return false; - boolean result = false; - - if (isFileExists(file) && isDirectory(file)) { - // 濡傛灉file瀛樺湪涓旀槸鏂囦欢澶癸紝杩斿洖true - return true; - } - // 濡傛灉鏂囦欢澶逛笉瀛樺湪锛屽垱寤烘枃浠跺す - if (file.mkdirs()) { - // 鍒涘缓鎴愬姛杩斿洖true - result = true; - } else { - // 鍒涘缓澶辫触杩斿洖false - result = false; - } - return result; - } - - public static boolean writeFile(String path, InputStream inputStream) { - FileOutputStream fop = null; - - try { - File file = new File(path); - fop = new FileOutputStream(file); - - if (!file.exists()) { - file.createNewFile(); - } - - byte[] inBytes = new byte[1024*5]; - int len = 0; - while (0 < (len = inputStream.read(inBytes, 0, inBytes.length))) { - fop.write(inBytes, 0, len); - fop.flush(); - } - return true; - } catch (IOException e) { - e.printStackTrace(); - return false; - } finally { - try { - if (fop != null) { - fop.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - try { - if (inputStream != null) { - inputStream.close(); - } - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - /** - * 鏂囦欢鏄惁瀛樺湪 - * - * @param file - * @return - */ - public static boolean isFileExists(File file) { - if (file == null) - return false; - return file.exists(); - } - - /** - * 鏂囦欢澶规槸鍚﹀瓨鍦� - * - * @param file - * @return - */ - public static boolean isDirectory(File file) { - if (file == null) - return false; - return file.isDirectory(); - } - public static void byteToFile(byte[] buf, String filePath, String fileName) { - BufferedOutputStream bos = null; - FileOutputStream fos = null; - File file; - try { - createOrExistsPrivateFolder(filePath); - file = new File(filePath + File.separator + fileName); - fos = new FileOutputStream(file); - bos = new BufferedOutputStream(fos); - bos.write(buf); - } catch (Exception ignored) { - } finally { - if (bos != null) { - try { - bos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - if (fos != null) { - try { - fos.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - } - - /** - * 鍒犻櫎鏂囦欢锛屽彲浠ユ槸鍗曚釜鏂囦欢鎴栨枃浠跺す - * - * @param fileName - * 寰呭垹闄ょ殑鏂囦欢鍚� - * @return 鏂囦欢鍒犻櫎鎴愬姛杩斿洖true,鍚﹀垯杩斿洖false - */ - public static boolean delete(String fileName) { - File file = new File(fileName); - if (!file.exists()) { - System.out.println("鍒犻櫎鏂囦欢澶辫触锛�" + fileName + "鏂囦欢涓嶅瓨鍦�"); - return false; - } else { - if (file.isFile()) { - - return deleteFile(fileName); - } else { - return deleteDirectory(fileName); - } - } - } - - /** - * 鍒犻櫎鍗曚釜鏂囦欢 - * - * @param file 琚垹闄ゆ枃浠� - * @return 鍗曚釜鏂囦欢鍒犻櫎鎴愬姛杩斿洖true,鍚﹀垯杩斿洖false - */ - public static boolean deleteFile(File file) { - if (file.isFile() && file.exists()) { - file.delete(); - System.out.println("鍒犻櫎鍗曚釜鏂囦欢" + file.getName() + "鎴愬姛锛�"); - return true; - } else { - System.out.println("鍒犻櫎鍗曚釜鏂囦欢" + file.getName() + "澶辫触锛�"); - return false; - } - } - - /** - * 鍒犻櫎鍗曚釜鏂囦欢 - * - * @param fileName - * 琚垹闄ゆ枃浠剁殑鏂囦欢鍚� - * @return 鍗曚釜鏂囦欢鍒犻櫎鎴愬姛杩斿洖true,鍚﹀垯杩斿洖false - */ - public static boolean deleteFile(String fileName) { - File file = new File(fileName); - if (file.isFile() && file.exists()) { - file.delete(); - System.out.println("鍒犻櫎鍗曚釜鏂囦欢" + fileName + "鎴愬姛锛�"); - return true; - } else { - System.out.println("鍒犻櫎鍗曚釜鏂囦欢" + fileName + "澶辫触锛�"); - return false; - } - } - - /** - * 鍒犻櫎鐩綍锛堟枃浠跺す锛変互鍙婄洰褰曚笅鐨勬枃浠� - * - * @param dir - * 琚垹闄ょ洰褰曠殑鏂囦欢璺緞 - * @return 鐩綍鍒犻櫎鎴愬姛杩斿洖true,鍚﹀垯杩斿洖false - */ - public static boolean deleteDirectory(String dir) { - // 濡傛灉dir涓嶄互鏂囦欢鍒嗛殧绗︾粨灏撅紝鑷姩娣诲姞鏂囦欢鍒嗛殧绗� - if (!dir.endsWith(File.separator)) { - dir = dir + File.separator; - } - File dirFile = new File(dir); - // 濡傛灉dir瀵瑰簲鐨勬枃浠朵笉瀛樺湪锛屾垨鑰呬笉鏄竴涓洰褰曪紝鍒欓��鍑� - if (!dirFile.exists() || !dirFile.isDirectory()) { - System.out.println("鍒犻櫎鐩綍澶辫触" + dir + "鐩綍涓嶅瓨鍦紒"); - return false; - } - boolean flag = true; - // 鍒犻櫎鏂囦欢澶逛笅鐨勬墍鏈夋枃浠�(鍖呮嫭瀛愮洰褰�) - File[] files = dirFile.listFiles(); - for (int i = 0; i < files.length; i++) { - // 鍒犻櫎瀛愭枃浠� - if (files[i].isFile()) { - flag = deleteFile(files[i].getAbsolutePath()); - if (!flag) { - break; - } - } - // 鍒犻櫎瀛愮洰褰� - else { - flag = deleteDirectory(files[i].getAbsolutePath()); - if (!flag) { - break; - } - } - } - - if (!flag) { - System.out.println("鍒犻櫎鐩綍澶辫触"); - return false; - } - - // 鍒犻櫎褰撳墠鐩綍 - if (dirFile.delete()) { - System.out.println("鍒犻櫎鐩綍" + dir + "鎴愬姛锛�"); - return true; - } else { - System.out.println("鍒犻櫎鐩綍" + dir + "澶辫触锛�"); - return false; - } - } - // 鍒犻櫎鏂囦欢澶� - // param folderPath 鏂囦欢澶瑰畬鏁寸粷瀵硅矾寰� - - public static void delFolder(String folderPath) { - try { - delAllFile(folderPath); // 鍒犻櫎瀹岄噷闈㈡墍鏈夊唴瀹� - String filePath = folderPath; - filePath = filePath.toString(); - File myFilePath = new File(filePath); - myFilePath.delete(); // 鍒犻櫎绌烘枃浠跺す - } catch (Exception e) { - e.printStackTrace(); - } - } - - // 鍒犻櫎鎸囧畾鏂囦欢澶逛笅鎵�鏈夋枃浠� - // param path 鏂囦欢澶瑰畬鏁寸粷瀵硅矾寰� - public static boolean delAllFile(String path) { - boolean flag = false; - File file = new File(path); - if (!file.exists()) { - return flag; - } - if (!file.isDirectory()) { - return flag; - } - String[] tempList = file.list(); - File temp = null; - for (int i = 0; i < tempList.length; i++) { - if (path.endsWith(File.separator)) { - temp = new File(path + tempList[i]); - } else { - temp = new File(path + File.separator + tempList[i]); - } - if (temp.isFile()) { - temp.delete(); - } - if (temp.isDirectory()) { - delAllFile(path + "/" + tempList[i]);// 鍏堝垹闄ゆ枃浠跺す閲岄潰鐨勬枃浠� - delFolder(path + "/" + tempList[i]);// 鍐嶅垹闄ょ┖鏂囦欢澶� - flag = true; - } - } - return flag; - } -} - diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLGsonUtils.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLGsonUtils.java deleted file mode 100644 index 81b2e1a..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLGsonUtils.java +++ /dev/null @@ -1,158 +0,0 @@ -package com.hdl.linkpm.sdk.utils; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.google.gson.JsonSyntaxException; -import com.google.gson.reflect.TypeToken; - -import java.lang.reflect.Type; - -/** - * Created by Tong on 2021/11/10. - */ -public class HDLGsonUtils { - private static Gson gson; - - - public static <T> T fromJson(String json, Type type) { - Gson gson = getGson(); - return gson.fromJson(json, type); - } - - public static String toJson(Object object) { - return getGson().toJson(object); - } - - public static Gson getGson() { - if (gson == null) { - gson = new GsonBuilder() - .disableHtmlEscaping() - .registerTypeAdapter(String.class, new StringAdapter()) - .registerTypeAdapter(Integer.class, new IntegerDefault0Adapter()) - .registerTypeAdapter(Double.class, new DoubleDefault0Adapter()) - .registerTypeAdapter(Long.class, new LongDefault0Adapter()) - .create(); - } - return gson; - } - - private static class StringAdapter implements JsonSerializer<String>, JsonDeserializer<String> { - @Override - public String deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - if (json instanceof JsonPrimitive) { - return json.getAsString(); - } else { - return json.toString(); - } - } - - @Override - public JsonElement serialize(String src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - private static class IntegerDefault0Adapter implements JsonSerializer<Integer>, JsonDeserializer<Integer> { - @Override - public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - try { - if (json.getAsString().equals("") || json.getAsString().equals("null")) { - return 0; - } - } catch (Exception ignore) { - } - try { - return json.getAsInt(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - private static class DoubleDefault0Adapter implements JsonSerializer<Double>, JsonDeserializer<Double> { - @Override - public Double deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { - try { - if (json.getAsString().equals("") || json.getAsString().equals("null")) { - return 0.00; - } - } catch (Exception ignore) { - } - try { - return json.getAsDouble(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public JsonElement serialize(Double src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - private static class LongDefault0Adapter implements JsonSerializer<Long>, JsonDeserializer<Long> { - @Override - public Long deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - try { - if (json.getAsString().equals("") || json.getAsString().equals("null")) { - return 0L; - } - } catch (Exception ignore) { - } - try { - return json.getAsLong(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public JsonElement serialize(Long src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src); - } - } - - /** - * - * @param o - * @param <T> - * @return - */ - public static <T> JsonArray toJsonArray(Object o) { - try { - return getGson().fromJson(HDLGsonUtils.toJson(o), new TypeToken<JsonArray>() { - }.getType()); - } catch (Exception e) { - return null; - } - } - - /** - * copyProperties - * @param o - * @param type - * @param <T> - * @return - */ - public static <T> T copyProperties(Object o, Type type) { - Gson gson = getGson(); - return gson.fromJson(gson.toJson(o), type); - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLMD5Utils.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLMD5Utils.java deleted file mode 100644 index 6559b86..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLMD5Utils.java +++ /dev/null @@ -1,185 +0,0 @@ -package com.hdl.linkpm.sdk.utils; - -import java.io.File; -import java.io.FileInputStream; -import java.io.UnsupportedEncodingException; -import java.math.BigInteger; -import java.nio.charset.StandardCharsets; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * Created by Tong on 2021/11/3. - */ -public final class HDLMD5Utils { - - - /** - * MD5杞瓧绗︿覆 - */ - public static String encodeMD5(byte[] f) { - try { - MessageDigest digest = MessageDigest.getInstance("MD5"); - digest.update(f); - byte[] messageDigest = digest.digest(); - return toHexString(messageDigest); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return ""; - } - /** - * MD5杞瓧绗︿覆 - */ - public static String encodeMD5(String s) { - try { - MessageDigest digest = MessageDigest.getInstance("MD5"); - digest.update(s.getBytes(StandardCharsets.UTF_8)); - byte[] messageDigest = digest.digest(); - return toHexString(messageDigest); - } catch (NoSuchAlgorithmException e) { - e.printStackTrace(); - } - return ""; - } - - private static String toHexString(byte[] keyData) { - if (keyData == null) { - return null; - } - int expectedStringLen = keyData.length * 2; - StringBuilder sb = new StringBuilder(expectedStringLen); - for (byte keyDatum : keyData) { - String hexStr = Integer.toString(keyDatum & 0x00FF, 16); - if (hexStr.length() == 1) { - hexStr = "0" + hexStr; - } - sb.append(hexStr); - } - return sb.toString(); - } - - /** - * MD5杞瓧绗︿覆 - * 棰濆鍊� - */ - public static String encodeMD52(String s) { - char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - try { - byte[] btInput = s.getBytes(StandardCharsets.UTF_8); - MessageDigest digest = MessageDigest.getInstance("MD5"); - digest.update(btInput); - byte[] md = digest.digest(); - int j = md.length; - char[] str = new char[j * 2]; - int k = 0; - for (byte byte0 : md) { - str[k++] = hexDigits[byte0 >>> 4 & 0xf]; - str[k++] = hexDigits[byte0 & 0xf]; - } - return new String(str); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - /** - * MD5鏂囦欢杞瓧绗︿覆 - */ - public static String encodeMD5(File f) { - if (!f.isFile()) { - return null; - } - MessageDigest digest; - byte[] buffer = new byte[1024]; - int len; - try { - digest = MessageDigest.getInstance("MD5"); - FileInputStream in = new FileInputStream(f); - while ((len = in.read(buffer, 0, 1024)) != -1) { - digest.update(buffer, 0, len); - } - in.close(); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - BigInteger bigInt = new BigInteger(1, digest.digest()); - return bigInt.toString(16); - } - - - - - - public final static String md5(String plainText) { - -// 杩斿洖瀛楃涓� - - String md5Str = null; - - try { - -// 鎿嶄綔瀛楃涓� - - StringBuffer buf = new StringBuffer(); - - MessageDigest md = - - MessageDigest.getInstance("MD5"); - -// 娣诲姞瑕佽繘琛岃绠楁憳瑕佺殑淇℃伅,浣跨敤 plainText 鐨� byte - - - md.update(plainText.getBytes()); - -// 璁$畻鍑烘憳瑕�,瀹屾垚鍝堝笇璁$畻銆� - - byte b[] = md.digest(); - - int i; - - for (int offset = 0; offset < b.length; offset++) { - - i = b[offset]; - - if (i < 0) { - - i += 256; - - } - - if (i < 16) { - - buf.append("0"); - - } - -// 灏嗘暣鍨� 鍗佽繘鍒� i - - - buf.append(Integer.toHexString(i)); - - } - -// 32浣嶇殑鍔犲瘑 - - md5Str = buf.toString(); - -// 16浣嶇殑鍔犲瘑 - -// md5Str = buf.toString().md5Strstring(8,24); - - } catch (Exception e) { - - e.printStackTrace(); - - } - - return md5Str; - - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLSDKLog.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLSDKLog.java deleted file mode 100644 index b424884..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLSDKLog.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.hdl.linkpm.sdk.utils; - -import android.util.Log; - -import com.hdl.linkpm.sdk.HDLLinkPMSdk; - -/** - * Created by jlchen on 12/2/21. - * SDK鎵撳嵃鎺у埗宸ュ叿绫� - */ -public class HDLSDKLog { - - private static boolean isEnabled = false; - - public static void d(String tag, String msg) { - if (tag != null && msg != null && isEnabled) { - Log.d(HDLLinkPMSdk.SDK_NAME, tag + "-- " + msg); - } - } - - public static void e(String tag, String msg) { - if (tag != null && msg != null && isEnabled) { - Log.e(HDLLinkPMSdk.SDK_NAME, tag + "-- " + msg); - } - } - - public static void w(String tag, String msg) { - if (tag != null && msg != null && isEnabled) { - Log.w(HDLLinkPMSdk.SDK_NAME, tag + "-- " + msg); - } - } - - public static void v(String tag, String msg) { - if (tag != null && msg != null && isEnabled) { - Log.v(HDLLinkPMSdk.SDK_NAME, tag + "-- " + msg); - } - } - - public static void i(String tag, String msg) { - if (tag != null && msg != null && isEnabled) { - Log.i(HDLLinkPMSdk.SDK_NAME, tag + "-- " + msg); - } - } - - public static void i(String msg) { - if (msg != null && isEnabled) { - Log.i(HDLLinkPMSdk.SDK_NAME, msg); - } - } - - public static void e(String msg) { - if (msg != null && isEnabled) { - Log.e(HDLLinkPMSdk.SDK_NAME, msg); - } - } - - /** - * 鏄惁寮�鍚疭DK鏃ュ織鎵撳嵃 - * @param bOpen - */ - public static void setHDLSDKLogOpen(boolean bOpen){ - isEnabled = bOpen; - } - - public static boolean isLogOpen() { - return isEnabled; - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLSDKSPUtils.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLSDKSPUtils.java deleted file mode 100644 index ce21744..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/utils/HDLSDKSPUtils.java +++ /dev/null @@ -1,147 +0,0 @@ -package com.hdl.linkpm.sdk.utils; - -import android.content.Context; -import android.content.SharedPreferences; - -import androidx.annotation.NonNull; - -import com.hdl.linkpm.sdk.HDLLinkPMSdk; - -import java.util.Collections; -import java.util.Map; -import java.util.Set; - -/** - * Created by Tong on 2021/11/3. - */ -public class HDLSDKSPUtils { - - private static final String APP_PREFERENCES_KEY = "com.hdl.link.sdk.profile"; - private static final SharedPreferences PREFERENCES = - HDLLinkPMSdk.getContext().getApplicationContext().getSharedPreferences(APP_PREFERENCES_KEY, Context.MODE_PRIVATE); - - private static SharedPreferences getAppPreference() { - return PREFERENCES; - } - - - //======閫氱敤瀛樺偍======== - public static void put(@NonNull final String key, final String value) { - getAppPreference().edit().putString(key, value).apply(); - } - - - public static String getString(@NonNull final String key) { - return getString(key, ""); - } - - - public static String getString(@NonNull final String key, final String defaultValue) { - return getAppPreference().getString(key, defaultValue); - } - - - public static void put(@NonNull final String key, final int value) { - put(key, value, false); - } - - - public static void put(@NonNull final String key, final int value, final boolean isCommit) { - getAppPreference().edit().putInt(key, value).apply(); - } - - - public static int getInt(@NonNull final String key) { - return getInt(key, -1); - } - - - public static int getInt(@NonNull final String key, final int defaultValue) { - return getAppPreference().getInt(key, defaultValue); - } - - - public static void put(@NonNull final String key, final long value) { - getAppPreference().edit().putLong(key, value).apply(); - } - - - public static long getLong(@NonNull final String key) { - return getLong(key, -1L); - } - - - public static long getLong(@NonNull final String key, final long defaultValue) { - return getAppPreference().getLong(key, defaultValue); - } - - - public static void put(@NonNull final String key, final float value) { - getAppPreference().edit().putFloat(key, value).apply(); - } - - - public static float getFloat(@NonNull final String key) { - return getFloat(key, -1f); - } - - - public static float getFloat(@NonNull final String key, final float defaultValue) { - return getAppPreference().getFloat(key, defaultValue); - } - - - public static void put(@NonNull final String key, final boolean value) { - getAppPreference().edit().putBoolean(key, value).apply(); - } - - - public static boolean getBoolean(@NonNull final String key) { - return getBoolean(key, false); - } - - - public static boolean getBoolean(@NonNull final String key, final boolean defaultValue) { - return getAppPreference().getBoolean(key, defaultValue); - } - - - public static void put(@NonNull final String key, final Set<String> value) { - getAppPreference().edit().putStringSet(key, value).apply(); - } - - - public static Set<String> getStringSet(@NonNull final String key) { - return getStringSet(key, Collections.emptySet()); - } - - - public static Set<String> getStringSet(@NonNull final String key, - final Set<String> defaultValue) { - return getAppPreference().getStringSet(key, defaultValue); - } - - - public static Map<String, ?> getAll() { - return getAppPreference().getAll(); - } - - - public static boolean contains(@NonNull final String key) { - return getAppPreference().contains(key); - } - - - public static void remove(@NonNull final String key) { - getAppPreference().edit().remove(key).apply(); - } - - public static void clear() { - getAppPreference() - .edit() - .clear() - .apply(); - } - - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/HDLPMDataBackup.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/HDLPMDataBackup.java deleted file mode 100644 index ac3b0f9..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/HDLPMDataBackup.java +++ /dev/null @@ -1,127 +0,0 @@ -package com.hdl.linkpm.sdk.workbench.databackup; - -import com.hdl.linkpm.sdk.core.bean.PageInfoListBean; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.workbench.databackup.bean.BackupListBean; -import com.hdl.linkpm.sdk.workbench.databackup.bean.GatewayBackupBean; -import com.hdl.linkpm.sdk.workbench.databackup.controller.DataBackupController; - -import java.util.List; - -/** - * Created by hxb on 2022/2/23. - */ -public class HDLPMDataBackup { - //instance - private volatile static HDLPMDataBackup instance; - - /** - * getInstance - * - * @return HDLPMDataBackup - */ - public static synchronized HDLPMDataBackup getInstance() { - if (instance == null) { - synchronized (HDLPMDataBackup.class) { - if (instance == null) { - instance = new HDLPMDataBackup(); - } - } - } - return instance; - } - - /***************澶囦唤鏂囦欢涓婁紶涓嬭浇***************/ - /** - * 涓婁紶澶囦唤鏂囦欢 - * - * @param homeId 浣忓畢id - * @param data 鏂囦欢 澶囦唤鏂囦欢鏁版嵁 - * @param callBack - * @return - */ - public void databackupUpload(String homeId, byte[] data, IDefaultCallBack callBack) { - DataBackupController.getInstance().dataBackupUpload(homeId, data, callBack); - } - - /** - * 鍒犻櫎澶囦唤鏁版嵁 - * - * @param homeId 浣忓畢id - * @param callBack - * @return - */ - public void databackDel(String homeId, IDefaultCallBack callBack) { - DataBackupController.getInstance().databackDel(homeId, callBack); - } - - /** - * 鑾峰彇涓嬭浇鏈�鏂拌矾寰� - * - * @param homeId 浣忓畢id - * @param filePath - * @param callBack - * @return - */ - public void databackDownload(String homeId, String filePath, IDefaultCallBack callBack) { - DataBackupController.getInstance().databackDownload(homeId, filePath, callBack); - } - - /** - * 鑾峰彇浜戠澶囦唤鍒楄〃 - * - * @param userId 鐢ㄦ埛id - * @param pageNo 寮�濮嬬储寮� - * @param pageSize 椤甸潰澶у皬 - * @param callBack - * @return - */ - public void databackList(String userId, int pageNo, int pageSize, IResponseCallBack<PageInfoListBean<BackupListBean>> callBack) { - DataBackupController.getInstance().databackList(userId, pageNo, pageSize, callBack); - } - - /** - * 鑾峰彇缃戝叧鏈�鏂扮殑涓変唤澶囦唤鏁版嵁 - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param callBack 鍥炶皟 - */ - public void getGatewayBackupDataList(String homeId, String gatewayId, IResponseCallBack<List<GatewayBackupBean>> callBack) { - DataBackupController.getInstance().getGatewayBackupDataList(homeId, gatewayId, callBack); - } - /** - * 鑾峰彇璋冭瘯瀹屾垚鐨勫浠芥枃浠跺洖澶� - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param callBack 鍥炶皟 - */ - public void getDebugGatewayBackupDataList(String homeId, String gatewayId, IResponseCallBack<GatewayBackupBean> callBack) { - DataBackupController.getInstance().getDebugGatewayBackupDataList(homeId, gatewayId, callBack); - } - /** - * 璋冭瘯瀹濋�夋嫨缃戝叧鎭㈠鐨勫浠芥枃浠� - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param recordId 澶囦唤璁板綍id - * @param callBack 鍥炶皟 - */ - public void getGatewayBackupRecover(String homeId, String gatewayId,long recordId, IResponseCallBack callBack) { - DataBackupController.getInstance().getGatewayBackupRecover(homeId, gatewayId,recordId, callBack); - } - /** - * 缃戝叧鏇挎崲 - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param newMac newMac 鏂扮綉鍏砿ac - * @param callBack 鍥炶皟 - */ - public void getGatewayReplace(String homeId, String gatewayId,String newMac, IResponseCallBack callBack) { - DataBackupController.getInstance().getGatewayReplace(homeId, gatewayId,newMac, callBack); - } - -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/bean/BackupListBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/bean/BackupListBean.java deleted file mode 100644 index 40fa5ad..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/bean/BackupListBean.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.hdl.linkpm.sdk.workbench.databackup.bean; - -/** - * Created by hxb on 2022/2/28. - */ -public class BackupListBean { - - /** - * 浣忓畢Id - */ - private String houseId; - /** - * 澶囦唤鏃堕棿 - */ - private Long backupTime; - - private String houseName;//浣忓畢鍚嶇О - private String communityName;//椤圭洰鍚嶇О - private String houseLayoutName;//鎴垮瀷鎴栨埛鍨嬪悕绉� - private String debugStatus;//璋冭瘯鐘舵�� - - /** - * 鑾峰彇浣忓畢Id - * @return - */ - public String getHouseId() { - return houseId; - } - - /** - * 璁剧疆浣忓畢Id - * @param houseId - */ - public void setHouseId(String houseId) { - this.houseId = houseId; - } - - /** - * 鑾峰彇澶囦唤鏃堕棿 - * @return - */ - public Long getBackupTime() { - return backupTime; - } - - /** - * 璁剧疆澶囦唤鏃堕棿 - * @param backupTime - */ - public void setBackupTime(Long backupTime) { - this.backupTime = backupTime; - } - - /** - * 鑾峰彇浣忓畢鍚嶇О - * @return - */ - public String getHouseName() { - return houseName; - } - - /** - * 璁剧疆浣忓畢鍚嶇О - * @param houseName - */ - public void setHouseName(String houseName) { - this.houseName = houseName; - } - - /** - * 鑾峰彇椤圭洰鍚嶇О - * @return - */ - public String getCommunityName() { - return communityName; - } - - /** - * 璁剧疆椤圭洰鍚嶇О - * @param communityName - */ - public void setCommunityName(String communityName) { - this.communityName = communityName; - } - - /** - * 鑾峰彇鎴垮瀷鎴栨埛鍨嬪悕绉� - * @return - */ - public String getHouseLayoutName() { - return houseLayoutName; - } - - /** - * 璁剧疆鎴垮瀷鎴栨埛鍨嬪悕绉� - * @param houseLayoutName - */ - public void setHouseLayoutName(String houseLayoutName) { - this.houseLayoutName = houseLayoutName; - } - - /** - * 鑾峰彇璋冭瘯鐘舵�� - * @return - */ - public String getDebugStatus() { - return debugStatus; - } - - /** - * 璁剧疆璋冭瘯鐘舵�� - * @param debugStatus - */ - public void setDebugStatus(String debugStatus) { - this.debugStatus = debugStatus; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/bean/GatewayBackupBean.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/bean/GatewayBackupBean.java deleted file mode 100644 index b9be072..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/bean/GatewayBackupBean.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.hdl.linkpm.sdk.workbench.databackup.bean; - -import java.io.Serializable; - -public class GatewayBackupBean implements Serializable{ - - private long recordId;//澶囦唤璁板綍id - private long createTime;//澶囦唤鏃堕棿 - private long gatewayId;//缃戝叧id - private String spaceCode;//绌洪棿缂栫爜(璋冭瘯瀹濊幏鍙栧~houseId) - private int backupOrder;//1 2 3 鏈�鏂板浠芥帓搴� - private String backupFileUrl;//澶囦唤鏂囦欢涓嬭浇鍦板潃 - - - public long getRecordId() { - return recordId; - } - - public void setRecordId(long recordId) { - this.recordId = recordId; - } - - public long getCreateTime() { - return createTime; - } - - public void setCreateTime(long createTime) { - this.createTime = createTime; - } - - public long getGatewayId() { - return gatewayId; - } - - public void setGatewayId(long gatewayId) { - this.gatewayId = gatewayId; - } - - public String getSpaceCode() { - return spaceCode; - } - - public void setSpaceCode(String spaceCode) { - this.spaceCode = spaceCode; - } - - public int getBackupOrder() { - return backupOrder; - } - - public void setBackupOrder(int backupOrder) { - this.backupOrder = backupOrder; - } - - public String getBackupFileUrl() { - return backupFileUrl; - } - - public void setBackupFileUrl(String backupFileUrl) { - this.backupFileUrl = backupFileUrl; - } -} diff --git a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/controller/DataBackupController.java b/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/controller/DataBackupController.java deleted file mode 100644 index 93c8e76..0000000 --- a/HDLLinkPMSdk/src/main/java/com/hdl/linkpm/sdk/workbench/databackup/controller/DataBackupController.java +++ /dev/null @@ -1,377 +0,0 @@ -package com.hdl.linkpm.sdk.workbench.databackup.controller; - - - -import android.os.Environment; - -import com.google.gson.JsonObject; -import com.hdl.hdlhttp.HxHttp; -import com.hdl.hdlhttp.callback.HxException; -import com.hdl.linkpm.sdk.HDLLinkPMSdk; -import com.hdl.linkpm.sdk.core.api.HDLCloudUserApi; -import com.hdl.linkpm.sdk.core.bean.PageInfoListBean; -import com.hdl.linkpm.sdk.core.callback.IDefaultCallBack; -import com.hdl.linkpm.sdk.core.callback.IResponseCallBack; -import com.hdl.linkpm.sdk.core.exception.HDLException; -import com.hdl.linkpm.sdk.core.response.HDLResponse; -import com.hdl.linkpm.sdk.utils.HDLExceptionSubmitUtils; -import com.hdl.linkpm.sdk.utils.HDLFileUtils; -import com.hdl.linkpm.sdk.utils.HDLGsonUtils; -import com.hdl.linkpm.sdk.workbench.databackup.bean.BackupListBean; -import com.hdl.linkpm.sdk.workbench.databackup.bean.GatewayBackupBean; - -import java.io.File; -import java.util.List; - -import io.reactivex.rxjava3.disposables.Disposable; -import io.reactivex.rxjava3.subscribers.DisposableSubscriber; -import okhttp3.ResponseBody; - -/** - * Created by hxb on 2022/2/23. - */ -public class DataBackupController { - /** - * instance - */ - private volatile static DataBackupController instance; - - /** - * getInstance - * - * @return DataBackupController - */ - public static synchronized DataBackupController getInstance() { - if (instance == null) { - synchronized (DataBackupController.class) { - if (instance == null) { - instance = new DataBackupController(); - } - } - } - return instance; - } - - /** - * 涓婁紶澶囦唤鏁版嵁 - * - * @param homeId 浣忓畢ID - * @param data 涓婁紶鐨勬暟鎹唴瀹� - * @param callBack - * @return - */ - public Disposable dataBackupUpload(String homeId, byte[] data, IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_BACKUP_UPLOAD + "?houseId=" + homeId; - String path = HDLLinkPMSdk.getContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getPath() + "/Temp/"; - String fileName = System.currentTimeMillis() + ""; - HDLFileUtils.byteToFile(data, path, fileName); - File file = new File(path + fileName); - - return HxHttp.builder() - .file(file, "file") - .url(requestUrl) - .build() - .upload() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String code) { - HDLFileUtils.deleteFile(file); - if (callBack != null) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLFileUtils.deleteFile(file); - HDLExceptionSubmitUtils.submit(requestUrl, homeId, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鍒犻櫎澶囦唤鏁版嵁 - * - * @param homeId 浣忓畢ID - * @param callBack - * @return - */ - public Disposable databackDel(String homeId, IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_BACKUP_DEL; - JsonObject json = new JsonObject(); - json.add("houseIds", HDLGsonUtils.toJsonArray(new String[]{homeId})); - return HxHttp.builder() - .raw(json.toString()) - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String url) { - if (null != callBack) { - callBack.onSuccess(); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇鏁版嵁鏈�鏂颁笅杞借矾寰� - * - * @param homeId 浣忓畢ID - * @param callBack - * @return - */ - public Disposable databackDownload(String homeId,String path, IDefaultCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_BACKUP_DOWNLOAD_URL; - JsonObject json = new JsonObject(); - json.addProperty("houseId", homeId); - return HxHttp.builder() - .raw(json.toString()) - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String url) { - HxHttp.builder() - .url(url) - .build() - .download() - .subscribe(new DisposableSubscriber<ResponseBody>() { - @Override - public void onNext(ResponseBody responseBody) { - if (HDLFileUtils.writeFile(path, responseBody.byteStream())) { - if (null != callBack) { - callBack.onSuccess(); - } - } else { - if (callBack != null) { - callBack.onFailure(new HDLException(HxException.ErrorCode.UNKNOWN, "Download Fail")); - } - } - } - - @Override - public void onError(Throwable t) { - if (callBack != null) { - callBack.onFailure(new HDLException(HxException.ErrorCode.UNKNOWN, t.getMessage())); - } - } - - @Override - public void onComplete() { - - } - }); - - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 鑾峰彇澶囦唤鍒楄〃 - * - * @param userId 鐢ㄦ埛ID - * @param pageNo 寮�濮嬬储寮� - * @param pageSize 椤甸潰澶у皬 - * @param callBack - * @return - */ - public Disposable databackList(String userId,int pageNo, int pageSize, IResponseCallBack<PageInfoListBean<BackupListBean>> callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_BACKUP_LIST; - JsonObject json = new JsonObject(); - json.addProperty("pageNo", pageNo); - json.addProperty("pageSize", pageSize); - json.addProperty("debugUserId", userId); - return HxHttp.builder() - .raw(json.toString()) - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<PageInfoListBean<BackupListBean>>() { - @Override - public void onResponse(PageInfoListBean<BackupListBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - - /** - * 鑾峰彇缃戝叧鏈�鏂扮殑涓変唤澶囦唤鏁版嵁 - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param callBack - * @return - */ - public Disposable getGatewayBackupDataList(String homeId, String gatewayId, IResponseCallBack<List<GatewayBackupBean>> callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GATEWAY_BACKUP_LIST; - JsonObject json = new JsonObject(); - json.addProperty("spaceCode", homeId); - json.addProperty("gatewayId", gatewayId); - return HxHttp.builder() - .raw(json.toString()) - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<List<GatewayBackupBean>>() { - @Override - public void onResponse(List<GatewayBackupBean> response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - /** - * 鑾峰彇璋冭瘯瀹屾垚鐨勫浠芥枃浠跺洖澶� - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param callBack - * @return - */ - public Disposable getDebugGatewayBackupDataList(String homeId, String gatewayId, IResponseCallBack<GatewayBackupBean> callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GATEWAY_BACKUP_DEBUGCOMPLETEBACKUPFILE; - JsonObject json = new JsonObject(); - json.addProperty("spaceCode", homeId); - json.addProperty("gatewayId", gatewayId); - return HxHttp.builder() - .raw(json.toString()) - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<GatewayBackupBean>() { - @Override - public void onResponse(GatewayBackupBean response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - /** - * 璋冭瘯瀹濋�夋嫨缃戝叧鎭㈠鐨勫浠芥枃浠� - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param recordId 澶囦唤璁板綍id - * @param callBack 鍥炶皟 - * @return Disposable - */ - public Disposable getGatewayBackupRecover(String homeId, String gatewayId,long recordId, IResponseCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GATEWAY_BACKUP_RECOVER; - JsonObject json = new JsonObject(); - json.addProperty("spaceCode", homeId); - json.addProperty("gatewayId", gatewayId); - json.addProperty("recordId", recordId); - return HxHttp.builder() - .raw(json.toString()) - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - /** - * 缃戝叧鏇挎崲 - * - * @param homeId 浣忓畢Id - * @param gatewayId 浜戠涓婄綉鍏砱atewayId - * @param newMac newMac 鏂扮綉鍏砿ac - * @param callBack 鍥炶皟 - * @return Disposable - */ - public Disposable getGatewayReplace(String homeId, String gatewayId,String newMac, IResponseCallBack callBack) { - String requestUrl = HDLLinkPMSdk.getUserRegionUrl() + HDLCloudUserApi.POST_GATEWAY_REPLACE; - JsonObject json = new JsonObject(); - json.addProperty("homeId", homeId); - json.addProperty("gatewayId", gatewayId);//鏃х綉鍏砳d - json.addProperty("newMac", newMac);//newMac 鏂扮綉鍏砿ac - return HxHttp.builder() - .raw(json.toString()) - .url(requestUrl) - .build() - .post() - .subscribeWith(new HDLResponse<String>() { - @Override - public void onResponse(String response) { - if (callBack != null) { - callBack.onSuccess(response); - } - } - - @Override - public void onFailure(HDLException e) { - HDLExceptionSubmitUtils.submit(requestUrl, json, e); - if (callBack != null) { - callBack.onFailure(e); - } - } - }); - } - - -} diff --git a/HDLLog/.gitignore b/HDLLog/.gitignore deleted file mode 100644 index 42afabf..0000000 --- a/HDLLog/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/HDLLog/build.gradle b/HDLLog/build.gradle deleted file mode 100644 index 4a57958..0000000 --- a/HDLLog/build.gradle +++ /dev/null @@ -1,37 +0,0 @@ -plugins { - id 'com.android.library' -} - -android { - compileSdkVersion 29 - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 29 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -dependencies { - api 'com.aliyun.openservices:aliyun-log-android-sdk:2.6.2' -// implementation 'androidx.appcompat:appcompat:1.1.0' -// implementation 'com.google.android.material:material:1.1.0' -// testImplementation 'junit:junit:4.+' -// androidTestImplementation 'androidx.test.ext:junit:1.1.1' -// androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' -} \ No newline at end of file diff --git a/HDLLog/consumer-rules.pro b/HDLLog/consumer-rules.pro deleted file mode 100644 index e69de29..0000000 --- a/HDLLog/consumer-rules.pro +++ /dev/null diff --git a/HDLLog/proguard-rules.pro b/HDLLog/proguard-rules.pro deleted file mode 100644 index 481bb43..0000000 --- a/HDLLog/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/HDLLog/src/main/AndroidManifest.xml b/HDLLog/src/main/AndroidManifest.xml deleted file mode 100644 index 052ac47..0000000 --- a/HDLLog/src/main/AndroidManifest.xml +++ /dev/null @@ -1,5 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.hdl.loglibrary"> - -</manifest> \ No newline at end of file diff --git a/HDLLog/src/main/java/com/aliyu/LogProducerClient.java b/HDLLog/src/main/java/com/aliyu/LogProducerClient.java deleted file mode 100755 index e3f0746..0000000 --- a/HDLLog/src/main/java/com/aliyu/LogProducerClient.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.aliyu; - -import android.content.Context; - -import com.aliyun.sls.android.producer.LogProducerCallback; -import com.aliyun.sls.android.producer.LogProducerConfig; -import com.aliyun.sls.android.producer.LogProducerException; -import com.aliyun.sls.android.producer.LogProducerResult; - -import java.io.File; - -/** - * @author gordon - * @date 2021/08/25 - */ -public class LogProducerClient { - private static final String TAG = "ProducerClient"; - - private com.aliyun.sls.android.producer.LogProducerClient client = null; - private Context context; - protected String endpoint; - protected String logProject; - protected String logStore; - protected String accessKeyId; - protected String accessKeySecret; - protected String accessKeyToken; - protected String pluginAppId; - - public LogProducerClient(Context context, String endpoint, String logProject, String logStore, String accessKeyId, String accessKeySecret, String accessKeyToken, String pluginAppId) { - this.context = context; - this.endpoint = endpoint; - this.logProject = logProject; - this.logStore = logStore; - this.accessKeyId = accessKeyId; - this.accessKeySecret = accessKeySecret; - this.accessKeyToken = accessKeyToken; - this.pluginAppId=pluginAppId; - } - - - public void initProducer() { - try { - // endpoint 蹇呴』鏄互 https:// 鎴� http:// 寮�澶寸殑閾炬帴 - final String endpoint = this.endpoint; - final String project = this.logProject; - final String logstore = this.logStore; - final String accessKeyId = this.accessKeyId; - final String accessKeySecret = this.accessKeySecret; - final String accessKeyToken = this.accessKeyToken; - - LogProducerConfig config = new LogProducerConfig(context, endpoint, project, logstore, accessKeyId, accessKeySecret, accessKeyToken); - // 璁剧疆涓婚 - config.setTopic("test_topic"); - // 璁剧疆tag淇℃伅锛屾tag浼氶檮鍔犲湪姣忔潯鏃ュ織涓� - config.addTag("test", "test_tag"); - // 姣忎釜缂撳瓨鐨勬棩蹇楀寘鐨勫ぇ灏忎笂闄愶紝鍙栧�间负1~5242880锛屽崟浣嶄负瀛楄妭銆傞粯璁や负1024 * 1024 - config.setPacketLogBytes(1024 * 1024); - // 姣忎釜缂撳瓨鐨勬棩蹇楀寘涓寘鍚棩蹇楁暟閲忕殑鏈�澶у�硷紝鍙栧�间负1~4096锛岄粯璁や负1024 - config.setPacketLogCount(1024); - // 琚紦瀛樻棩蹇楃殑鍙戦�佽秴鏃舵椂闂达紝濡傛灉缂撳瓨瓒呮椂锛屽垯浼氳绔嬪嵆鍙戦�侊紝鍗曚綅涓烘绉掞紝榛樿涓�3000 - config.setPacketTimeout(3000); - // 鍗曚釜Producer Client瀹炰緥鍙互浣跨敤鐨勫唴瀛樼殑涓婇檺锛岃秴鍑虹紦瀛樻椂add_log鎺ュ彛浼氱珛鍗宠繑鍥炲け璐� - // 榛樿涓�64 * 1024 * 1024 - config.setMaxBufferLimit(64 * 1024 * 1024); - // 鍙戦�佺嚎绋嬫暟锛岄粯璁や负1 - config.setSendThreadCount(1); - - //缃戠粶杩炴帴瓒呮椂鏃堕棿锛屾暣鏁帮紝鍗曚綅绉掞紝榛樿涓�10 - config.setConnectTimeoutSec(10); - //鏃ュ織鍙戦�佽秴鏃舵椂闂达紝鏁存暟锛屽崟浣嶇锛岄粯璁や负15 - config.setSendTimeoutSec(10); - //flusher绾跨▼閿�姣佹渶澶х瓑寰呮椂闂达紝鏁存暟锛屽崟浣嶇锛岄粯璁や负1 - config.setDestroyFlusherWaitSec(2); - //sender绾跨▼姹犻攢姣佹渶澶х瓑寰呮椂闂达紝鏁存暟锛屽崟浣嶇锛岄粯璁や负1 - config.setDestroySenderWaitSec(2); - //鏁版嵁涓婁紶鏃剁殑鍘嬬缉绫诲瀷锛岄粯璁や负LZ4鍘嬬缉锛�0 涓嶅帇缂╋紝1 LZ4鍘嬬缉锛岄粯璁や负1 - config.setCompressType(1); - //璁惧鏃堕棿涓庢爣鍑嗘椂闂翠箣宸紝鍊间负鏍囧噯鏃堕棿-璁惧鏃堕棿锛屼竴鑸绉嶆儏鍐电敤鎴峰鎴风璁惧鏃堕棿涓嶅悓姝ョ殑鍦烘櫙 - //鏁存暟锛屽崟浣嶇锛岄粯璁や负0锛涙瘮濡傚綋鍓嶈澶囨椂闂翠负1607064208, 鏍囧噯鏃堕棿涓�1607064308锛屽垯鍊艰缃负 1607064308 - 1607064208 = 10 - config.setNtpTimeOffset(3); - //鏃ュ織鏃堕棿涓庢湰鏈烘椂闂翠箣宸紝瓒呰繃璇ュぇ灏忓悗浼氭牴鎹� `drop_delay_log` 閫夐」杩涜澶勭悊銆� - //涓�鑸绉嶆儏鍐靛彧浼氬湪璁剧疆persistent鐨勬儏鍐典笅鍑虹幇锛屽嵆璁惧涓嬬嚎鍚庯紝瓒呰繃鍑犲ぉ/鏁版湀鍚姩锛屽彂閫侀��鍑哄墠鏈彂鍑虹殑鏃ュ織 - //鏁存暟锛屽崟浣嶇锛岄粯璁や负7*24*3600锛屽嵆7澶� - config.setMaxLogDelayTime(7 * 24 * 3600); - //瀵逛簬瓒呰繃 `max_log_delay_time` 鏃ュ織鐨勫鐞嗙瓥鐣� - //0 涓嶄涪寮冿紝鎶婃棩蹇楁椂闂翠慨鏀逛负褰撳墠鏃堕棿; 1 涓㈠純锛岄粯璁や负 1 锛堜涪寮冿級 - config.setDropDelayLog(0); - //鏄惁涓㈠純閴存潈澶辫触鐨勬棩蹇楋紝0 涓嶄涪寮冿紝1涓㈠純 - //榛樿涓� 0锛屽嵆涓嶄涪寮� - config.setDropUnauthorizedLog(0); - // 鏄惁浣跨敤涓荤嚎绋嬪洖璋� - // false: 浣跨敤涓荤嚎绋嬪洖璋冦�傚洖璋冧細鍦ㄤ富绾跨▼涓婃墽琛岋紝涓旀瘡涓� client 閮芥湁鑷繁鍗曠嫭鐨勫洖璋冦�� - // true: 浣跨敤 sender 绾跨▼鍥炶皟銆傚洖璋冧細鍦� sender 鐜板憟涓婃墽琛岋紝姣忔鎵ц鍥炶皟鏃堕兘浼� attach 涓�涓柊鐨� java 绾跨▼锛屾墍鏈� client 鍏辩敤涓�涓洖璋冦�� - // 娉ㄦ剰锛氶粯璁や娇鐢� sender 绾跨▼鍥炶皟銆� - config.setCallbackFromSenderThread(false); - - /** - * 浠ヤ笅涓哄紑鍚柇鐐圭画浼犵殑閰嶇疆, 鎸夌収濡備笅閰嶇疆寮�鍚柇鐐圭画浼犲姛鑳藉悗, 鏃ュ織浼氬厛缂撳瓨鍒版湰鍦� - */ - // 1 寮�鍚柇鐐圭画浼犲姛鑳斤紝 0 鍏抽棴 - // 姣忔鍙戦�佸墠浼氭妸鏃ュ織淇濆瓨鍒版湰鍦扮殑binlog鏂囦欢锛屽彧鏈夊彂閫佹垚鍔熸墠浼氬垹闄わ紝淇濊瘉鏃ュ織涓婁紶At Least Once - config.setPersistent(1); - // 鎸佷箙鍖栫殑鏂囦欢鍚嶏紝闇�瑕佷繚璇佹枃浠舵墍鍦ㄧ殑鏂囦欢澶瑰凡鍒涘缓銆� - // !!!!!!!!!!!!!!!!!!!娉ㄦ剰!!!!!!!!!!!!!!!!!!! - // 閰嶇疆澶氫釜瀹㈡埛绔椂锛屼笉搴旇缃浉鍚屾枃浠� - config.setPersistentFilePath(context.getFilesDir() + String.format("%slog_data.dat", File.separator)); - // 鏄惁姣忔AddLog寮哄埗鍒锋柊锛岄珮鍙潬鎬у満鏅缓璁墦寮� - config.setPersistentForceFlush(0); - // 鎸佷箙鍖栨枃浠舵粴鍔ㄤ釜鏁帮紝寤鸿璁剧疆鎴�10銆� - config.setPersistentMaxFileCount(10); - // 姣忎釜鎸佷箙鍖栨枃浠剁殑澶у皬锛屽缓璁缃垚1-10M - config.setPersistentMaxFileSize(1024 * 1024); - // 鏈湴鏈�澶氱紦瀛樼殑鏃ュ織鏁帮紝涓嶅缓璁秴杩�1M锛岄�氬父璁剧疆涓�65536鍗冲彲 - config.setPersistentMaxLogCount(65536); - - /** - * 浠ヤ笅涓洪�氳繃 LogProducerConfig 鏋勯�犱竴涓� LogProducerClient 瀹炰緥 - */ - // callback涓哄彲閫夐厤缃�, 濡傛灉涓嶉渶瑕佸叧娉ㄦ棩蹇楃殑鍙戦�佹垚鍔熸垨澶辫触鐘舵��, 鍙互涓嶆敞鍐� callback - final LogProducerCallback callback = new LogProducerCallback() { - @Override - public void onCall(int resultCode, String reqId, String errorMessage, int logBytes, int compressedBytes) { - // resultCode: 鐘舵�佺爜, 璇﹁ LogProducerResult - // reqId: 璇锋眰Id, 宸茬粡搴熷純 - // errorMessage: 澶辫触淇℃伅 - // logBytes: 鏃ュ織鍘熷瀛楄妭鏁� - // compressedBytes: 鏃ュ織鍘嬬缉瀛楄妭鏁� - android.util.Log.e(TAG, String.format("resultCode: %d, reqId: %s, errorMessage: %s, logBytes: %d, compressedBytes: %d", resultCode, reqId, errorMessage, logBytes, compressedBytes)); -// printStatus(String.format("send log resultCode: %s, reqId: %s, errorMessage: %s, logBytes: %d, compressedBytes: %d", LogProducerResult.fromInt(resultCode), reqId, errorMessage, logBytes, compressedBytes)); - } - }; - // 闇�瑕佸叧娉ㄦ棩蹇楃殑鍙戦�佹垚鍔熸垨澶辫触鐘舵�佹椂, 绗簩涓弬鏁伴渶瑕佷紶鍏ヤ竴涓� callbak - client = new com.aliyun.sls.android.producer.LogProducerClient(config, callback); - } catch (LogProducerException e) { - e.printStackTrace(); - } - } - - public void sendLog(com.aliyun.sls.android.producer.Log log) { - LogProducerResult result = client.addLog(log); - } - - - private com.aliyun.sls.android.producer.Log oneLog() { - com.aliyun.sls.android.producer.Log log = new com.aliyun.sls.android.producer.Log(); - log.putContent("content_key_1", "1abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_2", "2abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_3", "3abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_4", "4abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_5", "5abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_6", "6abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_7", "7abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_8", "8abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("content_key_9", "9abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+"); - log.putContent("random", String.valueOf(Math.random())); - log.putContent("content", "涓枃锔�"); - log.putContent(null, "null"); - log.putContent("null", null); - return log; - } -} diff --git a/HDLLog/src/main/java/com/hdl/log/HDLLog.java b/HDLLog/src/main/java/com/hdl/log/HDLLog.java deleted file mode 100644 index d41cdec..0000000 --- a/HDLLog/src/main/java/com/hdl/log/HDLLog.java +++ /dev/null @@ -1,103 +0,0 @@ -package com.hdl.log; - -import android.content.Context; - -import com.hdl.log.bean.LogBean; -import com.hdl.log.utils.LogUtil; - - -/** - * Created by hxb on 2023/3/14. - */ -public class HDLLog { - /** - * 闃块噷浜戞棩蹇梐ccessId - */ - private static String accessId; - /** - * 闃块噷浜慳ccessKey - */ - private static String accessKey; - /** - * 椤圭洰鍚� - */ - private static String projectName; - /** - * 寮傚父鏃ュ織搴撳悕 - */ - private static String exceptionLog; - /** - * 鍩嬬偣搴撳悕 - */ - private static String eventTracking; - - private static String endPoint; - - private static Context context; - /** - * 鑾峰彇褰撳墠Context - * @return - */ - public static Context getContext() - { - return context; - } - - public static void init(Context context, String endPoint,String accessId, String accessKey, String projectName,String exceptionLog,String eventTracking){ - HDLLog.context=context; - HDLLog.endPoint=endPoint; - HDLLog.accessId = accessId; - HDLLog.accessKey = accessKey; - HDLLog.projectName = projectName; - HDLLog.exceptionLog = exceptionLog; - HDLLog.eventTracking = eventTracking; - } - - public static String getAccessId() { - return accessId; - } - - public static void setAccessId(String accessId) { - HDLLog.accessId = accessId; - } - - public static String getAccessKey() { - return accessKey; - } - - public static void setAccessKey(String accessKey) { - HDLLog.accessKey = accessKey; - } - - public static String getProjectName() { - return projectName; - } - - public static void setProjectName(String projectName) { - HDLLog.projectName = projectName; - } - - public static String getExceptionLog() { - return exceptionLog; - } - - public static void setExceptionLog(String exceptionLog) { - HDLLog.exceptionLog = exceptionLog; - } - - public static String getEventTracking() { - return eventTracking; - } - - public static void setEventTracking(String eventTracking) { - HDLLog.eventTracking = eventTracking; - } - - public static String getEndPoint() { - return endPoint; - } - - public static void setEndPoint(String endPoint) { - HDLLog.endPoint = endPoint; - } -} diff --git a/HDLLog/src/main/java/com/hdl/log/bean/LogBean.java b/HDLLog/src/main/java/com/hdl/log/bean/LogBean.java deleted file mode 100644 index 227a564..0000000 --- a/HDLLog/src/main/java/com/hdl/log/bean/LogBean.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.hdl.log.bean; - -import java.io.Serializable; - -/** - * Created by hxb on 2023/4/3. - */ -public class LogBean implements Serializable { - /** - * 鐢ㄦ埛id锛岄潪蹇呭~ - */ - private String userId; - /** - * 浣忓畢id锛岄潪蹇呭~ - */ - private String homeId; - /** - * 缃戝叧mac锛岄潪蹇呭~ - */ - private String mac; - /** - * 鏍囬锛屽繀椤昏濉� - */ - private String title; - /** - * 鏃ュ織鏃堕棿 - */ - private String time; - /** - * 绯荤粺锛欼OS銆丄ndroid銆乄indows銆佺綉鍏� - */ - private String userAgent; - /** - * 杞欢鐗堟湰 - */ - private String appVersion; - private String type; - - public String getUserId() { - return userId == null ? "" : userId; - } - - - public String getHomeId() { - return homeId == null ? "" : homeId; - } - - public void setUserId(String userId) { - this.userId = userId; - } - - public void setHomeId(String homeId) { - this.homeId = homeId; - } - public String getMac() { - return mac; - } - - public void setMac(String mac) { - this.mac = mac; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public String getUserAgent() { - return userAgent; - } - - public void setUserAgent(String userAgent) { - this.userAgent = userAgent; - } - - public String getAppVersion() { - return appVersion; - } - - public void setAppVersion(String appVersion) { - this.appVersion = appVersion; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } -} diff --git a/HDLLog/src/main/java/com/hdl/log/enums/Level.java b/HDLLog/src/main/java/com/hdl/log/enums/Level.java deleted file mode 100644 index 736b2ef..0000000 --- a/HDLLog/src/main/java/com/hdl/log/enums/Level.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.hdl.log.enums; - -/** - * Created by hxb on 2023/3/14. - * 鎶ヨ绛夌骇瀹氫箟 - */ -public enum Level { - high("high", "楂�"), - middle("middle", "涓�"), - low("low", "浣�"); - - private String code; - private String msg; - - Level(String code, String msg) { - this.msg = msg; - this.code = code; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getMsg() { - return msg; - } - - public void setMsg(String msg) { - this.msg = msg; - } -} \ No newline at end of file diff --git a/HDLLog/src/main/java/com/hdl/log/utils/LogUtil.java b/HDLLog/src/main/java/com/hdl/log/utils/LogUtil.java deleted file mode 100644 index f526754..0000000 --- a/HDLLog/src/main/java/com/hdl/log/utils/LogUtil.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.hdl.log.utils; - -import android.text.TextUtils; - -import com.aliyu.LogProducerClient; -import com.aliyun.sls.android.producer.Log; -import com.hdl.log.HDLLog; -import com.hdl.log.bean.LogBean; -import com.hdl.log.enums.Level; - -import java.util.Map; - - -/** - * Created by hxb on 2023/3/14. - * 寮傚父鏃ュ織澶勭悊宸ュ叿绫� - */ -public class LogUtil { - - private static final String LEVEL_PARAM = "level"; - private static LogProducerClient exceptionProducerClient; - - private static LogBean logBean; - - private static synchronized LogProducerClient getExceptionProducerClient() { - if (exceptionProducerClient == null) { - exceptionProducerClient = new LogProducerClient(HDLLog.getContext(), HDLLog.getEndPoint(), HDLLog.getProjectName(), HDLLog.getExceptionLog(), HDLLog.getAccessId(), HDLLog.getAccessKey(), null, null); - exceptionProducerClient.initProducer(); - } - return exceptionProducerClient; - } - - /** - * 寮傚父鏃ュ織 - * - * @param title 鏍囬 - * @param content 闄勫姞鏁版嵁鍐呭 - * @param otherMsg 鍏朵粬闄勫姞鏁版嵁锛屾病鏈夊彲涓虹┖ - * @param level 鎶ヨ绛夌骇 - */ - public static void log(String title, String content, Map<String, String> otherMsg, Level level) { - log(title,content,otherMsg,level,null); - } - /** - * 寮傚父鏃ュ織 - * - * @param title 鏍囬 - * @param content 闄勫姞鏁版嵁鍐呭 - * @param otherMsg 鍏朵粬闄勫姞鏁版嵁锛屾病鏈夊彲涓虹┖ - * @param level 鎶ヨ绛夌骇 - * @param type 寮傚父绫诲瀷 - */ - public static void log(String title, String content, Map<String, String> otherMsg, Level level,String type) { - log(title,content,otherMsg,level,null,null); - } - /** - * 寮傚父鏃ュ織 - * - * @param title 鏍囬 - * @param content 闄勫姞鏁版嵁鍐呭 - * @param otherMsg 鍏朵粬闄勫姞鏁版嵁锛屾病鏈夊彲涓虹┖ - * @param level 鎶ヨ绛夌骇 - * @param type 寮傚父绫诲瀷 - * @param exceptionBlock 寮傚父浠g爜鍧� - */ - public static void log(String title, String content, Map<String, String> otherMsg, Level level,String type, String exceptionBlock) { - /** - * 娌℃湁homeId鍜寀serId 涓嶅厑璁镐笂浼� 鍙笂浼犱綇瀹呴噷闈㈢殑寮傚父 鍑忓皯浜戠鍘嬪姏 - * 1.鐐瑰嚮椤圭洰鐨勬椂鍊欒缃� - * 2.鍏抽棴浣忓畢椤甸潰鐨勬椂鍊欏幓鎺� - */ - if (TextUtils.isEmpty(getLogBean().getUserId()) || TextUtils.isEmpty(getLogBean().getHomeId())) { - return; - } - Log log = new Log(); - log.putContent("title", title); - log.putContent("content", content); - log.putContent(LEVEL_PARAM, level.getCode()); - log.putContent("userId", getLogBean().getUserId()); - log.putContent("homeId", getLogBean().getHomeId()); - log.putContent("time", System.currentTimeMillis() + ""); - log.putContent("userAgent", getLogBean().getUserAgent()); - log.putContent("appVersion", getLogBean().getAppVersion()); - log.putContent("type",type); - log.putContent("exceptionBlock",exceptionBlock); - if (otherMsg != null) { - log.putContents(otherMsg); - } - getExceptionProducerClient().sendLog(log); - } - - public static LogBean getLogBean() { - if (null == logBean) { - logBean = new LogBean(); - } - return logBean; - } -} \ No newline at end of file diff --git a/HDLLog/src/main/java/com/hdl/log/utils/PointUtil.java b/HDLLog/src/main/java/com/hdl/log/utils/PointUtil.java deleted file mode 100644 index 18acad0..0000000 --- a/HDLLog/src/main/java/com/hdl/log/utils/PointUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.hdl.log.utils; - -import com.aliyu.LogProducerClient; -import com.aliyun.sls.android.producer.Log; -import com.hdl.log.HDLLog; -import com.hdl.log.bean.LogBean; - -import java.util.Map; - -/** - * Created by hxb on 2023/3/16. - * - */ -public class PointUtil { - private static LogProducerClient pointProducerClient; - private static LogBean logBean; - - private static synchronized LogProducerClient getExceptionProducerClient() { - if (pointProducerClient == null) { - pointProducerClient = new LogProducerClient(HDLLog.getContext(),HDLLog.getEndPoint(),HDLLog.getProjectName(),HDLLog.getEventTracking(),HDLLog.getAccessId(),HDLLog.getAccessKey(),null,null); - } - return pointProducerClient; - } - /** - * 鏁版嵁鍩嬬偣 - * @param eventId 鏍囬 - * @param eventMap 闄勫姞鏁版嵁鍐呭 - * @param otherMsg 鍏朵粬闄勫姞鏁版嵁锛屾病鏈夊彲涓虹┖ - */ - public static void point(String eventId,String eventMap,Map<String, String> otherMsg) { - Log log = new Log(); - log.putContent("eventId", eventId); - log.putContent("eventMap", eventMap); - log.putContent("userId", getLogBean().getUserId()); - log.putContent("homeId", getLogBean().getHomeId()); - log.putContent("time", System.currentTimeMillis() + ""); - log.putContent("userAgent", getLogBean().getUserAgent()); - log.putContent("appVersion", getLogBean().getAppVersion()); - if (otherMsg != null) { - log.putContents(otherMsg); - } - getExceptionProducerClient().sendLog(log); - } - - public static LogBean getLogBean() { - if(logBean==null){ - logBean=new LogBean(); - } - return logBean; - } -} diff --git a/app/build.gradle b/app/build.gradle index 66199e4..755e98e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -123,7 +123,6 @@ //浜岀淮鐮佸簱 implementation project(path: ':third-zxing') //Link鏈湴搴� -// implementation project(path: ':HDLLinkPMSdk') implementation 'com.hdl.android:pmsdk:1.0.1' implementation 'com.hdl.android:debugsdk:1.0.1' diff --git a/local.properties b/local.properties index e8d918b..7e45c0e 100644 --- a/local.properties +++ b/local.properties @@ -4,6 +4,5 @@ # Location of the SDK. This is only used by Gradle. # For customization when using a Version Control System, please read the # header note. -#Thu Dec 14 10:02:46 CST 2023 -#sdk.dir=/Users/user/Library/Android/sdk -sdk.dir=/Users/hdl/Library/Developer/Xamarin/android-sdk-macosx +#Fri Feb 23 16:45:51 CST 2024 +sdk.dir=/Users/user/Library/Android/sdk diff --git a/settings.gradle b/settings.gradle index eba0b6c..f8afe62 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,4 @@ rootProject.name = "PhotovoltaicDebug" include ':app' include ':third-zxing' -//include ':HDLLinkLocalSdk' -//include ':HDLLinkPMSdk' -//include ':HDLLog' include ':countrypicker' -- Gitblit v1.8.0