| | |
| | | <key>CFBundleIdentifier</key> |
| | | <string>com.hdl.crabtreenew</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>2.701111</string> |
| | | <string>2.800526</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>2.701111</string> |
| | | <string>2.800526</string> |
| | | <key>LSRequiresIPhoneOS</key> |
| | | <true/> |
| | | <key>MinimumOSVersion</key> |
| | |
| | | <DefineConstants>__IOS__;__MOBILE__;__UNIFIED__;HDL;HDLVideo;</DefineConstants> |
| | | <ErrorReport>prompt</ErrorReport> |
| | | <WarningLevel>4</WarningLevel> |
| | | <CodesignKey>iPhone Distribution: Havells India Limited (6FQDUKMB48)</CodesignKey> |
| | | <CodesignKey>Apple Distribution: Havells India Limited (6FQDUKMB48)</CodesignKey> |
| | | <MtouchFloat32>true</MtouchFloat32> |
| | | <MtouchLink>SdkOnly</MtouchLink> |
| | | <MtouchArch>ARM64</MtouchArch> |
New file |
| | |
| | | using System; |
| | | using Android.Content; |
| | | using Com.Aliyun.Sls.Android.Producer; |
| | | using Java.IO; |
| | | |
| | | namespace HDL_ON_Android.Aliyu |
| | | { |
| | | public class AliyuLogProducerClient : Java.Lang.Object, ILogProducerCallback |
| | | { |
| | | private static string TAG = "ProducerClient"; |
| | | 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 AliyuLogProducerClient(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:// 开头的链接 |
| | | string endpoint = this.endpoint; |
| | | string project = this.logProject; |
| | | string logstore = this.logStore; |
| | | string accessKeyId = this.accessKeyId; |
| | | string accessKeySecret = this.accessKeySecret; |
| | | 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.FilesDir + 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); |
| | | |
| | | client = new LogProducerClient(config, this); |
| | | } |
| | | catch (LogProducerException e) |
| | | { |
| | | |
| | | } |
| | | |
| | | } |
| | | public void sendLog(Log log) |
| | | { |
| | | LogProducerResult result = client.AddLog(log); |
| | | } |
| | | //callback为可选配置, 如果不需要关注日志的发送成功或失败状态, 可以不注册 callback |
| | | public void OnCall(int resultCode, string reqId, string errorMessage, int logBytes, int compressedBytes) |
| | | { |
| | | // // resultCode: 状态码, 详见 LogProducerResult |
| | | // // reqId: 请求Id, 已经废弃 |
| | | // // errorMessage: 失败信息 |
| | | // // logBytes: 日志原始字节数 |
| | | // // compressedBytes: 日志压缩字节数 |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using Android.Content; |
| | | using Com.Aliyun.Sls.Android.Producer; |
| | | |
| | | namespace HDL_ON_Android.Aliyu |
| | | { |
| | | public class AliyuLogUtil |
| | | { |
| | | private static AliyuLogProducerClient exceptionProducerClient; |
| | | private static LogBean logBean; |
| | | |
| | | private static Object lockObj = new object (); |
| | | |
| | | private static AliyuLogProducerClient getExceptionProducerClient() |
| | | { |
| | | lock (lockObj) |
| | | { |
| | | if (exceptionProducerClient == null) |
| | | { |
| | | if (Shared.Application.Activity == null) { |
| | | return null; |
| | | } |
| | | exceptionProducerClient = new AliyuLogProducerClient(Shared.Application.Activity, "https://cn-hangzhou.log.aliyuncs.com", "hdl-crabtree-log", "log","LTAI5tLzDxrtsFyi3xtK3YWt", "eX31JZrRAvC2wZWPiZU0SYhlfAUMoT", null, null); |
| | | exceptionProducerClient.initProducer(); |
| | | } |
| | | return exceptionProducerClient; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 异常日志 |
| | | * |
| | | * @param title 标题 |
| | | * @param content 附加数据内容 |
| | | * @param level 报警等级 |
| | | */ |
| | | public static void log(string title, string content, Level level) |
| | | { |
| | | log(title, content, level, null); |
| | | } |
| | | /** |
| | | * 异常日志 |
| | | * |
| | | * @param title 标题 |
| | | * @param content 附加数据内容 |
| | | * @param otherMsg 其他附加数据,没有可为空 |
| | | * @param level 报警等级 |
| | | * @param type 异常类型 |
| | | */ |
| | | public static void log(string title, string content, Level level, string type) |
| | | { |
| | | log(title, content, level, null, null); |
| | | } |
| | | /** |
| | | * 异常日志 |
| | | * |
| | | * @param title 标题 |
| | | * @param content 附加数据内容 |
| | | * @param otherMsg 其他附加数据,没有可为空 |
| | | * @param level 报警等级 |
| | | * @param type 异常类型 |
| | | * @param exceptionBlock 异常代码块 |
| | | */ |
| | | public static void log(string title, string content, Level level, string type, string exceptionBlock) |
| | | { |
| | | /** |
| | | * 没有homeId和userId 不允许上传 只上传住宅里面的异常 减少云端压力 |
| | | * 1.点击项目的时候设置 |
| | | * 2.关闭住宅页面的时候去掉 |
| | | */ |
| | | if (string.IsNullOrEmpty(getLogBean.getUserId()) || string.IsNullOrEmpty(getLogBean.getHomeId())) |
| | | { |
| | | return; |
| | | } |
| | | Log log = new Log(); |
| | | log.PutContent("title", title); |
| | | log.PutContent("content", content); |
| | | log.PutContent("level", level.ToString()); |
| | | log.PutContent("userId", getLogBean.getUserId()); |
| | | log.PutContent("homeId", getLogBean.getHomeId()); |
| | | log.PutContent("time", System.DateTime.UtcNow + ""); |
| | | log.PutContent("userAgent", getLogBean.getUserAgent()); |
| | | log.PutContent("appVersion", getLogBean.getAppVersion()); |
| | | log.PutContent("type", type); |
| | | log.PutContent("exceptionBlock", exceptionBlock); |
| | | |
| | | var producerClient = getExceptionProducerClient(); |
| | | if (producerClient == null) |
| | | { |
| | | return; |
| | | } |
| | | producerClient.sendLog(log); |
| | | |
| | | } |
| | | |
| | | public static LogBean getLogBean |
| | | { |
| | | get { |
| | | if (logBean == null) { |
| | | logBean = new LogBean(); |
| | | } |
| | | return logBean; |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | namespace HDL_ON_Android.Aliyu |
| | | { |
| | | public enum Level |
| | | { |
| | | high,//高 |
| | | middle,//中 |
| | | low//低 |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | namespace HDL_ON_Android.Aliyu |
| | | { |
| | | public class LogBean |
| | | { |
| | | /** |
| | | * 用户id,非必填 |
| | | */ |
| | | private string userId; |
| | | /** |
| | | * 住宅id,非必填 |
| | | */ |
| | | private string homeId; |
| | | /** |
| | | * 网关mac,非必填 |
| | | */ |
| | | private string mac; |
| | | /** |
| | | * 系统:IOS、Android、Windows、网关 |
| | | */ |
| | | private string userAgent; |
| | | /** |
| | | * 软件版本 |
| | | */ |
| | | private string appVersion; |
| | | |
| | | 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 getUserAgent() |
| | | { |
| | | return userAgent; |
| | | } |
| | | |
| | | public void setUserAgent(string userAgent) |
| | | { |
| | | this.userAgent = userAgent; |
| | | } |
| | | |
| | | public string getAppVersion() |
| | | { |
| | | return appVersion; |
| | | } |
| | | |
| | | public void setAppVersion(string appVersion) |
| | | { |
| | | this.appVersion = appVersion; |
| | | } |
| | | } |
| | | } |
| | |
| | | <Compile Include="Scan.cs" /> |
| | | <Compile Include="NetworkUtils.cs" /> |
| | | <Compile Include="SplashActivity.cs" /> |
| | | <Compile Include="Aliyu\AliyuLogUtil.cs" /> |
| | | <Compile Include="Aliyu\AliyuLogProducerClient.cs" /> |
| | | <Compile Include="Aliyu\LogBean.cs" /> |
| | | <Compile Include="Aliyu\Level.cs" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="Resources\AboutResources.txt" /> |
| | |
| | | <AndroidAsset Include="Assets\Phone2\CrabtreeAdd\CloudOffline.png" /> |
| | | <AndroidAsset Include="Assets\Phone2\CrabtreeAdd\Speaker.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\..\..\..\..\Downloads\AliyuLog\AliyuLog.csproj"> |
| | | <Name>AliyuLog</Name> |
| | | </ProjectReference> |
| | | </ItemGroup> |
| | | <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> |
| | | <Import Project="..\packages\Xamarin.Android.Support.Annotations.28.0.0.3\build\monoandroid80\Xamarin.Android.Support.Annotations.targets" Condition="Exists('..\packages\Xamarin.Android.Support.Annotations.28.0.0.3\build\monoandroid80\Xamarin.Android.Support.Annotations.targets')" /> |
| | | <Import Project="..\packages\Xamarin.Android.Arch.Core.Common.1.1.1.3\build\monoandroid80\Xamarin.Android.Arch.Core.Common.targets" Condition="Exists('..\packages\Xamarin.Android.Arch.Core.Common.1.1.1.3\build\monoandroid80\Xamarin.Android.Arch.Core.Common.targets')" /> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.804131" android:versionCode="202304131"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" /> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtreenew" android:versionName="2.807181" android:versionCode="202307181"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" /> |
| | | <!-- 在安卓P版本之后,必须要授予FOREGROUND_SERVICE权限,才能够使用前台服务 --> |
| | | <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> |
| | | <!-- 定位权限,用于APP通过获取定位坐标查询当前地区天气--> |
| | |
| | | EndProject
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ON.Ios", "ON.Ios\ON.Ios.csproj", "{1D83BF28-BA88-4152-BA41-D7EFE90A5437}"
|
| | | EndProject
|
| | | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AliyuLog", "..\..\..\..\Downloads\AliyuLog\AliyuLog.csproj", "{3A0E9FF9-56B6-4323-9AE6-2B22975E399B}"
|
| | | EndProject
|
| | | Global
|
| | | GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
| | | Debug|iPhoneSimulator = Debug|iPhoneSimulator
|
| | |
| | | {1D83BF28-BA88-4152-BA41-D7EFE90A5437}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
|
| | | {1D83BF28-BA88-4152-BA41-D7EFE90A5437}.Release|Any CPU.ActiveCfg = Release|iPhone
|
| | | {1D83BF28-BA88-4152-BA41-D7EFE90A5437}.Release|Any CPU.Build.0 = Release|iPhone
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhone.ActiveCfg = Release|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhone.Build.0 = Release|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|iPhone.Build.0 = Debug|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
| | | {3A0E9FF9-56B6-4323-9AE6-2B22975E399B}.Release|Any CPU.Build.0 = Release|Any CPU
|
| | | EndGlobalSection
|
| | | GlobalSection(MonoDevelopProperties) = preSolution
|
| | | Policies = $0
|
| | |
| | | //备注不能为空。 |
| | | public readonly static string RemarksCannotBeEmpty = "Device name cannot be empty"; |
| | | //请求服务器失败,请稍后再试! |
| | | public readonly static string FailedRequestServer = "Failed to request the server, please try again later!"; |
| | | public readonly static string FailedRequestServer = "Failed to request the server, please try again later!";//Request exception, please return and try again |
| | | } |
| | | } |
| | |
| | | } |
| | | //*****一些判空处理***************** |
| | | |
| | | if (revertObj.Code != StateCode.SUCCESS) { |
| | | if (revertObj.Code != "10001") { |
| | | string upString = requestFullUrl + " Code : " + revertObj.Code; |
| | | if (bodyParameterJson != null) { |
| | | upString += " ;" + bodyParameterJson; |
| | | } |
| | | //记录日志 |
| | | HDL_ON_Android.Aliyu.AliyuLogUtil.log ("接口告警", |
| | | upString, HDL_ON_Android.Aliyu.Level.middle); |
| | | } |
| | | } |
| | | return revertObj; |
| | | } catch (Exception ex) { |
| | | //记录日志 |
| | | HDL_ON_Android.Aliyu.AliyuLogUtil.log ("接口异常", "Url : " + requestFullUrl + " Msg : " + ex.Message, HDL_ON_Android.Aliyu.Level.high); |
| | | Utlis.WriteLine (ex.Message); |
| | | return new ResponsePackNew () { Code = StateCode.DATA_EXCEPTION }; |
| | | } |
| | | } else { |
| | | |
| | | Utlis.WriteLine (response.Content); |
| | | return new ResponsePackNew () { Code = StateCode.NETWORK_ERROR }; |
| | | } |
| | |
| | | /// 获取网关信息 |
| | | /// </summary> |
| | | public const string Api_Post_GetGatewayInfo = "/home-wisdom/app/gateway/info"; |
| | | ///// <summary> |
| | | ///// 解绑绑网关到住宅 |
| | | ///// </summary> |
| | | /// <summary> |
| | | /// 解绑住宅网关 |
| | | /// </summary> |
| | | public const string API_POST_UntieGateway = "/home-wisdom/app/gateway/untieGateway"; |
| | | /// <summary> |
| | | /// 强制换绑网关 |
| | |
| | | //MainPage.AddTip (Language.StringByID (R.MyInternationalizationString.SearchingGatewayLocally)); |
| | | MainPage.LoadingStart (Language.StringByID (R.MyInternationalizationString.SearchingGatewayLocally)); |
| | | |
| | | var control = new Control (); |
| | | |
| | | UserConfig.Instance.IsLocalEncrypt = false; |
| | | var control = new Control (); |
| | | control.Send (new Target () { |
| | | IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), |
| | | Command = Command.ReadGateway, |
| | |
| | | }, SendCount.Three, true, true); |
| | | var result = control.UsefulBytes; |
| | | |
| | | //优化一下,防止逻辑异常 |
| | | if(result == null) { |
| | | UserConfig.Instance.IsLocalEncrypt = true; |
| | | control.Send (new Target () { |
| | | IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), |
| | | Command = Command.ReadGateway, |
| | | SubnetID = SmartHome.MqttCommon.GatewayCommon.SubnetID, |
| | | DeviceID = SmartHome.MqttCommon.GatewayCommon.DeviceID, |
| | | AddData = new byte [] { (byte)new Random ().Next (255), (byte)new Random ().Next (255) }, |
| | | }, SendCount.Three, true, true); |
| | | result = control.UsefulBytes; |
| | | } |
| | | |
| | | #endregion |
| | | if (result != null) { |
| | |
| | | // }); |
| | | //} |
| | | |
| | | //在确定用户及住宅信息后,初始化基本信息,如: |
| | | var logBean = HDL_ON_Android.Aliyu.AliyuLogUtil.getLogBean; |
| | | |
| | | logBean.setHomeId (UserConfig.Instance.CurrentRegion.Id); |
| | | logBean.setUserId (MainPage.LoginUser.ID); |
| | | logBean.setAppVersion (MainPage.RequestVersion); |
| | | #if DEBUG |
| | | Shared.Utlis.WriteLine ($"CheckLinkRemote: 结束"); |
| | | #endif |
| | |
| | | //public static Button LogoButton = new Button (); |
| | | |
| | | |
| | | public static string RequestVersion = "2.804131"; |
| | | public static string RequestVersion = "2.807181"; |
| | | public static UserInfo LoginUser; |
| | | /// <summary> |
| | | /// 是否是管理员权限(变更了,成员的时候,这个也为ture。为什么会声明这样变量,因为有些接口必须使用原来的Token) |
| | |
| | | UserConfig.Instance.SaveUserConfig (); |
| | | return true; |
| | | } |
| | | } else if (revertObj.Code == "147103") { |
| | | } |
| | | else if (revertObj.Code == "147103") { |
| | | var pack = HttpServerRequest.Current.UnBindGateway (bindGatewayObj.homeId, UserConfig.Instance.HomeGateway.gatewayId); |
| | | if (pack.Code == StateCode.SUCCESS) { |
| | | var homeGatewayInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo> (revertObj.Data.ToString ()); |
| | |
| | | } else { |
| | | IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code); |
| | | } |
| | | } else { |
| | | } |
| | | else { |
| | | IMessageCommon.Current.ShowErrorInfoAlter (revertObj.Code); |
| | | } |
| | | } catch { |
| | |
| | | etPasswrod.SecureTextEntry = !btnShowPassword.IsSelected; |
| | | }; |
| | | |
| | | //#if DEBUG |
| | | // int NigelLoginPass = 0; |
| | | // btnLogo.MouseUpEventHandler += (sender, e) => { |
| | | // if (NigelLoginPass == 3) { |
| | | // etAccount.Text = @"464027401@qq.com"; |
| | | // etPasswrod.Text = "qqqqqq"; |
| | | // } else if (NigelLoginPass == 5) { |
| | | // etAccount.Text = @"Jai.singh@havells.com"; |
| | | // etPasswrod.Text = "123456"; |
| | | // } |
| | | // NigelLoginPass++; |
| | | // }; |
| | | //#endif |
| | | #if DEBUG |
| | | int NigelLoginPass = 0; |
| | | btnLogo.MouseUpEventHandler += (sender, e) => { |
| | | if (NigelLoginPass == 3) { |
| | | etAccount.Text = @"support6@hdlchina.com.cn"; |
| | | etPasswrod.Text = "123456"; |
| | | } else if (NigelLoginPass == 5) { |
| | | etAccount.Text = @"Jai.singh@havells.com"; |
| | | etPasswrod.Text = "123456"; |
| | | } |
| | | NigelLoginPass++; |
| | | }; |
| | | #endif |
| | | //if (accountList.Count > 0) { |
| | | // etAccount.Text = accountList [accountList.Count-1]; |
| | | //} |
| | |
| | | }; |
| | | contentView.AddChidren (btnModifyNullLine); |
| | | #endregion |
| | | |
| | | |
| | | #region LocalEncryption |
| | | var LocalEncryptionView = new FrameLayout () { |
| | | Height = Application.GetRealHeight (100), |
| | | }; |
| | | contentView.AddChidren (LocalEncryptionView); |
| | | |
| | | Button btnLocalEncryptionTitle = new Button () { |
| | | X = Application.GetRealWidth (40), |
| | | Text = "Set local encryption", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = SkinStyle.Current.TextColor1, |
| | | }; |
| | | LocalEncryptionView.AddChidren (btnLocalEncryptionTitle); |
| | | |
| | | Button btnLocalEncryptionRight = new Button () { |
| | | X = Application.GetRealWidth (580), |
| | | Width = Application.GetRealWidth (28), |
| | | Height = Application.GetRealHeight (40), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Item/Right.png", |
| | | SelectedImagePath = "Item/RightSelected.png", |
| | | }; |
| | | LocalEncryptionView.AddChidren (btnLocalEncryptionRight); |
| | | |
| | | EventHandler<MouseEventArgs> localEncryptionHandler = (sender, e) => { |
| | | |
| | | var waitPage = new Loading (); |
| | | this.AddChidren (waitPage); |
| | | waitPage.Start ("wait..."); |
| | | new System.Threading.Thread (() => { |
| | | try { |
| | | byte [] AseKeyBytes = UserConfig.Instance.GenerateLocalEncryptionKey (); |
| | | byte [] sendBytes = new byte [17]; |
| | | sendBytes [0] = (byte)1; //0:不加密 1:加密 |
| | | Array.Copy (AseKeyBytes, 0, sendBytes, 1, 16); |
| | | |
| | | UserConfig.Instance.IsLocalEncrypt = false; |
| | | var control = new Control (); |
| | | control.Send (new Target () { |
| | | IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), |
| | | Command = Command.SetGateWayLocalEncryption, |
| | | SubnetID = 255, |
| | | DeviceID = 0, |
| | | AddData = sendBytes |
| | | }, SendCount.Three, true, true); |
| | | var backBytes = control.UsefulBytes; |
| | | }catch(Exception ex) { |
| | | |
| | | } finally { |
| | | Application.RunOnMainThread (() => { |
| | | waitPage.Hide (); |
| | | }); |
| | | } |
| | | }) { IsBackground = true }.Start (); |
| | | }; |
| | | LocalEncryptionView.MouseUpEventHandler += localEncryptionHandler; |
| | | btnLocalEncryptionTitle.MouseUpEventHandler += localEncryptionHandler; |
| | | btnModifyPasswordRight.MouseUpEventHandler += localEncryptionHandler; |
| | | |
| | | Button btnLocalEncryptionLine = new Button () { |
| | | Height = Application.GetRealHeight (5), |
| | | BackgroundColor = SkinStyle.Current.MainColor, |
| | | }; |
| | | contentView.AddChidren (btnLocalEncryptionLine); |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | Button btnLogout = new Button () { |
| | | Y = contentView.Bottom, |
| | | Height = Application.GetRealHeight (93), |