| | |
| | | 点击弹起事件 |
| | | </summary> |
| | | </member> |
| | | <member name="F:Shared.View.MouseUpOutsideEventHandler"> |
| | | <summary> |
| | | 点击弹起事件 UpOutside |
| | | </summary> |
| | | </member> |
| | | <member name="F:Shared.View.MouseLongEventHandler"> |
| | | <summary> |
| | | 长按点击事件 |
| | |
| | | 加载本地HTML |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.WebView.LoadHTMLString(System.String)"> |
| | | <summary> |
| | | 加载Html标签的富文本 |
| | | </summary> |
| | | <param name="htmlStr"></param> |
| | | </member> |
| | | <member name="T:Shared.WebView.MyWebViewClient"> |
| | | <summary> |
| | | MyWebViewClient |
| | |
| | | 加载本地HTML |
| | | </summary> |
| | | </member> |
| | | <member name="M:Shared.WebView.LoadHTMLString(System.String)"> |
| | | <summary> |
| | | 加载Html标签的富文本 |
| | | </summary> |
| | | <param name="htmlStr"></param> |
| | | </member> |
| | | <member name="T:Shared.WebView.OnWKNavigationDelegate"> |
| | | <summary> |
| | | OnWKNavigationDelegate |
| | |
| | | 9066=Remarks |
| | | 9067=Remarks cannot be blank. |
| | | 9068=Do you want to unbind? |
| | | 9069=Property notice |
| | | |
| | | 10000=Invalid password, please log in again. |
| | | 10001=Fail to request server, please try again later. |
| | |
| | | 9066=备注 |
| | | 9067=备注不能为空 |
| | | 9068=是否解除绑定? |
| | | 9069=物业通知 |
| | | |
| | | 10000=无效登录密钥,请重新登录! |
| | | 10001=请求服务器失败,请稍后再试! |
| | |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Icon\HomeIcon\electricalbreaker_white.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\security.png" /> |
| | | <AndroidAsset Include="Assets\Phone\Public\HookIcon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\Collection\MesCenter\Property.png" /> |
| | | <AndroidAsset Include="Assets\Phone\Collection\MesCenter\PropertyOn.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\DoorLock\BindScene.png" /> |
| | |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\Icon\HomeIcon\electricalbreaker_white.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\security.png" /> |
| | | <BundleResource Include="Resources\Phone\Public\HookIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\Collection\MesCenter\Property.png" /> |
| | | <BundleResource Include="Resources\Phone\Collection\MesCenter\PropertyOn.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | 9066=Remarks |
| | | 9067=Remarks cannot be blank. |
| | | 9068=Do you want to unbind? |
| | | 9069=Property notice |
| | | |
| | | 10000=Invalid password, please log in again. |
| | | 10001=Fail to request server, please try again later. |
| | |
| | | 9066=备注 |
| | | 9067=备注不能为空 |
| | | 9068=是否解除绑定? |
| | | 9069=物业通知 |
| | | |
| | | 10000=无效登录密钥,请重新登录! |
| | | 10001=请求服务器失败,请稍后再试! |
| | |
| | | /// <summary> |
| | | /// 物业通知,待确认修改 |
| | | /// </summary> |
| | | Property, |
| | | IMOU_VISAAL, |
| | | /// <summary> |
| | | /// 物业通知 |
| | | /// </summary> |
| | | Notice, |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 是否解除绑定? |
| | | /// </summary> |
| | | public const int DoYouWantToUnbind = 9068; |
| | | |
| | | /// <summary> |
| | | /// 物业通知 |
| | | /// </summary> |
| | | public const int Propertynotice = 9069; |
| | | |
| | | |
| | | #region 网络请求响应错误提示信息 |
| | |
| | | /// 是否搜索本地网关成功 |
| | | /// </summary> |
| | | public bool IsSearchLocalGatewaySuccessful = false; |
| | | |
| | | /// <summary> |
| | | /// 是否本地加密,目前只对A网关有用 |
| | | /// </summary> |
| | | public bool IsLocalEncrypt; |
| | | /// <summary> |
| | | /// 判断是否本地加密并且加密key不为空 |
| | | /// </summary> |
| | | public bool IsLocalEncryptAndGetAesKey { |
| | | get { |
| | | return IsLocalEncrypt && (!string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.localSecret)); |
| | | } |
| | | } |
| | | |
| | | bool _GatewayOnline_Local = false; |
| | | /// <summary> |
| | | /// 网关在线-局域网 |
| | |
| | | /// <summary> |
| | | /// 转换发送数据 |
| | | /// </summary> |
| | | public byte[] ConvertSendBodyData(string topic, string bodyDataString) |
| | | /// <param name="topic">主题</param> |
| | | /// <param name="bodyDataString">body内容数据</param> |
| | | /// <param name="isEncryption">是否要对body加密</param> |
| | | /// <returns></returns> |
| | | public byte[] ConvertSendBodyData(string topic, string bodyDataString, bool isEncryption = true) |
| | | { |
| | | string topicString = "Topic:" + topic + "\r\n"; |
| | | byte[] bodyBytes = Encoding.ASCII.GetBytes(bodyDataString); |
| | | string lengthString = "Length:" + bodyBytes.Length.ToString() + "\r\n" + "\r\n"; |
| | | //string topicString = "Topic:" + topic + "\r\n"; |
| | | //byte[] bodyBytes = Encoding.ASCII.GetBytes(bodyDataString); |
| | | //string lengthString = "Length:" + bodyBytes.Length.ToString() + "\r\n" + "\r\n"; |
| | | |
| | | string sendDataString = topicString + lengthString + bodyDataString; |
| | | byte[] sendDataBytes = Encoding.ASCII.GetBytes(sendDataString); |
| | | MainPage.Log($"转换HDL-Link数据\r\n{sendDataString}\r\n"); |
| | | //string sendDataString = topicString + lengthString + bodyDataString; |
| | | //byte[] sendDataBytes = Encoding.ASCII.GetBytes(sendDataString); |
| | | //MainPage.Log($"转换HDL-Link数据\r\n{sendDataString}\r\n"); |
| | | |
| | | //*************************************************************** |
| | | //2021-09-23 增加本地通信加密处理 |
| | | //1.拼接头 |
| | | string topicString = "Topic:" + topic + "\r\n"; |
| | | //2.Body字符串转为byte数组 |
| | | byte[] bodyBytes = Encoding.ASCII.GetBytes(bodyDataString); |
| | | //判断是否需加密Body数据 |
| | | if (isEncryption && IsLocalEncryptAndGetAesKey) |
| | | { |
| | | bodyBytes = Securitys.EncryptionService.AesEncryptPayload(bodyBytes, DB_ResidenceData.Instance.CurrentRegion.localSecret); |
| | | //bodyDataString = Encoding.UTF8.GetString(bodyBytes); |
| | | //MainPage.Log($"转换HDL-Link数据 加密key:" + DB_ResidenceData.Instance.CurrentRegion.localSecret); |
| | | } |
| | | //3.拼接body的Length长度数据 |
| | | string lengthString = "Length:" + bodyBytes.Length.ToString() + "\r\n" + "\r\n"; |
| | | string topicAndLengthString = topicString + lengthString; |
| | | byte[] topicAndLengthBytes = Encoding.ASCII.GetBytes(topicAndLengthString); |
| | | //4.拼接合并 Topic 和 body的byte数组数据 |
| | | byte[] sendDataBytes = new byte[topicAndLengthBytes.Length + bodyBytes.Length]; |
| | | topicAndLengthBytes.CopyTo(sendDataBytes, 0); |
| | | bodyBytes.CopyTo(sendDataBytes, topicAndLengthBytes.Length); |
| | | |
| | | //var sendDataString = Encoding.UTF8.GetString(sendDataBytes); |
| | | //MainPage.Log($"转换HDL-Link数据\r\n{sendDataString}\r\n"); |
| | | //*************************************************************** |
| | | |
| | | return sendDataBytes; |
| | | } |
| | |
| | | public void ConvertReceiveData(byte[] receiveBytes) |
| | | { |
| | | var reString = Encoding.UTF8.GetString(receiveBytes); |
| | | AnalysisReceiveData(reString); |
| | | AnalysisReceiveData(reString, receiveBytes); |
| | | } |
| | | /// <summary> |
| | | /// 转换接收到的数据 |
| | | /// </summary> |
| | | /// <param name="receiveString">转String后的数据</param> |
| | | /// <param name="originalReceiveBytes"原始Bytes数据</param> |
| | | /// <returns></returns> |
| | | public LocalCommunicationData AnalysisReceiveData(string receiveString) |
| | | public LocalCommunicationData AnalysisReceiveData(string receiveString, byte[] originalReceiveBytes) |
| | | { |
| | | LocalCommunicationData receiveObj = new LocalCommunicationData(); |
| | | |
| | | MainPage.Log($"局域网信息: \r\n{receiveString}"); |
| | | |
| | | var res = receiveString.Split("\r\n\r\n"); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | MainPage.Log($"局域网信息: {receiveObj.Topic} : 内容: {res[1]}"); |
| | | |
| | | //MainPage.Log($"局域网信息: {receiveObj.Topic} : 内容: {res[1]}"); |
| | | |
| | | //验证有效数据长度 |
| | | //if (res[1].Length != receiveObj.Length) |
| | |
| | | // return receiveObj; |
| | | //} |
| | | receiveObj.BodyDataString = res[1]; |
| | | |
| | | //2021-09-23 过滤不需要解密的主题 目前搜索网关主题不加密 |
| | | if (receiveObj.Topic != CommunicationTopic.SearchLoaclGatewayReply) |
| | | { |
| | | //判断当前网关是否开启了本地加密 |
| | | if (IsLocalEncryptAndGetAesKey) |
| | | { |
| | | MainPage.Log($"局域网信息 开始解密"); |
| | | if (originalReceiveBytes != null) |
| | | { |
| | | //拿到原始Bytes数据去解密 |
| | | byte[] topicBytes = Encoding.UTF8.GetBytes(res[0]); |
| | | byte[] bodyBytes = new byte[receiveObj.Length]; |
| | | Array.Copy(originalReceiveBytes, topicBytes.Length + 4, bodyBytes, 0, receiveObj.Length); |
| | | byte[] receiveBytes = Securitys.EncryptionService.AesDecryptPayload(bodyBytes, DB_ResidenceData.Instance.CurrentRegion.localSecret); |
| | | var revString = Encoding.UTF8.GetString(receiveBytes); |
| | | receiveObj.BodyDataString = revString; |
| | | MainPage.Log($"局域网信息: 解密后:" + receiveObj.BodyDataString); |
| | | } |
| | | else |
| | | { |
| | | //目前不拿原始Bytes数据 解密不了 |
| | | //byte[] receiveBytes = Encoding.UTF8.GetBytes(res[1]); |
| | | //MainPage.Log($"局域网信息 receiveBytes {receiveBytes.Length}"); |
| | | //receiveBytes = Securitys.EncryptionService.AesDecryptPayload(receiveBytes, DB_ResidenceData.Instance.CurrentRegion.localSecret); |
| | | //MainPage.Log($"局域网信息 解密后:receiveBytes {receiveBytes.Length}"); |
| | | //var revString = Encoding.UTF8.GetString(receiveBytes); |
| | | //receiveObj.BodyDataString = revString; |
| | | //MainPage.Log($"局域网信息: 解密后:" + receiveObj.BodyDataString); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | if (receiveObj.Topic == CommunicationTopic.SearchLoaclGatewayReply || receiveObj.Topic == CommunicationTopic.GatewayBroadcast) |
| | | { |
| | |
| | | { |
| | | Ins.GatewayId = device.device_mac; |
| | | } |
| | | reportIp = device.ip_address;//主播地址也能控制设备//"239.0.168.188";// |
| | | reportIp = device.ip_address;//主播地址也能控制设备//"239.0.168.188";// |
| | | //2021-09-23 新增获取当前网关是否本地加密 |
| | | Ins.IsLocalEncrypt = device.isLocalEncrypt; |
| | | //MainPage.Log("网关本地加密状态:" + device.local_encrypt.ToString()); |
| | | } |
| | | } |
| | | else if (receiveObj.Topic == CommunicationTopic.ct.ReadStatus + "_reply" || |
| | |
| | | void AnalysisTcpData(Socket socket, string tcpBodyDataString) |
| | | { |
| | | MainPage.Log($"0001 tcpDataString:\r\n {tcpBodyDataString}"); |
| | | var tcpDataObj = Control.Ins.AnalysisReceiveData(tcpBodyDataString); |
| | | var tcpDataObj = Control.Ins.AnalysisReceiveData(tcpBodyDataString, null); |
| | | if (tcpDataObj.BodyDataString == null) |
| | | { |
| | | return; |
| | |
| | | var sendJob = new JObject { { "id", Control.Ins.msg_id.ToString() }, { "time_stamp", Utlis.GetTimestamp ()} }; |
| | | var bodyString = JsonConvert.SerializeObject(sendJob); |
| | | |
| | | var sendBytes = Control.Ins.ConvertSendBodyData(CommunicationTopic.SearchLoaclGateway, bodyString); |
| | | var sendBytes = Control.Ins.ConvertSendBodyData(CommunicationTopic.SearchLoaclGateway, bodyString, false); |
| | | //组播发送 |
| | | packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse("239.0.168.188"), 8585)); |
| | | packet.HaveSendCount = 4; |
| | |
| | | deviceName = OnAppConfig.Instance.PhoneName, |
| | | deviceType = deviceType, |
| | | produce = isProduce, |
| | | |
| | | }; |
| | | mAddpushinfoObj.languageType = Utlis.GetPostLanguageType(); |
| | | |
| | | #if DEBUG |
| | | //List<string> communityCodes = new List<string>(); |
| | | //communityCodes.Add(""); |
| | | //mAddpushinfoObj.communityCodes = communityCodes; |
| | | #endif |
| | | |
| | | //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj); |
| | | var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj); |
| | |
| | | } |
| | | else if (queryType == 4) |
| | | { |
| | | pushType = PushType.Property.ToString(); |
| | | pushType = PushType.Notice.ToString(); |
| | | } |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj() |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="msgId"></param> |
| | | /// <returns></returns> |
| | | public bool PushSerivceDeleteMessage(string msgId) |
| | | public bool PushSerivceDeleteMessage(PushMsgIdObj mPushMsgIdObj) |
| | | { |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false; |
| | | |
| | | if (mPushMsgIdObj == null) return false; |
| | | try |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new PushMsgIdObj() |
| | | { |
| | | msgId = msgId |
| | | }); |
| | | var requestJson = HttpUtil.GetSignRequestJson(mPushMsgIdObj); |
| | | |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Deletepushinfo, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取物业公告详情 |
| | | /// </summary> |
| | | /// <param name="noticeId"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetPropertyNoticeDetails(string noticeId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("noticeId", noticeId); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_GetNoticeInfo, requestJson); |
| | | } |
| | | #endregion |
| | | |
| | | #region 检测更新 |
| | |
| | | |
| | | |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 获取天气部分 |
| | | #region 获取天气部分 |
| | | /// <summary> |
| | | /// 获取指定经纬度的城市信息 |
| | | /// </summary> |
| | |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region 备份部分 |
| | | #region 备份部分 |
| | | ///// <summary> |
| | | ///// 获取住宅备份列表 |
| | | ///// </summary> |
| | |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d); |
| | | var revertObj = RequestHttps("https://developer.hdlcontrol.com/api/UserBackupList", requestJson, true); |
| | | var jt = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JObject>>(revertObj.ResponseData.ToString()); |
| | | #region 恢复房间数据 |
| | | #region 恢复房间数据 |
| | | |
| | | |
| | | GetBackupRoom(jt,loading); |
| | | #endregion |
| | | #endregion |
| | | |
| | | Application.RunOnMainThread(() => { |
| | | loading.Hide(); |
| | |
| | | } |
| | | */ |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region Kaede --设备功能—————————————————————————————————— |
| | | #region Kaede --设备功能—————————————————————————————————— |
| | | /// <summary> |
| | | /// 获取设备列表 |
| | | /// </summary> |
| | |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson); |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region Kaede --场景功能-------------------------- |
| | | #region Kaede --场景功能-------------------------- |
| | | /// <summary> |
| | | /// 获取场景列表 |
| | | /// 房间ID可空,默认查询住宅下所有房间 |
| | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectScene, requestJson).Code; |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region Kaede --房间功能-------------------------- |
| | | #region Kaede --房间功能-------------------------- |
| | | /// <summary> |
| | | /// 获取房间列表 |
| | | /// </summary> |
| | |
| | | return pack; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region Kaede -- 安防接口____________________________ |
| | | #region Kaede -- 安防接口____________________________ |
| | | /// <summary> |
| | | /// 获取安防列表 |
| | | /// </summary> |
| | |
| | | return pack; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region Kaede --第三方品牌功能-------------------------- |
| | | #region Kaede --第三方品牌功能-------------------------- |
| | | /// <summary> |
| | | /// 获取第三方品牌列表 |
| | | /// </summary> |
| | |
| | | return pack; |
| | | } |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region ■ 萤石云SDK相关接口_________________________ |
| | | #region ■ 萤石云SDK相关接口_________________________ |
| | | /// <summary> |
| | | /// 河东获取萤石云子账号token的接口 |
| | | /// 2021-07-07 新方案接口调整对接 |
| | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson); |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | #region ■ 可视对讲_________________________ |
| | | #region ■ 可视对讲_________________________ |
| | | /// <summary> |
| | | /// 检查住宅是否绑定丰林 |
| | | /// </summary> |
| | |
| | | var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson); |
| | | return pack; |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region ■ 门锁相关____________________________ |
| | | #region ■ 门锁相关____________________________ |
| | | |
| | | /// <summary> |
| | | /// 获取门锁历史记录(按日期降序) |
| | |
| | | return listSortLog; |
| | | } |
| | | |
| | | #endregion |
| | | #region ■ 音箱语言控制相关_________________________ |
| | | #endregion |
| | | #region ■ 音箱语言控制相关_________________________ |
| | | /// <summary> |
| | | /// 获取已授权的音箱列表 |
| | | /// </summary> |
| | |
| | | var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson); |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 请求超时时间 |
| | | /// </summary> |
| | | public const int TIME_OUT = 10; |
| | | public const int TIME_OUT = 15; |
| | | /// <summary> |
| | | /// 特殊接口请求超时时间 |
| | | /// </summary> |
| | |
| | | /// <param name="replaceToken"></param> |
| | | /// <param name="mTimeout"></param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew RequestHttpsGet(string apiPath, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 10) |
| | | public static ResponsePackNew RequestHttpsGet(string apiPath, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) |
| | | { |
| | | return RequestHttps(Method.GET, apiPath, null, queryDictionary, urlSegmentDictionary, urlHead, replaceToken, mTimeout); |
| | | } |
| | |
| | | ///// <param name="mTimeout">请求超时时间,默认10</param> |
| | | ///// <param name="urlHead"></param> |
| | | ///// <returns></returns> |
| | | //public static ResponsePackNew RequestHttpsBase(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 10, bool needErrorTip = true) |
| | | //public static ResponsePackNew RequestHttpsBase(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT, bool needErrorTip = true) |
| | | //{ |
| | | // var mResponsePackNew = RequestHttps(method, apiPath, bodyParameterJson, queryDictionary, urlSegmentDictionary, urlHead, replaceToken, mTimeout); |
| | | // if (needErrorTip) |
| | |
| | | /// <param name="bodyParameterJson"></param> |
| | | /// <param name="mTimeout"></param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew RequestHttpsPostFroHome(string apiPath, string bodyParameterJson, int mTimeout = 10) |
| | | public static ResponsePackNew RequestHttpsPostFroHome(string apiPath, string bodyParameterJson, int mTimeout = TIME_OUT) |
| | | { |
| | | string urlHead = DB_ResidenceData.Instance.CurrentRegion.regionUrl; |
| | | //var replaceToken = ""; |
| | |
| | | /// <param name="replaceToken"></param> |
| | | /// <param name="mTimeout"></param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew RequestHttpsPost(string apiPath, string bodyParameterJson, string urlHead = "", string replaceToken = "", int mTimeout = 10) |
| | | public static ResponsePackNew RequestHttpsPost(string apiPath, string bodyParameterJson, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) |
| | | { |
| | | return RequestHttps(Method.POST, apiPath, bodyParameterJson, null, null, urlHead, replaceToken, mTimeout); |
| | | } |
| | |
| | | /// <param name="replaceToken"></param> |
| | | /// <param name="mTimeout"></param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew RequestHttpsPost(string apiPath, Dictionary<string, object> queryDictionary, string urlHead = "", string replaceToken = "", int mTimeout = 10) |
| | | public static ResponsePackNew RequestHttpsPost(string apiPath, Dictionary<string, object> queryDictionary, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) |
| | | { |
| | | return RequestHttps(Method.POST, apiPath, null, queryDictionary, null, urlHead, replaceToken, mTimeout); |
| | | } |
| | |
| | | /// <param name="replaceToken"></param> |
| | | /// <param name="mTimeout"></param> |
| | | /// <returns></returns> |
| | | static ResponsePackNew RequestHttpsBase(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 10) |
| | | static ResponsePackNew RequestHttpsBase(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) |
| | | { |
| | | //Dome模式登录 |
| | | |
| | |
| | | /// <param name="replaceToken"></param> |
| | | /// <param name="mTimeout"></param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew RequestHttps(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 10) |
| | | public static ResponsePackNew RequestHttps(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) |
| | | { |
| | | var responsePackNew = RequestHttpsBase(method, apiPath, bodyParameterJson, queryDictionary, urlSegmentDictionary, urlHead, replaceToken, mTimeout); |
| | | //*****************Token过期处理***************** |
| | |
| | | /// <param name="replaceToken"></param> |
| | | /// <param name="mTimeout"></param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew RequestHttpsUpload(Method method, string apiPath, object bodyParameterObject = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 10) |
| | | public static ResponsePackNew RequestHttpsUpload(Method method, string apiPath, object bodyParameterObject = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = TIME_OUT) |
| | | { |
| | | #region HttpWebRequest |
| | | try |
| | |
| | | #endregion |
| | | |
| | | #region ■ PushSerivce -- 推送服务接口___________________________ |
| | | |
| | | /// <summary> |
| | | /// 添加推送Token |
| | | /// 注册推送接口 |
| | | /// 批量推送绑定家居社区接口 |
| | | /// 2021-09-09 对接新接口支持物业公告推送 |
| | | /// communityCodes 不传 默认所有住宅或者小区都收到推送 |
| | | /// </summary> |
| | | public const string API_POST_PushSerivce_AddToken = "/smart-footstone/app/push-information/add"; |
| | | public const string API_POST_PushSerivce_AddToken = "/smart-footstone/app/push-information/addPushToken"; |
| | | /// <summary> |
| | | /// 删除推送Token |
| | | /// 注销推送接口 |
| | | /// 批量解绑家居社区 |
| | | /// 2021-09-09 对接新接口支持物业公告推送 |
| | | /// </summary> |
| | | public const string API_POST_PushSerivce_DeleteToken = "/smart-footstone/app/push-information/delete"; |
| | | public const string API_POST_PushSerivce_DeleteToken = "/smart-footstone/app/push-information/unBindPushToken"; |
| | | ///// <summary> |
| | | ///// 添加推送Token |
| | | ///// </summary> |
| | | //public const string API_POST_PushSerivce_AddToken = "/smart-footstone/app/push-information/add"; |
| | | ///// <summary> |
| | | ///// 删除推送Token |
| | | ///// </summary> |
| | | //public const string API_POST_PushSerivce_DeleteToken = "/smart-footstone/app/push-information/delete"; |
| | | ///// <summary> |
| | | /////// 获取推送消息记录 |
| | | /////// </summary> |
| | |
| | | /// 通过主键id删除一条推送记录 |
| | | /// </summary> |
| | | public const string API_POST_PushSerivce_Deletepushinfo = "/smart-footstone/app/message/delete_by_id"; |
| | | /// <summary> |
| | | /// 获取物业公告详情 |
| | | /// </summary> |
| | | public const string API_POST_PushSerivce_GetNoticeInfo = "/community-footstone/app/notice/info"; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ -- 检测更新接口___________________________ |
| | |
| | | /// 软件来源,Evoyo、ON、ON_Plus |
| | | /// </summary> |
| | | public string software = SoftwareType.ON_Plus.ToString(); |
| | | /// <summary> |
| | | /// 小区codes(不传,默认绑定所有住宅和小区的推送) |
| | | /// </summary> |
| | | public List<string> communityCodes; |
| | | /// <summary> |
| | | /// 指定推送语言 (目前该参数还没用) |
| | | /// 2021-09-13 增加当前APP使用的语言参数, 目前云端接口还没支持 |
| | | /// </summary> |
| | | public string languageType; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 消息记录Id |
| | | /// </summary> |
| | | public string msgId; |
| | | /// <summary> |
| | | /// 删除物业公告要这个 |
| | | /// </summary> |
| | | public string pushType; |
| | | } |
| | | |
| | | |
| | |
| | | /// 区分是bus设备,还是knx设备 |
| | | /// </summary> |
| | | public string driver_code = ""; |
| | | /// <summary> |
| | | /// 是否主网关 |
| | | /// </summary> |
| | | public bool master; |
| | | /// <summary> |
| | | /// 是否开启了本地加密 |
| | | /// 2021-09-23 注意:为了兼容控制以前不加密网关要用这个新的字段,不能用local_encrypt,因为发现以前部分固件已经有这个标记并且回复true,但实际上通信还没加密的 |
| | | /// </summary> |
| | | public bool isLocalEncrypt; |
| | | } |
| | | } |
| | |
| | | /// 调试权限是否打开 |
| | | /// </summary> |
| | | public bool debugPerm; |
| | | /// <summary> |
| | | /// 网关本地通信加密Key,同一个住宅 密钥创建后就不变 |
| | | /// </summary> |
| | | public string localSecret; |
| | | }
|
| | |
|
| | | }
|
| | |
| | | /// bodyView |
| | | /// </summary> |
| | | FrameLayout bodyView; |
| | | /// <summary> |
| | | /// mWebView |
| | | /// </summary> |
| | | public WebView mWebView; |
| | | |
| | | /// <summary> |
| | | /// WebViewDialog |
| | |
| | | /// <summary> |
| | | /// 加载页面 |
| | | /// </summary> |
| | | /// <param name="titleStr"></param> |
| | | /// <param name="url"></param> |
| | | public void LoadPage(string titleStr, string url) |
| | | void AddBodyViewWithTittle(string titleStr) |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | this.AddChidren(bodyView); |
| | | new TopViewDiv(this, bodyView, titleStr).LoadTopView(); |
| | | |
| | | //WebView |
| | | var webView = new WebView() { |
| | | mWebView = new WebView() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = bodyView.Height - Application.GetRealHeight(64), |
| | | X = Application.GetRealWidth(16), |
| | | Width = bodyView.Width - Application.GetRealWidth(32) |
| | | }; |
| | | bodyView.AddChidren(webView); |
| | | bodyView.AddChidren(mWebView); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载页面 |
| | | /// </summary> |
| | | /// <param name="titleStr"></param> |
| | | /// <param name="url"></param> |
| | | public void LoadPage(string titleStr, string url) { |
| | | |
| | | AddBodyViewWithTittle(titleStr); |
| | | |
| | | try |
| | | { |
| | | if (!string.IsNullOrEmpty(url)) |
| | | { |
| | | //加载网址 |
| | | webView.LoadRequest(url); |
| | | mWebView.LoadRequest(url); |
| | | } |
| | | } |
| | | catch |
| | |
| | | |
| | | this.Show(); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 加载页面 |
| | | /// html富文本 |
| | | /// </summary> |
| | | /// <param name="titleStr"></param> |
| | | /// <param name="htmlStr"></param> |
| | | public void LoadPageWithHtmlStr(string titleStr, string htmlStr) |
| | | { |
| | | |
| | | AddBodyViewWithTittle(titleStr); |
| | | |
| | | try |
| | | { |
| | | if (!string.IsNullOrEmpty(htmlStr)) |
| | | { |
| | | //html富文本 |
| | | mWebView.LoadHTMLString(htmlStr); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | |
| | | this.Show(); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | #endif |
| | | |
| | | }; |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 分享与功能 |
| | | shareMenuButton = new MenuButton() |
| | |
| | | shareMenuButton.SelectAction = shateAction; |
| | | #endregion |
| | | |
| | | #region 报警类 |
| | | #region 报警类 |
| | | alarmMenuButton = new MenuButton() |
| | | { |
| | | X = shareMenuButton.Right, |
| | |
| | | MenuButtonSelect(2); |
| | | }; |
| | | alarmMenuButton.SelectAction = alarmAction; |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 系统信息 |
| | | #region 系统信息 |
| | | systemMenuButton = new MenuButton() |
| | | { |
| | | X = alarmMenuButton.Right, |
| | |
| | | systemMenuButton.SelectAction = systemAction; |
| | | #endregion |
| | | |
| | | #region 物业通知 |
| | | #region 物业通知 2021-09-15增加 |
| | | propertyMenuButton = new MenuButton() |
| | | { |
| | | X = systemMenuButton.Right, |
| | | Y = Application.GetRealWidth(16), |
| | | }; |
| | | //menuView.AddChidren(propertyMenuButton); //先屏蔽 |
| | | propertyMenuButton.ImageButton.SelectedImagePath = "Collection/MesCenter/SystemOn.png"; |
| | | propertyMenuButton.ImageButton.UnSelectedImagePath = "Collection/MesCenter/System.png"; |
| | | propertyMenuButton.TextButton.TextID = StringId.SystemMessage; |
| | | menuView.AddChidren(propertyMenuButton); |
| | | propertyMenuButton.ImageButton.SelectedImagePath = "Collection/MesCenter/PropertyOn.png"; |
| | | propertyMenuButton.ImageButton.UnSelectedImagePath = "Collection/MesCenter/Property.png"; |
| | | propertyMenuButton.TextButton.TextID = StringId.Propertynotice; |
| | | propertyMenuButton.TextButton.IsMoreLines = true; |
| | | Action propertyAction = () => |
| | | { |
| | | MenuButtonSelect(4); |
| | |
| | | propertyMenuButton.SelectAction = propertyAction; |
| | | #endregion |
| | | |
| | | //先屏蔽 |
| | | ////右paddingView |
| | | //menuView.AddChidren(new Button() { |
| | | // Width = Application.GetRealWidth(15), |
| | | // BackgroundColor = CSS_Color.viewTranslucence |
| | | //}); |
| | | //右paddingView |
| | | menuView.AddChidren(new Button() |
| | | { |
| | | Width = Application.GetRealWidth(15), |
| | | BackgroundColor = CSS_Color.viewTranslucence |
| | | }); |
| | | |
| | | } |
| | | |
| | |
| | | propertyMenuButton.IsSelected = true; |
| | | |
| | | } |
| | | |
| | | menuView.ScrollToX(selectId * Application.GetRealWidth(40)); |
| | | |
| | | GetPushMessageList(showMesType); |
| | | } |
| | |
| | | |
| | | |
| | | btnDatetime.Text = GetUnixToDateTime(pushMessageInfo.createTime); |
| | | //2020-12-23 去掉点击弹窗事件 |
| | | //EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | //{ |
| | | // new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show(); |
| | | //}; |
| | | //rowView.MouseUpEventHandler = eventHandler; |
| | | //btnTilte.MouseUpEventHandler = eventHandler; |
| | | //btnSubtitle.MouseUpEventHandler = eventHandler; |
| | | |
| | | |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => |
| | | { |
| | | OnClickPushMessageInfo(pushMessageInfo); |
| | | //new Alert(pushMessageInfo.messageTitle, pushMessageInfo.messageContent, Language.StringByID(StringId.Close)).Show(); |
| | | }; |
| | | rowView.MouseUpEventHandler = eventHandler; |
| | | btnTilte.MouseUpEventHandler = eventHandler; |
| | | btnSubtitle.MouseUpEventHandler = eventHandler; |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | var result = new HttpServerRequest().PushSerivceDeleteMessage(pushMessageInfo.id); |
| | | var delPush = new PushMsgIdObj() |
| | | { |
| | | msgId = pushMessageInfo.id, |
| | | pushType = pushMessageInfo.pushType |
| | | }; |
| | | |
| | | var result = new HttpServerRequest().PushSerivceDeleteMessage(delPush); |
| | | if (result) |
| | | { |
| | | PushMessageInfoList.Remove(pushMessageInfo); |
| | |
| | | void GetPushMessageList(int queryType = 0) |
| | | { |
| | | bodyScrolView.RemoveAll(); |
| | | if(PushMessageInfoList == null) |
| | | if (PushMessageInfoList == null) |
| | | { |
| | | PushMessageInfoList = new List<PushMessageInfo>(); |
| | | } |
| | |
| | | { |
| | | PushMessageInfoList.Clear(); |
| | | } |
| | | |
| | | |
| | | YearMark = "";//标记清空 |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) |
| | | { |
| | |
| | | //PushMessageInfoList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PushMessageInfo>>(result.Data.ToString()); |
| | | //2021-08-28 改为分页接口 |
| | | var mPushMesList = Newtonsoft.Json.JsonConvert.DeserializeObject<PushMessageInfoList>(result.Data.ToString()); |
| | | if(mPushMesList != null) { |
| | | if (mPushMesList != null) |
| | | { |
| | | PushMessageInfoList = mPushMesList.list; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | #region 测试 |
| | | /// <summary> |
| | | /// 获取物业通知详情 |
| | | /// </summary> |
| | | /// <param name="noticeId"></param> |
| | | void GetPropertyNoticeDetails(string noticeId) |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var result = new HttpServerRequest().GetPropertyNoticeDetails(noticeId); |
| | | if (result.Code == StateCode.SUCCESS) |
| | | { |
| | | var mPushNoticeInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<PushNoticeInfo>(result.Data.ToString()); |
| | | if (mPushNoticeInfo != null) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | new WebViewDialog().LoadPageWithHtmlStr(mPushNoticeInfo.title, mPushNoticeInfo.content); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通知信息点击事件 |
| | | /// </summary> |
| | | /// <param name="pushMessageInfo"></param> |
| | | void OnClickPushMessageInfo(PushMessageInfo pushMessageInfo) |
| | | { |
| | | |
| | | if (pushMessageInfo.pushType == PushType.Notice.ToString()) |
| | | { |
| | | //Utlis.WriteLine("物业通知"); |
| | | string noticeId = GetNoticeId(pushMessageInfo.messageExpand); |
| | | if (!string.IsNullOrEmpty(noticeId)) |
| | | { |
| | | GetPropertyNoticeDetails(noticeId); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("noticeId null"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("其它通知类型"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解析messageExpand 提取targetId |
| | | /// </summary> |
| | | /// <param name="messageExpand"></param> |
| | | /// <returns></returns> |
| | | string GetNoticeId(string messageExpand) |
| | | { |
| | | try |
| | | { |
| | | if (!string.IsNullOrEmpty(messageExpand)) |
| | | { |
| | | var mMessageExpandInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<MessageExpandInfo>(messageExpand); |
| | | if (mMessageExpandInfo != null) |
| | | { |
| | | var mExpantContentInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<ExpantContentInfo>(mMessageExpandInfo.expantContent); |
| | | if(mExpantContentInfo != null) |
| | | { |
| | | return mExpantContentInfo.targetId; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | catch |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | #region 测试 |
| | | #if DEBUG |
| | | /// <summary> |
| | | /// |
| | |
| | | |
| | | #endif |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 标记所有推送消息已读 |
| | |
| | | /// 消息内容 |
| | | /// </summary> |
| | | public string messageContent; |
| | | ///// <summary> |
| | | ///// 扩展数据 |
| | | ///// </summary> |
| | | //public string messageExpand; |
| | | /// <summary> |
| | | /// 扩展数据 |
| | | /// </summary> |
| | | public string messageExpand; |
| | | ///// <summary> |
| | | ///// 消息类型;0:提示;1:报警;2:丰林可是对讲呼叫;3:强制下线推送 |
| | | ///// </summary> |
| | |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 物业公告详情 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class PushNoticeInfo |
| | | { |
| | | /// <summary> |
| | | /// 消息ID |
| | | /// </summary> |
| | | public string noticeId; |
| | | /// <summary> |
| | | /// 消息标题 |
| | | /// </summary> |
| | | public string title; |
| | | /// <summary> |
| | | /// 富文本内容 |
| | | /// </summary> |
| | | public string content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 推送扩展信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class MessageExpandInfo |
| | | { |
| | | /// <summary> |
| | | /// expantContent |
| | | /// </summary> |
| | | public string expantContent; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 推送扩展信息 |
| | | /// </summary> |
| | | [System.Serializable] |
| | | public class ExpantContentInfo |
| | | { |
| | | /// <summary> |
| | | /// targetId |
| | | /// </summary> |
| | | public string targetId; |
| | | /// <summary> |
| | | /// messageType |
| | | /// </summary> |
| | | public string messageType; |
| | | |
| | | } |
| | | |
| | | |
| | | } |