AndroidOpenDemo/.idea/workspace.xml
@@ -15,14 +15,14 @@ </component> <component name="ChangeListManager"> <list default="true" id="7bacc5cf-316f-4ad4-b191-7f5297eb7bcf" name="Default Changelist" comment=""> <change beforePath="$PROJECT_DIR$/.idea/gradle.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/gradle.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/build.gradle" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpClient.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/HttpSend.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/AndroidManifest.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/DeviceDetailMainFragment.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/DeviceDetailMainFragment.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/lechange/demo/ui/EnvGuideActivity.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/AndroidManifest.xml" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/AndroidManifest.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/LCDeviceEngine.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/LCDeviceEngine.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/mobilecommon/base/BaseFragmentActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/mobilecommon/base/BaseFragmentActivity.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/model/DeviceAddModel.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/model/DeviceAddModel.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/DeviceAddOpenApiManager.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/DeviceAddOpenApiManager.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/data/BindDeviceData.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/openapi/data/BindDeviceData.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/service/DeviceAddService.java" beforeDir="false" afterPath="$PROJECT_DIR$/DeviceAddModule/src/main/java/com/mm/android/deviceaddmodule/service/DeviceAddService.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/src/main/java/com/utils/HdlToLcUtils.java" beforeDir="false" afterPath="$PROJECT_DIR$/app/src/main/java/com/utils/HdlToLcUtils.java" afterDir="false" /> </list> <option name="SHOW_DIALOG" value="false" /> @@ -30,6 +30,7 @@ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="LAST_RESOLUTION" value="IGNORE" /> </component> <component name="ExecutionTargetManager" SELECTED_TARGET="device_and_snapshot_combo_box_target[364c4b3158493098]" /> <component name="ExternalProjectsData"> <projectState path="$PROJECT_DIR$"> <ProjectState /> @@ -114,7 +115,7 @@ <property name="cidr.known.project.marker" value="true" /> <property name="dart.analysis.tool.window.visible" value="false" /> <property name="last_opened_file_path" value="$PROJECT_DIR$/app/src/main/res/layout" /> <property name="memory.settings.postsync.last.time.stamp" value="1670328675383" /> <property name="memory.settings.postsync.last.time.stamp" value="1676946748415" /> <property name="project.structure.last.edited" value="Dependencies" /> <property name="project.structure.proportion" value="0.17" /> <property name="project.structure.side.proportion" value="0.2" /> @@ -139,7 +140,7 @@ <recent name="com" /> </key> </component> <component name="RunManager" selected="Gradle.AndroidOpenDemo:DeviceAddModule [assembleRelease]"> <component name="RunManager" selected="Android App.app"> <configuration default="true" type="AndroidJUnit" factoryName="Android JUnit"> <option name="TEST_OBJECT" value="class" /> <option name="WORKING_DIRECTORY" value="$MODULE_DIR$" /> 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; }