DLL/Linphone/Android/Shared.Droid.HDLLinphone.dllBinary files differ
DLL/Linphone/iOS/Shared.IOS.HDLLinphoneSDK.dllBinary files differ
HDL-ON_Android/HDL-ON_Android.csproj
@@ -157,6 +157,9 @@ <Reference Include="ys"> <HintPath>..\DLL\EZvizMonitor\ys.dll</HintPath> </Reference> <Reference Include="Shared.Droid.HDLLinphone"> <HintPath>..\DLL\Linphone\Android\Shared.Droid.HDLLinphone.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <Compile Include="MainActivity.cs" /> HDL-ON_Android/Other/JPush/JPushReceiver.cs
@@ -1,5 +1,6 @@ using System; using Android.App; using Android.Content; using CN.Jpush.Android.Api; using CN.Jpush.Android.Service; @@ -70,6 +71,7 @@ { HDLCommon.Current.AdjustPushMessage(pushMes); }); } /// <summary> HDL-ON_Android/Resources/Resource.designer.cs
Diff too large HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -101,6 +101,9 @@ <Reference Include="Shared.IOS.LCVideoOnSDK"> <HintPath>..\DLL\LC\IOS\Shared.IOS.LCVideoOnSDK.dll</HintPath> </Reference> <Reference Include="Shared.IOS.HDLLinphoneSDK"> <HintPath>..\DLL\Linphone\iOS\Shared.IOS.HDLLinphoneSDK.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> <PackageReference Include="Newtonsoft.Json"> @@ -127,6 +130,9 @@ <PackageReference Include="Xamarin.Essentials"> <Version>1.7.0</Version> </PackageReference> <PackageReference Include="Xamarin.Swift"> <Version>1.0.8</Version> </PackageReference> </ItemGroup> <ItemGroup> <ImageAsset Include="Assets.xcassets\add_server1.imageset\add_server1.png" /> HDL-ON_iOS/Info.plist
@@ -42,7 +42,7 @@ <key>LSRequiresIPhoneOS</key> <true/> <key>MinimumOSVersion</key> <string>9.0</string> <string>11.0</string> <key>UIDeviceFamily</key> <array> <integer>1</integer> @@ -119,6 +119,8 @@ </array> <key>UIBackgroundModes</key> <array> <string>audio</string> <string>voip</string> <string>remote-notification</string> </array> <key>NSFaceIDUsageDescription</key> @@ -129,5 +131,7 @@ <string>This application uses Bluetooth to communicate with the device, this application does not collect, store or record any data that communicates via Bluetooth.</string> <key>NSBluetoothAlwaysUsageDescription</key> <string>This application uses Bluetooth to communicate with the device, this application does not collect, store or record any data that communicates via Bluetooth.</string> <key>NSVoIPUsageDescription</key> <string>Make audio/video calls</string> </dict> </plist> HDL_ON/Common/ApiUtlis.cs
@@ -263,6 +263,7 @@ //} //======================获取可视对讲设备列表==================== bool isInterphoneType_HDL = false;//是否为HDLLinphone可视对讲 var videoInfo= VideoSend.GetVideoInfoList(); if (videoInfo.Code == StateCode.SUCCESS) { @@ -274,6 +275,8 @@ if (video.interphoneType == InterphoneType.IMOUVISIAL.ToString()) { UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken = video.subAccountToken; } else if (video.interphoneType == InterphoneType.HDL.ToString()) { isInterphoneType_HDL = true; } else if(video.interphoneType == InterphoneType.HDL.ToString()) { @@ -288,6 +291,23 @@ GetSecurityList(); //======================SIP账号==================== //======================获取Sip账号并且初始化SDK可视对讲设备列表==================== //如果检测线程没启动,才继续下面操作 因为App有可能刚启动马上收到推送了,然后才执行到这里 if (HDLLinphone.Current.CheckIncomingCallThreadIsNull()) { //当前住宅是HDL可视对讲类型的设备 if (isInterphoneType_HDL) { //HDLLinphone可视对讲,获取Sip账号并初始化SDK HDLLinphone.Current.GetHDLSipInfoAndInitSDK(DB_ResidenceData.Instance.CurrentRegion.id); } else { Utlis.WriteLine("当前住宅不支持HDL可视对讲,退出登录所有账号"); //当前住宅不支持HDL可视对讲 HDLLinphone.Current.LogoutAllAccount(); } } } catch (Exception ex) { HDL_ON/Common/HDLCommon.cs
@@ -307,7 +307,6 @@ //1.视对讲厂家类型 string interphoneTypeEnum = json["interphoneTypeEnum"].ToString(); if (string.IsNullOrEmpty(interphoneTypeEnum)) return; // ESVideoInfo eSVideoInfo = new ESVideoInfo();// GetESOnVideoJson(jpushMessageInfo.expantContent); //2.根据可视对讲厂家类型,处理不同的数据 if (interphoneTypeEnum == InterphoneType.IMOUVISIAL.ToString()) @@ -327,6 +326,19 @@ eSVideoInfo.Lc_AccessToken = json["subToken"].ToString();//"子账号token eSVideoInfo.DeviceSerial = json["devSerial"].ToString();//设备序列号 eSVideoInfo.HomeId = jpushMessageInfo.HomeId; } else if (interphoneTypeEnum == InterphoneType.HDL.ToString()) { //HDL Linphone 狄耐克 eSVideoInfo.HomeId = jpushMessageInfo.HomeId; eSVideoInfo.callId = json["callId"].ToString(); eSVideoInfo.Lc_DeviceId = json["deviceId"].ToString(); eSVideoInfo.DeviceName = json["deviceName"].ToString(); eSVideoInfo.deviceSipAccount = json["deviceSipAccount"].ToString(); //ShowAlert("狄耐克门口机呼叫"); //打开呼叫页面 HDLLinphone.Current.ShowESVideoIntercom(eSVideoInfo); return; } //3.打开呼叫页面 @@ -424,6 +436,8 @@ UserInfo.Current.LastTime = DateTime.MinValue; UserInfo.Current.SaveUserInfo(); DB_ResidenceData.Instance.EixtAccount(); //4.注销HDLSIP账号登录 2021-08-20 HDLLinphone.Current.LogoutAllAccount(); } catch (Exception ex) { HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@ /// 固定域名,正式环境 /// 公共域名就近解析 /// </summary> public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm /// <summary> /// RegionMark /// </summary> HDL_ON/DAL/Server/NewAPI.cs
@@ -675,6 +675,9 @@ /// 获取住户详情 /// </summary> public const string Api_Post_GetCustomerInfo = "/basis-footstone/app/customer/detail"; /// 住宅sip账号获取 /// </summary> public const string API_POST_VideoDevice_GetSipAccount = "/home-wisdom/app/home/getSipAccount"; #endregion HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs
@@ -71,6 +71,7 @@ { //乐橙可视对讲 //1.初始化LCOpenSDK_Api LCApiKit.SharedInstance().IsChinaMainland = OnAppConfig.Instance.RequestHttpsHost.Contains("china");//如果域名包含china,则SDK 使用乐橙的中国大陆(正式)域名 LCApiKit.SharedInstance().InitSDKOpenApi(mESVideoInfo.Lc_AccessToken); LCApiKit.SharedInstance().CurrentDevicePlayToken = mESVideoInfo.Lc_PlayToken; LCApiKit.SharedInstance().CurrentDeviceId = mESVideoInfo.Lc_DeviceId; @@ -83,7 +84,7 @@ //vc.MLCCallDelegate = new OnLCCallDelegate(this); Shared.Application.currentVC.NavigationController.PushViewController(vc, true); } else else if(interphoneType == InterphoneType.FLVI.ToString()) { ESOnMonitorViewController vc = new ESOnMonitorViewController(); @@ -93,36 +94,73 @@ //vc.RoomName = mESVideoInfo.RoomName; //vc.MESCallDelegate = new OnESCallDelegate(this); Shared.Application.currentVC.NavigationController.PushViewController(vc, true); }else if (interphoneType == InterphoneType.HDL.ToString()) { //HDLLinphone 狄耐克 HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo); } else { HDLUtils.WriteLine("未对接,不支持监视"); } #else Intent intent = null; if (interphoneType == InterphoneType.IMOUVISIAL.ToString()) { intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.LeChengVideoActivity)); intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID); intent.PutExtra("uuid", mESVideoInfo.uuid); intent.PutExtra("DeviceName", mESVideoInfo.DeviceName); intent.PutExtra("cmtID", mESVideoInfo.cmtID); intent.PutExtra("roomno", mESVideoInfo.roomno); intent.PutExtra("unitno", mESVideoInfo.unitno); intent.PutExtra("HomeID", PirSend.HomeId); intent.PutExtra("callId", mESVideoInfo.callId); intent.PutExtra("Type", 0); //=========乐橙========== intent.PutExtra("AccessToken", mESVideoInfo.Lc_AccessToken); intent.PutExtra("DeviceId", mESVideoInfo.Lc_DeviceId); intent.PutExtra("Location", OnAppConfig.Instance.RequestHttpsHost.Contains("china") ? 0 : 1);//如果域名包含china,则是国内账号); intent.PutExtra("PlayToken", mESVideoInfo.Lc_PlayToken); intent.PutExtra("Psk", mESVideoInfo.Lc_Psk); Shared.Application.Activity.StartActivity(intent); } else if (interphoneType == InterphoneType.FLVI.ToString()) { intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity)); intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID); intent.PutExtra("uuid", mESVideoInfo.uuid); intent.PutExtra("DeviceName", mESVideoInfo.DeviceName); intent.PutExtra("cmtID", mESVideoInfo.cmtID); intent.PutExtra("roomno", mESVideoInfo.roomno); intent.PutExtra("unitno", mESVideoInfo.unitno); intent.PutExtra("HomeID", PirSend.HomeId); intent.PutExtra("callId", mESVideoInfo.callId); intent.PutExtra("Type", 0); //=========乐橙========== intent.PutExtra("AccessToken", mESVideoInfo.Lc_AccessToken); intent.PutExtra("DeviceId", mESVideoInfo.Lc_DeviceId); intent.PutExtra("Location", OnAppConfig.Instance.RequestHttpsHost.Contains("china") ? 0 : 1);//如果域名包含china,则是国内账号); intent.PutExtra("PlayToken", mESVideoInfo.Lc_PlayToken); intent.PutExtra("Psk", mESVideoInfo.Lc_Psk); Shared.Application.Activity.StartActivity(intent); } else if (interphoneType == InterphoneType.HDL.ToString()) { //HDLLinphone 狄耐克 HDLLinphone.Current.ShowESVideoMonitor(mESVideoInfo); } else { intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity)); HDLUtils.WriteLine("未对接,不支持监视"); } intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID); intent.PutExtra("uuid", mESVideoInfo.uuid); intent.PutExtra("DeviceName", mESVideoInfo.DeviceName); intent.PutExtra("cmtID", mESVideoInfo.cmtID); intent.PutExtra("roomno", mESVideoInfo.roomno); intent.PutExtra("unitno", mESVideoInfo.unitno); intent.PutExtra("HomeID", PirSend.HomeId); intent.PutExtra("callId", mESVideoInfo.callId); intent.PutExtra("Type", 0); //=========乐橙========== intent.PutExtra("AccessToken", mESVideoInfo.Lc_AccessToken); intent.PutExtra("DeviceId", mESVideoInfo.Lc_DeviceId); intent.PutExtra("Location", OnAppConfig.Instance.RequestHttpsHost.Contains("China") ? 0 : 1);//如果域名包含china,则是国内账号); intent.PutExtra("PlayToken", mESVideoInfo.Lc_PlayToken); intent.PutExtra("Psk", mESVideoInfo.Lc_Psk); Shared.Application.Activity.StartActivity(intent); #endif } @@ -141,6 +179,7 @@ { //乐橙可视对讲 //1.初始化LCOpenSDK_Api LCApiKit.SharedInstance().IsChinaMainland = OnAppConfig.Instance.RequestHttpsHost.Contains("china");//如果域名包含china,则SDK 使用乐橙的中国大陆(正式)域名 LCApiKit.SharedInstance().InitSDKOpenApi(mESVideoInfo.Lc_AccessToken); //2021-05-18 目前推送的PlayToken;有问题会导致SDK崩溃,暂时不传 //LCApiKit.SharedInstance().CurrentDevicePlayToken = mESVideoInfo.Lc_PlayToken; @@ -169,7 +208,13 @@ EZSDK.IOS.EZSDK.SharedInstance().PlayWithDeviceSerial(mESVideoInfo.DeviceSerial); } else else if (interphoneType == InterphoneType.HDL.ToString()) { //HDL Linphone 狄耐克 } else if (interphoneType == InterphoneType.FLVI.ToString()) { ESOnIntercomViewController vc = new ESOnIntercomViewController(); @@ -181,14 +226,37 @@ mOnESCallDelegate = new OnESCallDelegate(this); vc.MESCallDelegate = mOnESCallDelegate; Shared.Application.currentVC.NavigationController.PushViewController(vc, true); }else{ HDLUtils.WriteLine("未支持的可视对讲类型"); } #else #region #region Android 处理 Intent intent = null; if (interphoneType == InterphoneType.IMOUVISIAL.ToString()) { //待删减不必要参数 intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.LeChengVideoActivity)); intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID); intent.PutExtra("uuid", mESVideoInfo.uuid); intent.PutExtra("DeviceName", mESVideoInfo.DeviceName); intent.PutExtra("cmtID", mESVideoInfo.cmtID); intent.PutExtra("roomno", mESVideoInfo.roomno); intent.PutExtra("unitno", mESVideoInfo.unitno); intent.PutExtra("HomeID", PirSend.HomeId); intent.PutExtra("callId", mESVideoInfo.callId); intent.PutExtra("Type", 1); //=========乐橙========== intent.PutExtra("AccessToken", mESVideoInfo.Lc_AccessToken); intent.PutExtra("DeviceId", mESVideoInfo.Lc_DeviceId); intent.PutExtra("Location", OnAppConfig.Instance.RequestHttpsHost.Contains("china") ? 0 : 1);//如果域名包含china,则是国内账号); intent.PutExtra("PlayToken", mESVideoInfo.Lc_PlayToken); intent.PutExtra("Psk", mESVideoInfo.Lc_Psk); Shared.Application.Activity.StartActivity(intent); } else if (interphoneType == InterphoneType.EZVIZ.ToString()) { @@ -213,29 +281,45 @@ }); return; } else if (interphoneType == InterphoneType.HDL.ToString()) { //HDL Linphone 狄耐克 } else if (interphoneType == InterphoneType.FLVI.ToString()) { //待删减不必要参数 intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity)); intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID); intent.PutExtra("uuid", mESVideoInfo.uuid); intent.PutExtra("DeviceName", mESVideoInfo.DeviceName); intent.PutExtra("cmtID", mESVideoInfo.cmtID); intent.PutExtra("roomno", mESVideoInfo.roomno); intent.PutExtra("unitno", mESVideoInfo.unitno); intent.PutExtra("HomeID", PirSend.HomeId); intent.PutExtra("callId", mESVideoInfo.callId); intent.PutExtra("Type", 1); //=========乐橙========== intent.PutExtra("AccessToken", mESVideoInfo.Lc_AccessToken); intent.PutExtra("DeviceId", mESVideoInfo.Lc_DeviceId); intent.PutExtra("Location", OnAppConfig.Instance.RequestHttpsHost.Contains("china") ? 0 : 1);//如果域名包含china,则是国内账号); intent.PutExtra("PlayToken", mESVideoInfo.Lc_PlayToken); intent.PutExtra("Psk", mESVideoInfo.Lc_Psk); Shared.Application.Activity.StartActivity(intent); } else { intent = new Intent(Shared.Application.Activity, typeof(HDL_ON_Android.VideoActivity)); HDLUtils.WriteLine("未支持的可视对讲类型"); } intent.PutExtra("ESVideoUUID", mESVideoInfo.ESVideoUUID); intent.PutExtra("uuid", mESVideoInfo.uuid); intent.PutExtra("DeviceName", mESVideoInfo.DeviceName); intent.PutExtra("cmtID", mESVideoInfo.cmtID); intent.PutExtra("roomno", mESVideoInfo.roomno); intent.PutExtra("unitno", mESVideoInfo.unitno); intent.PutExtra("HomeID", PirSend.HomeId); intent.PutExtra("callId", mESVideoInfo.callId); intent.PutExtra("Type", 1); //=========乐橙========== intent.PutExtra("AccessToken", mESVideoInfo.Lc_AccessToken); intent.PutExtra("DeviceId", mESVideoInfo.Lc_DeviceId); intent.PutExtra("Location", OnAppConfig.Instance.RequestHttpsHost.Contains("China") ? 0 : 1);//如果域名包含china,则是国内账号); intent.PutExtra("PlayToken", mESVideoInfo.Lc_PlayToken); intent.PutExtra("Psk", mESVideoInfo.Lc_Psk); Shared.Application.Activity.StartActivity(intent); #endregion #endif @@ -743,8 +827,11 @@ /// 设备序列号 /// </summary> public string DeviceSerial = string.Empty; //========================HDL SIP========================== /// <summary> /// 设备sip账号 interphoneType是HDL时才会有值 /// </summary> public string deviceSipAccount; } @@ -785,7 +872,7 @@ /// </summary> EZVIZ, /// <summary> /// /// 狄耐克 HDL Linphone /// </summary> HDL, HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
New file @@ -0,0 +1,847 @@ using System; using System.Collections.Generic; using System.Threading; using HDL_ON; using HDL_ON.DAL.Server; using HDL_ON.Entity; #if __Android__ using Android.App; using Android.Content; using Android.Graphics; using Android.Widget; using Com.Hdl.Hdllinphonesdk; #else using Foundation; using UIKit; using Shared.IOS.HDLLinphoneSDK; #endif namespace Shared { /// <summary> /// 目前是每个住宅对应一个SIP账号,切换住宅需要重新获取SIP账号 /// </summary> public class HDLLinphone { /// <summary> /// /// </summary> public HDLLinphone() { } /// <summary> /// /// </summary> private static HDLLinphone m_Current = null; /// <summary> /// /// </summary> public static HDLLinphone Current { get { if (m_Current == null) { m_Current = new HDLLinphone(); } return m_Current; } } /// <summary> /// 当前住宅是否支持可视对讲 /// </summary> public bool IsEnable = false; /// <summary> /// 是否自动跳转呼叫页面, /// false:收到推送并且已经收到sip呼叫才跳转呼叫页面 /// true:原生收到呼叫马上跳转呼叫页面,不等待推送过来 /// </summary> bool IsAutoJumpCallView = false; /// <summary> /// 是否初始化了SDK /// </summary> bool IsInitSdk; /// <summary> /// 当前登录的Sip账号 /// </summary> HDLSipInfo currentHDLSipInfo; /// <summary> /// 可视对讲设备参数 /// </summary> HDLCallVideoInfo mHDLCallVideoInfo; #region ■ -- 初始化SDK_______________________________ /// <summary> /// 初始化SDK /// </summary> void InitLinphone() { //防止重复初始化 if (IsInitSdk) return; IsInitSdk = true; #if __IOS__ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().InitalLinPhone(); //设置收到来电后、是否需自动跳转呼叫页面方案 Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().IsAutoJumpCallView = IsAutoJumpCallView; //设置Listener监听 mOnHDLLinphoneCallDelegate = new OnHDLLinphoneCallDelegate(this); Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().HdlLinphoneCallDelegate = mOnHDLLinphoneCallDelegate; #else HDLLinphoneKit.Instance.InitLinphone(Application.Activity); //设置收到来电后、是否需自动跳转呼叫页面方案 HDLLinphoneKit.Instance.AutoJumpCallView = IsAutoJumpCallView; //设置Listener监听 setOnHDLLinphoneCallListener(); #endif } /// <summary> /// 设置sip登录账号 /// </summary> /// <param name="mHDLSipInfo"></param> public void SetAccountAndLogin(HDLSipInfo mHDLSipInfo) { this.currentHDLSipInfo = mHDLSipInfo; if (mHDLSipInfo == null) return; #if __IOS__ //Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login("6666", "85521566", "116.62.26.215:5060"); Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm); #else HDLLinphoneKit.Instance.SetAccountAndLogin(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm); #endif } /// <summary> /// 注销所有账号 /// </summary> public void LogoutAllAccount() { //没初始化过则返回 if (!IsInitSdk) return; this.currentHDLSipInfo = null; this.mHDLCallVideoInfo = null; #if __IOS__ HDLLinPhoneSDK.Instance().LogoutAllLinphoneUser(); #else HDLLinphoneKit.Instance.Logout(); #endif } /// <summary> /// 清除配置表 /// </summary> public void ClearProxyConfig() { #if __IOS__ HDLLinPhoneSDK.Instance().ClearAllConfigs(); #else HDLLinphoneKit.Instance.ClearProxyConfig(); #endif } #endregion #region ■ -- 获取sip账号_______________________________ /// <summary> /// 获取当前住宅的SIP账号 /// </summary> public HDLSipInfo GetHDLSipInfo(string homeId) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", homeId); var requestJson = HttpUtil.GetSignRequestJson(d); var resultObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_GetSipAccount, requestJson); if (resultObj.Code == StateCode.SUCCESS) { if (string.IsNullOrEmpty(resultObj.Data.ToString())) { //控的话代表当前住宅不支持 return null; } else { var info = Newtonsoft.Json.JsonConvert.DeserializeObject<HDLSipInfo>(resultObj.Data.ToString()); return info; } } else { return null; } } /// <summary> /// 请求服务器获取当前住宅Sip账号信息并初始化LinphoneSDK和登录 /// </summary> /// <param name="homeId"></param> public void GetHDLSipInfoAndInitSDK(string homeId, bool clearCallInfo = true) { try { //先清空呼叫和监视设备信息 if (clearCallInfo) { InitCallInfo(null); } HDLSipInfo mHDLSipInfo = GetHDLSipInfo(homeId); if (mHDLSipInfo != null) { Application.RunOnMainThread(() => { InitLinphone(); mHDLSipInfo.homeId = homeId; SetAccountAndLogin(mHDLSipInfo); Utlis.WriteLine("CALL 获取SIP账号成功:" + mHDLSipInfo.sipAccount); }); } } catch { } } #endregion #region ■ -- 动作回调和原生交互,提交记录到云端_______________________________ /// <summary> /// 初始化呼叫参数 /// </summary> /// <param name="mHDLCallVideoInfo"></param> /// <param name="mInterphoneType"></param> void InitCallInfo(HDLCallVideoInfo mHDLCallVideoInfo) { this.mHDLCallVideoInfo = mHDLCallVideoInfo; } /// <summary> /// 判断callId是否为空 /// </summary> /// <returns></returns> bool CheckmHDLCallVideoInfoIsNullOrEmpty() { return (mHDLCallVideoInfo == null || string.IsNullOrEmpty(mHDLCallVideoInfo.CallId)); } /// <summary> /// 截图成功 暂时废弃 /// </summary> public void ScreenshotSuccessfulAction(byte[] dataBytes) { //Utlis.WriteLine("ScreenshotSuccessfulAction"); if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return; new Thread(() => { //var imageName = Guid.NewGuid().ToString(); Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("callId", mHDLCallVideoInfo.CallId); dic.Add("images", dataBytes); #if __IOS__ dic.Add("imagesName", "_IOS.jpg"); #else dic.Add("imagesName", "_Android.jpg"); #endif var requestJson = HttpUtil.GetSignRequestJson(dic); var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Screenshot, requestJson); if (revertObj.Code == StateCode.SUCCESS) { //Utlis.WriteLine("POST 截图上传成功"); } else { Utlis.WriteLine("POST 截图上传失败 code: " + revertObj.Code); } }) { IsBackground = false }.Start(); } //DateTime UnlockDateTime = DateTime.MinValue; #endregion #region ■ -- 新接听和开锁接口_______________________________ /// <summary> /// 开锁 /// </summary> public void HDLUnlockAction() { //Utlis.WriteLine("UnlockAction"); if (mHDLCallVideoInfo == null) return; new Thread(() => { Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("deviceId", mHDLCallVideoInfo.DeviceId);//设备id dic.Add("callId", mHDLCallVideoInfo.CallId);//当前呼叫id dic.Add("interphoneType", mHDLCallVideoInfo.InterphoneType);//可视对讲厂家类型 dic.Add("homeId", mHDLCallVideoInfo.HomeId);//住宅ID var requestJson = HttpUtil.GetSignRequestJson(dic); var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_OpenDoorbell, requestJson); Application.RunOnMainThread(() => { #if __IOS__ if (revertObj.Code == StateCode.SUCCESS) { //和原生监控界面交互、发送开锁成功通知 NSNotificationCenter.DefaultCenter.PostNotificationName("lcCallDelegateOpenDoorSuccess", null); } else { Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code); } #else if (revertObj.Code == StateCode.SUCCESS) { HDLLinphoneKit.Instance.OnOpenSuccess(); } else { Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code); HDLLinphoneKit.Instance.OnOpenError(revertObj.message); } #endif }); }) { IsBackground = false }.Start(); } /// <summary> /// 更改通话状态 /// </summary> public void HDLUpdateCallStatus(CallStatusType callStatusType, InterphoneType interphoneType, int callDuration = 0) { if (CheckmHDLCallVideoInfoIsNullOrEmpty()) return; new Thread(() => { Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("callId", mHDLCallVideoInfo.CallId);//呼叫id dic.Add("callStatus", callStatusType.ToString());//可用值:MISSED,RECEIVED,REJECT dic.Add("interphoneTypeEnum", interphoneType.ToString()); if (callStatusType == CallStatusType.RECEIVED && callDuration > 0) { dic.Add("callDuration", callDuration);//通话时长(秒) } var requestJson = HttpUtil.GetSignRequestJson(dic); var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_UpdateCallStatus, requestJson); if (revertObj.Code == StateCode.SUCCESS) { } else { Utlis.WriteLine("POST 更新状态失败 code: " + revertObj.Code); } }) { IsBackground = false }.Start(); } #endregion #region ■ -- 跳转监控页面_______________________________ /// <summary> /// 跳转监控页面 /// </summary> /// <param name="mESVideoInfo"></param> public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo) { InitLinphone(); //sip账号为空 if (string.IsNullOrEmpty(mESVideoInfo.deviceSipAccount)) { HDLCommon.Current.ShowAlert(Language.StringByID(StringId.shebeibucunzai)); return; } HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo(); mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId; mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId; mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName; mHDLCallVideoInfo.InterphoneType = InterphoneType.HDL.ToString(); mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount;//监视主动呼叫门口机时用到 InitCallInfo(mHDLCallVideoInfo); #if __IOS__ HDLLinPhoneSDK.Instance().CallWithUserName(mHDLCallVideoInfo.DeviceSipAccount, mHDLCallVideoInfo.DeviceName); #else //1.先呼叫设备 Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.CallTo(mHDLCallVideoInfo.DeviceSipAccount, true); //2.跳转打开监控页面 var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneMonitorActivity)); ; intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName);//传入设备名称为显示标题 Shared.Application.Activity.StartActivity(intent); #endif } #endregion #region ■ -- 跳转呼叫页面_______________________________ /// <summary> /// 收到推送,后判断呼叫住宅是否为当前住宅,不是的话重新获取SIP账号并登录 /// </summary> /// <param name="mESVideoInfo"></param> public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo) { InitLinphone(); HDLCallVideoInfo mHDLCallVideoInfo = new HDLCallVideoInfo(); mHDLCallVideoInfo.CallId = mESVideoInfo.callId; mHDLCallVideoInfo.HomeId = mESVideoInfo.HomeId; mHDLCallVideoInfo.DeviceId = mESVideoInfo.Lc_DeviceId; mHDLCallVideoInfo.DeviceName = mESVideoInfo.DeviceName; mHDLCallVideoInfo.InterphoneType = InterphoneType.HDL.ToString(); mHDLCallVideoInfo.DeviceSipAccount = mESVideoInfo.deviceSipAccount; InitCallInfo(mHDLCallVideoInfo); //当前呼叫来电的住宅和之前注册登录的住宅一致的情况下 if (currentHDLSipInfo != null && currentHDLSipInfo.homeId == mESVideoInfo.HomeId) { Utlis.WriteLine("CALL 收到推送 推送住宅和之前注册登录的住宅一致"); CheckCallStateAndGotoPage(); } else { //注意:之前没登录SIP账号或者住宅不一致的情况下需要重新获取SIP账号 //获取呼叫住宅的SIP账号并登录 Utlis.WriteLine("CALL 收到推送 其他住宅,重新获取呼叫住宅的SIP账号并登录"); new Thread(() => { GetHDLSipInfoAndInitSDK(mESVideoInfo.HomeId, false); }) { IsBackground = false }.Start(); // CheckCallStateAndGotoPage(); } } /// <summary> /// 检测来电状态,判断是否马上打开呼叫页面,如果还没来电则开启线程检测等待 /// </summary> /// <param name="mESVideoInfo"></param> public void CheckCallStateAndGotoPage() { //如果开启了自动跳转方案,则无需继续下面处理、无需手动跳转 if (IsAutoJumpCallView) return; //先结束掉之前的线程 EndCheckIncomingCallThread(); //检测是否来电了如果是直接调整呼叫页面如果不是则开启线程等待判断 if (IsIncomingReceivedCallState()) { Utlis.WriteLine("CALL 已经来电了。。。打开呼叫页面"); GoToHDLLinphoneIntercomActivity(); } else { //如果还没来电 开启线程检测 StartCheckIncomingCallThread(); } } /// <summary> /// 是否来电状态 /// </summary> /// <returns></returns> bool IsIncomingReceivedCallState() { #if __IOS__ return HDLLinPhoneSDK.Instance().IsIncomingReceivedCallState; #else return HDLLinphoneKit.Instance.IsIncomingReceivedCallState; #endif } /// <summary> /// 跳转打开原生的呼叫页面 /// </summary> void GoToHDLLinphoneIntercomActivity() { #if __IOS__ HDLLinPhoneSDK.Instance().GotoHDLLinphoneIntercomVC(mHDLCallVideoInfo.DeviceName); #else var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity)); if (mHDLCallVideoInfo != null) { intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName); } Shared.Application.Activity.StartActivity(intent); #endif } /// <summary> /// 检测来电线程 /// </summary> Thread checkIncomingCallThread = null; /// <summary> /// 检测线程持续时间 /// </summary> const int MAX_THREAD_TIME = 30; /// <summary> /// 线程结束 /// </summary> int threadTime = MAX_THREAD_TIME; /// <summary> /// 开启检测来电线程 /// </summary> void StartCheckIncomingCallThread() { try { Utlis.WriteLine("CALL 还没来电,开启线程"); threadTime = MAX_THREAD_TIME; //结束之前的线程 EndCheckIncomingCallThread(); //新建线程 checkIncomingCallThread = new Thread(() => { try { //15S后自动结束线程 while (threadTime > 0) { threadTime--; Utlis.WriteLine("CALL 检测中...." + threadTime); Thread.Sleep(1000); //来电了,跳转呼叫页面 if (IsIncomingReceivedCallState()) { Utlis.WriteLine("CALL 来电了。。。打开呼叫页面"); threadTime = 0;//跳出循环,关闭线程 Application.RunOnMainThread(() => { GoToHDLLinphoneIntercomActivity(); }); } } } catch { } }); //开启线程 checkIncomingCallThread.Start(); } catch { } } /// <summary> /// 结束线程 /// </summary> void EndCheckIncomingCallThread() { if (checkIncomingCallThread != null) { try { checkIncomingCallThread.Interrupt(); } catch { } checkIncomingCallThread = null; Utlis.WriteLine("CALL 先结束线程"); } } /// <summary> /// 判断线程是否启动了 /// </summary> /// <returns></returns> public bool CheckIncomingCallThreadIsNull() { return checkIncomingCallThread == null || checkIncomingCallThread.ThreadState != ThreadState.Running; } #endregion #region ■ -- Android相关操作_______________________________ #if __Android__ /// <summary> /// 接听、挂断、开锁等动作监听处理 /// </summary> private class HDLLinphoneCallListener : Java.Lang.Object, Com.Hdl.Hdllinphonesdk.Callback.IOnHDLLinphoneCallListener { [Weak] HDLLinphone hdlLinphone; public HDLLinphoneCallListener(HDLLinphone mHDLLinphone) { hdlLinphone = mHDLLinphone; } //showToast void showToast(string text) { Toast.MakeText(Application.Activity, text, ToastLength.Short).Show(); } /// <summary> /// 接听事件 /// </summary> public void OnAnswerAction() { //showToast("接听"); hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL); } /// <summary> /// 挂断事件 /// </summary> /// <param name="callDuration"></param> public void OnHangUpAction(int callDuration) { //showToast("挂断 通话时长:" + callDuration); hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration); } /// <summary> /// 拒接事件 /// </summary> public void OnRejectCallAction() { //showToast("拒接"); hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); } /// <summary> /// 截图成功事件 /// </summary> /// <param name="p0"></param> public void OnScreenshotSuccessfulAction(Bitmap imgBitmap) { //showToast("截图成功"); } /// <summary> /// 开锁事件 /// </summary> public void OnUnlockAction() { hdlLinphone.HDLUnlockAction(); } /// <summary> /// 来电事件 /// </summary> /// <param name="userName"></param> public void OnIncomingCall(string userName) { Utlis.WriteLine("OnIncomingCall :" + userName); } } /// <summary> /// 设置原生的Listener监听 /// </summary> void setOnHDLLinphoneCallListener() { HDLLinphoneKit.Instance.OnHDLLinphoneCallListener = new HDLLinphoneCallListener(this); } /// <summary> /// 清楚通知栏所有通知 /// </summary> void CancelAllNotification() { NotificationManager nMgr = (NotificationManager)Application.Activity.GetSystemService(Context.NotificationService); nMgr.CancelAll(); } #endif #endregion #region ■ -- iOS相关操作_______________________________ #if __IOS__ #region OnHDLLinphoneCallDelegate /// <summary> /// /// </summary> OnHDLLinphoneCallDelegate mOnHDLLinphoneCallDelegate; /// <summary> /// /// </summary> public class OnHDLLinphoneCallDelegate : HDLLinphoneCallDelegate { [Weak] HDLLinphone hdlLinphone; public OnHDLLinphoneCallDelegate(HDLLinphone mHDLLinphone) { this.hdlLinphone = mHDLLinphone; } /// <summary> /// 接听 /// </summary> public override void OnAnswerAction() { hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL); } /// <summary> /// 挂断 /// </summary> /// <param name="callDuration"></param> public override void OnHangUpAction(int callDuration) { hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration); } /// <summary> /// 拒接 /// </summary> public override void OnRejectCallAction() { hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); } /// <summary> /// 截图成功 /// </summary> /// <param name="image"></param> public override void OnScreenshotSuccessfulAction(UIImage image) { ////NSData imageData = UIImagePNGRepresentation(image); UIImage //NSData imageData = image.AsPNG(); //byte[] dataBytes = new byte[imageData.Length]; //System.Runtime.InteropServices.Marshal.Copy(imageData.Bytes, dataBytes, 0, Convert.ToInt32(imageData.Length)); ////image.g ////hdlLinphone.ScreenshotSuccessfulAction(dataBytes); } /// <summary> /// 开锁成功 /// </summary> public override void OnUnlockAction() { hdlLinphone.HDLUnlockAction(); } /// <summary> /// 来电中... /// </summary> public override void OnIncomingCall(string userName) { Utlis.WriteLine("OnIncomingCall :" + userName); } } #endregion #endif #endregion } /// <summary> /// SIP可视对讲参数 /// </summary> public class HDLCallVideoInfo { /// <summary> /// 设备序列号,通讯必要字段 /// </summary> public string DeviceId = string.Empty; /// <summary> /// 设备名称 /// </summary> public string DeviceName = string.Empty; /// <summary> /// 设备Sip账号 /// </summary> public string DeviceSipAccount = string.Empty; /// <summary> /// 呼叫记录Id /// </summary> public string CallId = string.Empty; /// <summary> /// 住宅Id /// </summary> public string HomeId = string.Empty; /// <summary> /// 类型 /// </summary> public string InterphoneType; } /// <summary> /// SIP账号相关信息 /// </summary> public class HDLSipInfo { /// <summary> /// Sip服务器 /// </summary> public string proxy { get; set; } /// <summary> /// 设备域 /// </summary> public string realm { get; set; } /// <summary> /// sip账号 /// </summary> public string sipAccount { get; set; } /// <summary> /// sipPasswd sip密码 /// </summary> public string sipPasswd { get; set; } /// <summary> /// 住宅ID /// </summary> public string homeId; } } HDL_ON/HDL_ON.projitems
@@ -483,6 +483,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\FaceManagement\FaceSettingResultPage.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\FaceManagement\CustomerObj.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Security.cs" /> <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\HDLLinphone.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" /> HDL_ON/UI/MainPage.cs
@@ -161,7 +161,7 @@ //}) //{ IsBackground = true }.Start(); Common.ApiUtlis.Ins.DownloadData(); GoUserPage(false,true); } } @@ -197,7 +197,7 @@ /// <param name="isFirstOpen">如果是第一次启动 检测校验密码</param> /// <param name="pageShowEvent">主页显示之后触发的事件(没有住宅的话,则不会触发)</param> public static void GoUserPage(bool downloadData , bool isFirstOpen = false, Action pageShowEvent = null) { { BaseView.RemoveAll(); #region 后退事件 BasePageView = new PageLayout(); HDL_ON/UI/UI2/FuntionControlView/Video/ObjectClass.cs
@@ -155,6 +155,14 @@ /// 丰林可视对讲data /// </summary> public VideoFlData flRoomBindVO = new VideoFlData(); /// <summary> /// 设备sip账号 interphoneType是HDL时才会有值 /// </summary> public string deviceSipAccount; /// <summary> /// homeId /// </summary> public string homeId; } /// <summary> HDL_ON/UI/UI2/FuntionControlView/Video/VideoMainView.cs
@@ -300,12 +300,14 @@ DeviceName = video.deviceName, roomno = video.flRoomBindVO.flRoomId, unitno = video.flRoomBindVO.flBuildingId, uuid= getUuid(video.deviceId), cmtID=video.flRoomBindVO.flCmtId, uuid = getUuid(video.deviceId), cmtID = video.flRoomBindVO.flCmtId, Lc_AccessToken = video.subAccountToken, Lc_DeviceId = video.deviceId, Lc_Psk = video.deviceName, Lc_PlayToken = video.playToken, deviceSipAccount = video.deviceSipAccount, HomeId = video.homeId }; ESOnVideo.Current.ShowESVideoMonitor(eSVideoInfo, video.interphoneType); }