AndroidOpenDemo/DeviceAddModule/src/main/AndroidManifest.xml
@@ -25,7 +25,7 @@ <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <!--允许应用程序访问额外的位置提供命令,登陆、设备添加等???--> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <!--允许程序改变网络状态,如是否联网,配网???--> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!--允许应用程序请求安装包。针对API大于22必须持有该许可使用ACTION_INSTALL_PACKAGE应用。应该没在用???--> <!-- <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!–允许应用程序请求安装包。针对API大于22必须持有该许可使用ACTION_INSTALL_PACKAGE应用。应该没在用???–>--> <uses-permission android:name="android.permission.VIBRATE" /> <application android:allowBackup="false" AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/LCDeviceEngine.java
@@ -1,6 +1,7 @@ package com.mm.android.deviceaddmodule; import android.app.Activity; import android.app.Application; import android.content.Context; import android.content.Intent; import android.os.Bundle; @@ -40,6 +41,16 @@ public CommonParam commonParam; public String userId = ""; private String homeId; private String productBrandldentity; private Application context; public Application getContext() { return context; } public void setContext(Application context) { this.context = context; } public static LCDeviceEngine newInstance() { if (lcDeviceEngine == null) { @@ -57,6 +68,7 @@ this.accessToken = "St_0000c3e2e772d5f74bfca2d86eaa18a6";//为了低层空判断,当前token无效 this.userId = ""; this.sdkHasInit = false; this.context = commonParam.getContext(); if (commonParam == null) { throw new Exception("commonParam must not null"); } @@ -156,4 +168,10 @@ public void setHomeId(String homeId) { this.homeId = homeId; } public String getProductBrandldentity() { return productBrandldentity == null ? "" : productBrandldentity;} public void setProductBrandldentity(String productBrandldentity){ this.productBrandldentity = productBrandldentity; } } AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/mobilecommon/base/BaseFragmentActivity.java
@@ -140,6 +140,7 @@ private void registerBroadCast() { IntentFilter mIntentFilter = createBroadCast(); mIntentFilter.addAction("xxxx"); if (mIntentFilter != null && mIntentFilter.countActions() > 0) { broadcastReceiver = new BaseBroadcast(); registerReceiver(broadcastReceiver, mIntentFilter); AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/model/DeviceAddModel.java
@@ -26,6 +26,7 @@ import com.lechange.opensdk.device.LCOpenSDK_DeviceInit; import com.lechange.opensdk.media.DeviceInitInfo; import com.lechange.opensdk.searchwifi.WlanInfo; import com.mm.android.deviceaddmodule.LCDeviceEngine; import com.mm.android.deviceaddmodule.helper.DeviceAddHelper; import com.mm.android.deviceaddmodule.mobilecommon.AppConsume.BusinessException; import com.mm.android.deviceaddmodule.mobilecommon.AppConsume.BusinessRunnable; @@ -327,7 +328,8 @@ new BusinessRunnable(handler) { @Override public void doBusiness() throws BusinessException { DeviceBindResult deviceBindResult = deviceAddService.hdlUserDeviceBind( sn, devPwd, DMS_TIMEOUT); DeviceBindResult deviceBindResult = deviceAddService.hdlUserDeviceBind( sn, devPwd, LCDeviceEngine.newInstance().getProductBrandldentity()); mDeviceAddInfo.setDeviceDefaultName(deviceBindResult.getDeviceName()); mDeviceAddInfo.setBindStatus(deviceBindResult.getBindStatus()); mDeviceAddInfo.setBindAcount(deviceBindResult.getUserAccount()); AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/DeviceAddOpenApiManager.java
@@ -1,13 +1,20 @@ package com.mm.android.deviceaddmodule.openapi; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.reflect.TypeToken; import com.mm.android.deviceaddmodule.LCDeviceEngine; import com.mm.android.deviceaddmodule.SeachDeviceService; import com.mm.android.deviceaddmodule.device_wifi.CurWifiInfo; import com.mm.android.deviceaddmodule.device_wifi.WifiConfig; import com.mm.android.deviceaddmodule.mobilecommon.AppConsume.BusinessException; import com.mm.android.deviceaddmodule.mobilecommon.common.LCConfiguration; import com.mm.android.deviceaddmodule.openapi.data.AddDevicePolicyData; import com.mm.android.deviceaddmodule.openapi.data.BindDeviceData; import com.mm.android.deviceaddmodule.openapi.data.DeviceDetailListData; @@ -126,10 +133,16 @@ paramsMap.put("extDevId", bindDeviceData.data.deviceId); paramsMap.put("spk","security.ipcam.imou"); paramsMap.put("sid","8D00708PAGA01ED"); paramsMap.put("productBrandldentity",bindDeviceData.data.productBrandldentity); paramsMap.put("code", bindDeviceData.data.code); JsonObject json = HttpSend.execute(paramsMap, CONST.METHOD_BINDDEVICE,DMS_TIME_OUT); BindDeviceData.Response response = new BindDeviceData.Response(); response.parseData(json); Intent intent = new Intent(); intent.setAction("hdlUserDeviceBind"); intent.putExtra("data",response.data.toString()); return response; } AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/data/BindDeviceData.java
@@ -35,6 +35,7 @@ public String code; public String token; public String deviceId; public String productBrandldentity; @Override public String toString() { @@ -42,6 +43,7 @@ "code='" + code + '\'' + ", token='" + token + '\'' + ", deviceId='" + deviceId + '\'' + ", productBrandldentity='" + productBrandldentity + '\'' + '}'; } } AndroidOpenDemo/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/service/DeviceAddService.java
@@ -127,15 +127,17 @@ return deviceBindResult; } public DeviceBindResult hdlUserDeviceBind(String deviceId, String code, int timeout) throws BusinessException { public DeviceBindResult hdlUserDeviceBind(String deviceId, String code,String productBrandldentity) throws BusinessException { BindDeviceData req=new BindDeviceData(); req.data.deviceId = deviceId; req.data.code = code; req.data.productBrandldentity =productBrandldentity; BindDeviceData.Response response = DeviceAddOpenApiManager.hdlUserDeviceBind(req); DeviceBindResult deviceBindResult = new DeviceBindResult(); deviceBindResult.setBindStatus(response.data.bindStatus); deviceBindResult.setDeviceName(response.data.deviceName); deviceBindResult.setUserAccount(response.data.userAccount); LCDeviceEngine.newInstance().getContext().registerReceiver() return deviceBindResult; } AndroidOpenDemo/app/src/main/java/com/utils/HdlToLcUtils.java
@@ -31,6 +31,7 @@ private String token; private String subAccessToken; private IAddCamera iAddCamera; private String productBrandldentity; public Activity getActivity() { return activity; @@ -142,6 +143,14 @@ LCDeviceEngine.newInstance().setHomeId(homeId); } public String getProductBrandldentity() { return productBrandldentity;} public void setProductBrandldentity(String productBrandldentity){ this.productBrandldentity = productBrandldentity; LCDeviceEngine.newInstance().setProductBrandldentity(productBrandldentity); } public String getToken() { return token; }