| | |
| | | // compileOnly fileTree(include: ['eventbus:3.0.0.jar'], dir: 'libs')
|
| | | api fileTree(include: ['eventbus-3.0.0.jar'], dir: 'libs')
|
| | |
|
| | | compileOnly fileTree(include: ['lechangeSDK.jar'], dir: 'libs')
|
| | | // api fileTree(include: ['lechangeSDK.jar'], dir: 'libs')
|
| | | // compileOnly fileTree(include: ['lechangeSDK.jar'], dir: 'libs')//库用这个
|
| | | api fileTree(include: ['lechangeSDK.jar'], dir: 'libs')//程序用这个
|
| | |
|
| | | // compile project(':LcOpenSDk')
|
| | |
|
| | |
| | | import com.mm.android.deviceaddmodule.views.popwindow.PopWindowFactory;
|
| | |
|
| | | import org.greenrobot.eventbus.EventBus;
|
| | | import org.greenrobot.eventbus.Subscribe;
|
| | | import org.greenrobot.eventbus.ThreadMode;
|
| | |
|
| | | import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
|
| | | import static com.mm.android.deviceaddmodule.mobilecommon.common.Constants.PERMISSION_REQUEST_ID;
|
| | |
| | | };
|
| | | permissionHelper.requestPermissions(new String[]{
|
| | | ACCESS_COARSE_LOCATION}, defaultPermissionListener);
|
| | |
|
| | | if(!EventBus.getDefault().isRegistered(this)){
|
| | | EventBus.getDefault().register(this);
|
| | | }
|
| | | }
|
| | |
|
| | | //动态权限申请回调
|
| | |
| | | }
|
| | | mLoadingPopWindow = null;
|
| | | }
|
| | | EventBus.getDefault().post("backXamarin");
|
| | | if(!interfaceException) {
|
| | | EventBus.getDefault().post("backXamarin");
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 接口异常标记
|
| | | */
|
| | | private boolean interfaceException = false;
|
| | |
|
| | | @Subscribe(threadMode = ThreadMode.MAIN)
|
| | | public void onGetMessage(String obj) {
|
| | | if(obj.equals("InterfaceException")){
|
| | | if (EventBus.getDefault().isRegistered(this)) {
|
| | | EventBus.getDefault().unregister(this);
|
| | | }
|
| | | interfaceException = true;
|
| | | destroy();
|
| | | }
|
| | | }
|
| | |
|
| | | // 离线配网成功,返回上一级页面
|
New file |
| | |
| | | package hdl.onpro; |
| | | |
| | | import android.app.Activity; |
| | | |
| | | import hdl.onpro.IRegisterDeviceFeedback; |
| | | import com.mm.android.deviceaddmodule.LCDeviceEngine; |
| | | |
| | | public class HdlData { |
| | | |
| | | |
| | | private hdl.onpro.IRegisterDeviceFeedback iRegisterDeviceFeedback; |
| | | public hdl.onpro.IRegisterDeviceFeedback getiRegisterDeviceFeedback(){ |
| | | if(iRegisterDeviceFeedback == null){ |
| | | iRegisterDeviceFeedback = new hdl.onpro.IRegisterDeviceFeedback() { |
| | | @Override |
| | | public void feedback(String method, String data) { |
| | | |
| | | } |
| | | }; |
| | | } |
| | | return iRegisterDeviceFeedback; |
| | | } |
| | | |
| | | public void setiRegisterDeviceFeedback(hdl.onpro.IRegisterDeviceFeedback feedback){ |
| | | iRegisterDeviceFeedback = feedback; |
| | | } |
| | | |
| | | private String productBrandldentity; |
| | | |
| | | /** |
| | | * instance |
| | | */ |
| | | private volatile static HdlData instance; |
| | | |
| | | /** |
| | | * getInstance |
| | | * |
| | | * @return HDLLink |
| | | */ |
| | | public static synchronized HdlData getInstance() { |
| | | if (instance == null) { |
| | | synchronized (HdlData.class) { |
| | | if (instance == null) { |
| | | instance = new HdlData(); |
| | | } |
| | | } |
| | | } |
| | | return instance; |
| | | } |
| | | |
| | | |
| | | public void initData(hdl.onpro.IRegisterDeviceFeedback iRegisterDeviceFeedback, String productBrandldentity){ |
| | | LCDeviceEngine.newInstance().setProductBrandldentity(productBrandldentity); |
| | | this.iRegisterDeviceFeedback = iRegisterDeviceFeedback; |
| | | } |
| | | } |
New file |
| | |
| | | package hdl.onpro; |
| | | |
| | | public interface IRegisterDeviceFeedback { |
| | | void feedback(String method, String data); |
| | | |
| | | } |
| | |
| | | public CommonParam commonParam;
|
| | | public String userId = "";
|
| | | private String homeId;
|
| | | private String productBrandldentity;
|
| | |
|
| | | private Application context;
|
| | | public Application getContext() {
|
| | |
| | | this.homeId = homeId;
|
| | | }
|
| | |
|
| | | private String productBrandldentity;
|
| | | public String getProductBrandldentity() { return productBrandldentity == null ? "" : productBrandldentity;}
|
| | |
|
| | | public void setProductBrandldentity(String productBrandldentity){
|
| | |
| | | import com.lechange.opensdk.device.LCOpenSDK_DeviceInit;
|
| | | import com.lechange.opensdk.media.DeviceInitInfo;
|
| | | import com.lechange.opensdk.searchwifi.WlanInfo;
|
| | | import hdl.onpro.HdlData;
|
| | | import com.mm.android.deviceaddmodule.LCDeviceEngine;
|
| | | import com.mm.android.deviceaddmodule.helper.DeviceAddHelper;
|
| | | import com.mm.android.deviceaddmodule.mobilecommon.AppConsume.BusinessException;
|
| | |
| | | @Override
|
| | | public void doBusiness() throws BusinessException {
|
| | |
|
| | | DeviceBindResult deviceBindResult = deviceAddService.hdlUserDeviceBind( sn, devPwd, LCDeviceEngine.newInstance().getProductBrandldentity());
|
| | | DeviceBindResult deviceBindResult = deviceAddService.hdlUserDeviceBind( sn, devPwd,
|
| | | LCDeviceEngine.newInstance().getProductBrandldentity());
|
| | | mDeviceAddInfo.setDeviceDefaultName(deviceBindResult.getDeviceName());
|
| | | mDeviceAddInfo.setBindStatus(deviceBindResult.getBindStatus());
|
| | | mDeviceAddInfo.setBindAcount(deviceBindResult.getUserAccount());
|
| | |
| | | paramsMap.put("extDevId", bindDeviceData.data.deviceId);
|
| | | paramsMap.put("spk","security.ipcam.imou");
|
| | | paramsMap.put("sid","8D00708PAGA01ED");
|
| | | paramsMap.put("productBrandldentity",bindDeviceData.data.productBrandldentity);
|
| | | paramsMap.put("productBrandIdentity",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();
|
| | |
| | | import com.google.gson.JsonObject;
|
| | | import com.google.gson.JsonParser;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import hdl.onpro.HdlData;
|
| | | import com.mm.android.deviceaddmodule.LCDeviceEngine;
|
| | | import com.mm.android.deviceaddmodule.mobilecommon.AppConsume.BusinessException;
|
| | | import com.mm.android.deviceaddmodule.mobilecommon.utils.LogUtil;
|
| | | import com.mm.android.deviceaddmodule.mobilecommon.utils.MD5Helper;
|
| | |
|
| | | import org.apache.http.conn.ConnectTimeoutException;
|
| | | import org.greenrobot.eventbus.EventBus;
|
| | | import org.json.JSONObject;
|
| | |
|
| | | import java.io.IOException;
|
| | |
| | | if (!"0".equals(code)) {
|
| | | try {
|
| | | String msg = jsonResult.get("msg").getAsString();
|
| | | if (method.equals("bindDevice")) {
|
| | | Intent intent = new Intent();
|
| | | intent.setAction("hdlUserDeviceBind");
|
| | | intent.putExtra("data", jsonResult.toString());
|
| | | LCDeviceEngine.newInstance().getContext().sendBroadcast(intent);
|
| | | }
|
| | | EventBus.getDefault().post("InterfaceException");
|
| | | hdl.onpro.HdlData.getInstance().getiRegisterDeviceFeedback().feedback(method,jsonResult.toString());
|
| | | throw new BusinessException(code + msg);
|
| | | }catch (Exception exception){
|
| | | String msg = jsonResult.get("message").getAsString();
|
| | | if (method.equals("bindDevice")) {
|
| | | Intent intent = new Intent();
|
| | | intent.setAction("hdlUserDeviceBind");
|
| | | intent.putExtra("data", jsonResult.toString());
|
| | | LCDeviceEngine.newInstance().getContext().sendBroadcast(intent);
|
| | | }
|
| | | EventBus.getDefault().post("InterfaceException");
|
| | | hdl.onpro.HdlData.getInstance().getiRegisterDeviceFeedback().feedback(method,jsonResult.toString());
|
| | | throw new BusinessException(code + msg);
|
| | | }
|
| | | }
|
| | |
| | | public String code;
|
| | | public String token;
|
| | | public String deviceId;
|
| | | public String productBrandldentity;
|
| | | public String productBrandldentity ;
|
| | |
|
| | | @Override
|
| | | public String toString() {
|
| | |
| | | public void onClick(View v) { |
| | | int id = v.getId(); |
| | | if (id == R.id.tv_title_cn) { |
| | | // HdlToLc.initData( this,true,""); |
| | | } else if (id == R.id.tv_overseas) { |
| | | HdlToLcUtils.getInstance().initData(this, "HDL-HOME-APP-TEST", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", "https://test-gz.hdlcontrol.com"); |
| | | HdlToLcUtils.getInstance().setHomeId("1633667926249299969"); |
| | | HdlToLcUtils.getInstance().setToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI1NGQwODRhOTljZWY0YTlhYTU2YTE0ZDFiOTU2OGRkYyIsImNvbXBhbnlJZCI6IjAiLCJyb2xlIjoiIiwiaGVhZGVyUHJlZml4IjoiQmVhcmVyICIsInRlbmFudElkIjoiMjAiLCJ1c2VyVHlwZSI6IlVTRVJfQyIsInRva2VuVHlwZSI6ImFjY2Vzc190b2tlbiIsInVzZXJOYW1lIjoic3hjXzAwNCIsInVzZXJEYXRhUmlnaHQiOiIxIiwib3BlbkFwcGxpY2F0aW9uSWQiOiIwIiwidXNlcklkIjoiMTU3NTA1OTM5MDAzMjYyNTY2NiIsImV4cCI6MTY3ODkzNjcwMywibmJmIjoxNjc4OTI5NTAzfQ.DT2ZaZrBy8aPW-EHSjzo_gbqWIQu38p6Qsi6fqzEwUv9anfTxPD7KkvvDErtm9VhTP7S2j-Os5LRjwDstQc-em8Jiqe4wGYTJ3GVHCrVLKIqTAnVIMOSJMLFB0ohUSsoN81lSVjoW9hmwR_w7B2UGOVHOL6Hr9xB_7jZuh8W7RQ"); |
| | | HdlToLcUtils.getInstance().setSubAccessToken("St_0000sgf1760a76afb2431dadb9cc60e3"); |
| | | } |
| | | |
| | | |
| | | |
| | | HdlToLcUtils.getInstance().initData(this, "HDL-HOME-APP-TEST", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", "https://test-gz.hdlcontrol.com"); |
| | | HdlToLcUtils.getInstance().setHomeId("1547099040465408002"); |
| | | HdlToLcUtils.getInstance().setToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJhMGRiYmFjZDk4NzM0YmUyYWFhNDAwNjEzNzk5NTk0NSIsImNvbXBhbnlJZCI6IjAiLCJyb2xlIjoiIiwiaGVhZGVyUHJlZml4IjoiQmVhcmVyICIsInVzZXJBY2NvdW50Ijoid3hyIiwidGVuYW50SWQiOiIyMCIsInVzZXJUeXBlIjoiVVNFUl9DIiwidG9rZW5UeXBlIjoiYWNjZXNzX3Rva2VuIiwidXNlck5hbWUiOiJ3eHIiLCJ1c2VyRGF0YVJpZ2h0IjoiMSIsIm9wZW5BcHBsaWNhdGlvbklkIjoiMCIsInVzZXJJZCI6IjEzOTIwMzU1NjgyMDQ0MjMxNjkiLCJleHAiOjE2NzY5Njg0NTQsIm5iZiI6MTY3Njk2MTI1NH0.clsu2lKT8v3YPYrR7xtOwo21iCi9c__m_GCkIURNfXOid-ATAkvTjQvMveQyC-Q9f7qkH9O5TxUi0zPpTwqiFDxkO2_Xpcsuly310uhb3xBGpgp96_AKbyI69G9Q2lfj2EYBExcVwz54Sf2kgpX4kIXJINFULM4xYb7haNalRVw"); |
| | | HdlToLcUtils.getInstance().setSubAccessToken("St_0000sg1cd05955ed7043b58f35d5456e"); |
| | | |
| | | |
| | | // HdlToLcUtils.getInstance().openActivity(); |
| | | HdlToLcUtils.getInstance().addCamera(new IAddCamera() { |
| | | @Override |
| | | public void back() { |
| | | } |
| | | }); |
| | | HdlToLcUtils.getInstance().openActivity(); |
| | | // HdlToLcUtils.getInstance().addCamera(new IAddCamera() { |
| | | // @Override |
| | | // public void back() { |
| | | // } |
| | | // }); |
| | | // HdlToLcUtils.getInstance().play("8F05F83AAG05B3A","xxxx"); |
| | | } |
| | | |
| | |
| | | private String token; |
| | | private String subAccessToken; |
| | | private IAddCamera iAddCamera; |
| | | private String productBrandldentity; |
| | | |
| | | public Activity getActivity() { |
| | | return activity; |
| | |
| | | } |
| | | public void openActivity() { |
| | | try { |
| | | // getSubAccountToken("827a98c98da7469b8bc19bb6a3c7651906"); |
| | | activity.startActivity(new Intent(activity, com.lechange.demo.ui.DeviceListActivity.class)); |
| | | } catch (Throwable e) { |
| | | Toast.makeText(activity, e.getMessage(), Toast.LENGTH_SHORT).show(); |
| | |
| | | public void setHomeId(String homeId) { |
| | | this.homeId = homeId; |
| | | LCDeviceEngine.newInstance().setHomeId(homeId); |
| | | } |
| | | |
| | | public String getProductBrandldentity() { return productBrandldentity;} |
| | | |
| | | public void setProductBrandldentity(String productBrandldentity){ |
| | | this.productBrandldentity = productBrandldentity; |
| | | LCDeviceEngine.newInstance().setProductBrandldentity(productBrandldentity); |
| | | |
| | | } |
| | | |
| | | public String getToken() { |
| | |
| | | </LinearLayout>
|
| | |
|
| | | </LinearLayout>
|
| | |
|
| | |
|
| | | <com.lechange.demo.view.LcCloudRudderView
|
| | | android:visibility="gone"
|
| | | android:layout_gravity="center"
|
| | | android:id="@+id/rudder"
|
| | | android:layout_width="250dp"
|
| | | android:layout_height="250dp"
|
| | | android:clickable="true" />
|
| | |
|
| | | </FrameLayout>
|
| | |
|
| | | <LinearLayout
|
| | |
| | | </FrameLayout>
|
| | | </LinearLayout>
|
| | |
|
| | | <com.lechange.demo.view.LcCloudRudderView
|
| | | android:visibility="gone"
|
| | | android:layout_gravity="center"
|
| | | android:id="@+id/rudder"
|
| | | android:layout_width="250dp"
|
| | | android:layout_height="250dp"
|
| | | android:clickable="true" />
|
| | | </FrameLayout>
|
| | |
|
| | | </RelativeLayout> |