From 02ef7fd8315dfa7a5d8d3ddc0d04a3d4625dc0b5 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期一, 02 九月 2024 16:56:34 +0800
Subject: [PATCH] 增加面板地暖SPK;增加安卓金茂热水器,光伏储能切图

---
 HDL_ON/Common/HDLCommon.cs |  124 +++++++++++++++++++++++++++++++---------
 1 files changed, 95 insertions(+), 29 deletions(-)

diff --git a/HDL_ON/Common/HDLCommon.cs b/HDL_ON/Common/HDLCommon.cs
index 8ef0a0d..db3372f 100644
--- a/HDL_ON/Common/HDLCommon.cs
+++ b/HDL_ON/Common/HDLCommon.cs
@@ -7,6 +7,10 @@
 using HDL_ON.Entity;
 using System.Threading;
 using HDL_ON.DriverLayer;
+#if __IOS__
+using Other;
+using Shared.IOS.HDLLinphoneSDK;
+#endif
 namespace HDL_ON
 {
     /// <summary>
@@ -258,7 +262,7 @@
         {
             try
             {
-                Console.WriteLine($"鎺ユ敹鍒版帹閫侊紝锛岋紝锛�.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}");
+                //Console.WriteLine($"鎺ユ敹鍒版帹閫侊紝锛岋紝锛�.{Newtonsoft.Json.JsonConvert.SerializeObject(jpushMessageInfo).ToString()}");
 
                 //Extras涓虹┖涓嶅鐞�
                 if (string.IsNullOrEmpty(jpushMessageInfo.Extras)) return;
@@ -305,38 +309,14 @@
                         ESOnVideo.Current.ShowESvideoVideoIntercom(eSVideoInfo, InterphoneType.FLVI.ToString());
 
                     }
-                    else if (jpushMessageInfo.messageType == (PushMessageType.HDL_INTERPHONE.ToString()))
+                    else if (jpushMessageInfo.messageType == PushMessageType.HDL_INTERPHONE.ToString())
                     {
 
                         if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return;
 
                         //瀛楁鍏煎闂锛屽彧鑳界洿鎺ュ彇鍊间簡
                         var json = Newtonsoft.Json.Linq.JObject.Parse(jpushMessageInfo.expantContent);
-                        try
-                        {
-                            //var pushHomeId = json["homeId"];
-                            //if (pushHomeId == null || string.IsNullOrEmpty(pushHomeId.ToString())){
-                            //    Console.WriteLine("homeId is null");
-                            //    return;
-                            //}
-                            var pushTime = json["pushTime"];
-                            if (pushTime == null)
-                            {
-                                //return;
-                            }
-                            else
-                            {
-                                if (!string.IsNullOrEmpty(pushTime.ToString()))
-                                {
-                                    var pushDateTime = Utlis.UnixToDateTimeMS(Convert.ToInt64(pushTime));
-                                    if (pushDateTime.AddSeconds(30) < DateTime.Now)
-                                    {
-                                        return;
-                                    }
-                                }
-                            }
-                        }
-                        catch { }
+                       
 
                         //1.瑙嗗璁插巶瀹剁被鍨�
                         string interphoneTypeEnum = json["interphoneTypeEnum"].ToString();
@@ -375,6 +355,89 @@
                         }
                         else if (interphoneTypeEnum == InterphoneType.HDL.ToString())
                         {
+                            try
+                            {
+                                var pushTime = json["pushTime"];
+                                if (pushTime == null)
+                                {
+                                    return;
+                                }
+                                if (!string.IsNullOrEmpty(pushTime.ToString()))
+                                {
+                                    var pushDateTime = Utlis.UnixToDateTimeMS(Convert.ToInt64(pushTime));
+                                    if (pushDateTime.AddSeconds(30) < DateTime.Now)
+                                    {
+                                        return;
+                                    }
+                                }
+                            }
+                            catch { }
+
+
+
+#if __ANDROID__
+                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime = 30;
+                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(true);
+                            Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.PlayRingtone();
+                            new Thread(() =>
+                            {
+                                try
+                                {
+                                    DateTime dateTime = DateTime.Now;
+                                    while (true)
+                                    {
+                                        Thread.Sleep(1000);
+                                        if (!Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MediaPlayerPlayingStatus || dateTime.AddSeconds(Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.MissedCallsTime) <= DateTime.Now)
+                                        {
+                                            break;
+                                        }
+                                    }
+                                    Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetMediaPlayerLooping(false);
+                                }
+                                catch (Exception ex)
+                                {
+                                    MainPage.Log("error", "鑷爺鍙瀵硅閾冨0鎾斁寮傚父:" + ex.Message);
+                                }
+                            })
+                            { IsBackground = true }.Start();
+
+#elif __IOS__
+                            SoundPlayer.Ins.PlaySound();
+                            new Thread(() => {
+                                int count = 0;
+                                while (true)
+                                {
+                                    if (SoundPlayer.Ins.player == null)
+                                    {
+                                        break;
+                                    }
+                                    if (!SoundPlayer.Ins.player.Playing)
+                                    {
+                                        break;
+                                    }
+                                    System.Threading.Thread.Sleep(1000);
+                                    count++;
+                                    MainPage.Log("linphone 鍛煎彨璁℃椂锛�" + count);
+                                    if (count > 29)
+                                    {
+                                        SoundPlayer.Ins.StopSound();
+                                        Application.RunOnMainThread(() => {
+                                            try
+                                            {
+                                                HDLLinPhoneSDK.Instance().HideIntercomeVC();
+                                            }catch(Exception ex)
+                                            {
+                                                MainPage.Log("error", "ios linphone 鍛煎彨瓒呮椂鍏抽棴鐣岄潰寮傚父锛�" + ex.Message);
+                                            }
+                                        });
+                                        break;
+                                    }
+                                }
+                            })
+                            { IsBackground = true }.Start();
+#endif
+
+
                             //HDL Linphone 鐙勮�愬厠
                             eSVideoInfo.HomeId = jpushMessageInfo.HomeId;
                             eSVideoInfo.callId = json["callId"].ToString();
@@ -382,6 +445,7 @@
                             eSVideoInfo.DeviceName = json["deviceName"].ToString();
                             eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString();
                             eSVideoInfo.spk = json["spk"].ToString();
+
 
                             //ShowAlert("鐙勮�愬厠闂ㄥ彛鏈哄懠鍙�");
                             //鎵撳紑鍛煎彨椤甸潰
@@ -779,7 +843,8 @@
                                         ((BaseActivity)Shared.Application.Activity).SetPermission(result =>
                                         {
                                             //2023骞�03鏈�29鏃�13:08:35 淇敼
-                                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id);
+                                            Com.Videogo.Hdl.HDLEzvizSdk.Instance.Init(Application.Activity.Application, ezChildAccessToken, UserInfo.Current.LoginTokenString, UserInfo.Current.RefreshToken, OnAppConfig.Instance.RequestHttpsHost, "1aa98a90489b4838b966b57018b4b04b", 1, DB_ResidenceData.Instance.CurrentRegion.id,
+                                HttpUtil.APP_KEY, HttpUtil.SECRET_KEY);
                                             Com.Videogo.Hdl.HDLEzvizSdk.Instance.JumpToCameraListActivity(Shared.Application.Activity, list);
                                             //if (result)
                                             //{
@@ -809,7 +874,8 @@
                     }
                     else
                     {
-                        IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
+                        if (result.Code != "-1")
+                            IMessageCommon.Current.ShowErrorInfoAlter(result.Code);
                     }
                 }
                 catch (Exception ex)

--
Gitblit v1.8.0