.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,26 +1,26 @@ <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.08FD445C-3EE8-4ED2-BF28-B42ADD0DA92C" /> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/MainPage.cs"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.08FD445C-3EE8-4ED2-BF28-B42ADD0DA92C" /> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs"> <Files> <File FileName="HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs" Line="36" Column="33" /> <File FileName="HDL_ON/UI/MainPage.cs" /> <File FileName="HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs" Line="173" Column="67" /> <File FileName="HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs" Line="1" Column="1" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> <Node name="DAL" expanded="True" /> <Node name="UI" expanded="True"> <Node name="MainPage.cs" selected="True" /> <Node name="Common" expanded="True" /> <Node name="DAL" expanded="True"> <Node name="ThirdPartySdk" expanded="True"> <Node name="HDLLinphone.cs" selected="True" /> </Node> </Node> <Node name="Entity" expanded="True" /> <Node name="UI" expanded="True" /> </Node> <Node name="HDL-ON_Android" expanded="True"> <Node name="References" expanded="True" /> </Node> <Node name="HDL-ON_iOS" expanded="True"> <Node name="References" expanded="True" /> </Node> <Node name="HDL-ON_Android" expanded="True" /> <Node name="HDL-ON_iOS" expanded="True" /> </Node> </State> </Pad> @@ -31,16 +31,12 @@ <String>Shared.IOS.TBL/Shared.IOS.TBL.csproj</String> <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> <String>Shared.IOS/Shared.IOS.csproj</String> <String>../Linphone/HDLLinphoneSDK_IOS/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK.csproj</String> </DisabledProjects> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore> <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/ON+/HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/Electrical/IrFanPage.cs" line="42" column="1" /> <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/ON+/HDL_ON/Common/ApiUtlis.cs" relfile="HDL_ON/Common/ApiUtlis.cs" line="390" column="1" /> <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/ON+/HDL_ON/DAL/Mqtt/MqttClient.cs" relfile="HDL_ON/DAL/Mqtt/MqttClient.cs" line="422" column="1" /> <Breakpoint file="/Users/jlchen/JLChen/ProjectsCode/HDLGit/ON+/HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" relfile="HDL_ON/UI/UI2/FuntionControlView/EnvironmentalScience/EnvironmentalSensorPage.cs" line="747" column="1" /> </BreakpointStore> <BreakpointStore /> </MonoDevelop.Ide.DebuggingService.Breakpoints> <MultiItemStartupConfigurations /> </Properties> 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
@@ -158,7 +158,7 @@ <HintPath>..\DLL\EZvizMonitor\ys.dll</HintPath> </Reference> <Reference Include="Shared.Droid.HDLLinphone"> <HintPath>..\..\Linphone\HDLLinphoneSDK_Android\Shared.Droid.HDLLinphone\Shared.Droid.HDLLinphone\bin\Release\Shared.Droid.HDLLinphone.dll</HintPath> <HintPath>..\DLL\Linphone\Android\Shared.Droid.HDLLinphone.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> HDL-ON_Android/Resources/Resource.designer.cs
Diff too large HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -101,8 +101,8 @@ <Reference Include="Shared.IOS.LCVideoOnSDK"> <HintPath>..\DLL\LC\IOS\Shared.IOS.LCVideoOnSDK.dll</HintPath> </Reference> <Reference Include="Shared.Droid.HDLLinphone"> <HintPath>..\..\Linphone\HDLLinphoneSDK_Android\Shared.Droid.HDLLinphone\Shared.Droid.HDLLinphone\bin\Release\Shared.Droid.HDLLinphone.dll</HintPath> <Reference Include="Shared.IOS.HDLLinphoneSDK"> <HintPath>..\..\Linphone\HDLLinphoneSDK_IOS\Shared.IOS.HDLLinphoneSDK\Shared.IOS.HDLLinphoneSDK\bin\Release\Shared.IOS.HDLLinphoneSDK.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> @@ -130,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,10 +275,17 @@ if (video.interphoneType == InterphoneType.IMOUVISIAL.ToString()) { UI.UI2.PersonalCenter.PirDevice.PirSend.LcSubAccessToken = video.subAccountToken; } else if (video.interphoneType == InterphoneType.HDL.ToString()) { isInterphoneType_HDL = true; } } } //======================获取Sip账号并且初始化SDK可视对讲设备列表==================== if (isInterphoneType_HDL) { //HDLLinphone可视对讲,获取Sip账号并初始化SDK HDLLinphone.Current.getHDLSipInfoAndInitSDK(DB_ResidenceData.Instance.CurrentRegion.id); } } catch (Exception ex) { HDL_ON/Common/HDLCommon.cs
@@ -328,6 +328,18 @@ 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.打开呼叫页面 if (eSVideoInfo == null) return; HDL_ON/DAL/Server/HttpUtil.cs
@@ -18,8 +18,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
@@ -662,6 +662,10 @@ /// 更改通话状态 /// </summary> public const string API_POST_VideoDevice_UpdateCallStatus = "/home-wisdom/platform/imou/updateCallStatus"; /// <summary> /// 住宅sip账号获取 /// </summary> public const string API_POST_VideoDevice_GetSipAccount = "/home-wisdom/app/home/getSipAccount"; #endregion HDL_ON/DAL/ThirdPartySdk/ESOnVideo.cs
@@ -99,30 +99,59 @@ 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 } @@ -169,7 +198,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 +216,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 +271,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 +817,11 @@ /// 设备序列号 /// </summary> public string DeviceSerial = string.Empty; //========================HDL SIP========================== /// <summary> /// 设备sip账号 interphoneType是HDL时才会有值 /// </summary> public string deviceSipAccount; } @@ -784,6 +861,10 @@ /// 萤石猫眼呼叫 /// </summary> EZVIZ, /// <summary> /// 狄耐克 HDL Linphone /// </summary> HDL, } HDL_ON/DAL/ThirdPartySdk/HDLLinphone.cs
@@ -1,8 +1,17 @@ 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.Content; using Android.Graphics; using Android.Widget; using Com.Hdl.Hdllinphonesdk; #else using Foundation; #endif namespace Shared @@ -32,70 +41,466 @@ } } public void InitLinphone() #region ■ -- 初始化SDK_______________________________ /// <summary> /// 初始化SDK /// </summary> void InitLinphone() { //防止重复初始化 if (isInitSdk) return; isInitSdk = true; #if __IOS__ Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().InitalLinPhone(); #else Com.Hdl.Hdllinphonesdk.Core.EasyLinphone.InitLinphone(Application.Activity); Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.InitLinphone(Application.Activity); setOnHDLLinphoneCallListener(); Com.Hdl.Hdllinphonesdk.Core.EasyLinphone.SetAccountAndLogin("3333", "85521566", "116.62.26.215:5060"); #endif } #if __Android__ /// <summary> /// 当前登录的Sip账号 /// </summary> HDLSipInfo currentHDLSipInfo; /// <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("3333", "85521566", "116.62.26.215:5060"); Shared.IOS.HDLLinphoneSDK.HDLLinPhoneSDK.Instance().Login(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm); #else Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.SetAccountAndLogin(mHDLSipInfo.sipAccount, mHDLSipInfo.sipPasswd, mHDLSipInfo.realm); //Com.Hdl.Hdllinphonesdk.Core.EasyLinphone.SetAccountAndLogin("61723164995710", "8ec02ce0", "47.94.42.230:25060"); #endif class HDLLinphoneCallListener : Java.Lang.Object, Com.Hdl.Hdllinphonesdk.Callback.IOnHDLLinphoneCallListener } #endregion #region ■ -- 动作回调和原生交互,提交记录到云端_______________________________ /// <summary> /// 可视对讲设备参数 /// </summary> public HDLCallVideoInfo mHDLCallVideoInfo; /// <summary> /// 初始化呼叫参数 /// </summary> /// <param name="mHDLCallVideoInfo"></param> /// <param name="mInterphoneType"></param> public void InitCallInfo(HDLCallVideoInfo mHDLCallVideoInfo) { this.mHDLCallVideoInfo = mHDLCallVideoInfo; } /// <summary> /// 判断callId是否为空 /// </summary> /// <returns></returns> bool CheckmHDLCallVideoInfoIsNullOrEmpty() { //return false; 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) { //showToast void showToast(string text) //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); dic.Add("interphoneType", mHDLCallVideoInfo.InterphoneType); dic.Add("homeId", mHDLCallVideoInfo.HomeId); var requestJson = HttpUtil.GetSignRequestJson(dic); var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_VideoDevice_OpenDoorbell, requestJson); Application.RunOnMainThread(() => { #if __IOS__ if (revertObj.Code == StateCode.SUCCESS) { Toast.MakeText(Application.Activity, text, ToastLength.Short).Show(); //和原生监控界面交互、发送开锁成功通知 NSNotificationCenter.DefaultCenter.PostNotificationName("lcCallDelegateOpenDoorSuccess", null); } public void OnAnswerAction() else { showToast("接听"); Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code); } public void OnHangUpAction(int callDuration) { showToast("挂断 通话时长:" + callDuration); } public void OnRejectCallAction() { showToast("拒接"); } public void OnScreenshotSuccessfulAction(Bitmap p0) { showToast("截图"); } public void OnUnlockAction() #else if (revertObj.Code == StateCode.SUCCESS) { HDLLinphoneKit.Instance.OnOpenSuccess(); } } void setOnHDLLinphoneCallListener() { HDLLinphoneKit.Instance.OnHDLLinphoneCallListener = new HDLLinphoneCallListener(); } 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());//可用值:FLVI,IMOUVISIAL 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 ■ -- 获取sip账号_______________________________ /// <summary> /// 是否初始化了SDK /// </summary> public bool isInitSdk; /// <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) { try { //先清空呼叫和监视设备信息 InitCallInfo(null); HDLSipInfo mHDLSipInfo = GetHDLSipInfo(homeId); if (mHDLSipInfo != null) { InitLinphone(); mHDLSipInfo.homeId = homeId; SetAccountAndLogin(mHDLSipInfo); //Application.RunOnMainThread(() => //{ // InitLinphone(); // SetAccountAndLogin(mHDLSipInfo); //}); } } catch { } } #endregion #region ■ -- 跳转监控页面_______________________________ /// <summary> /// 跳转监控页面 /// </summary> /// <param name="mESVideoInfo"></param> public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo) { 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__ #else Com.Hdl.Hdllinphonesdk.HDLLinphoneKit.Instance.CallTo(mHDLCallVideoInfo.DeviceSipAccount, true); 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> /// 跳转呼叫页面 /// </summary> /// <param name="mESVideoInfo"></param> public void ShowESVideoIntercom(ESVideoInfo mESVideoInfo) { 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 __IOS__ #else var intent = new Intent(Shared.Application.Activity, typeof(Com.Hdl.Hdllinphonesdk.Activity.HDLLinphoneIntercomActivity)); ; intent.PutExtra(HDLLinphoneKit.KeyTitleName, mHDLCallVideoInfo.DeviceName); Shared.Application.Activity.StartActivity(intent); #endif } #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(); } public void OnAnswerAction() { showToast("接听"); hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL); } public void OnHangUpAction(int callDuration) { showToast("挂断 通话时长:" + callDuration); hdlLinphone.HDLUpdateCallStatus(CallStatusType.RECEIVED, InterphoneType.HDL, callDuration); } public void OnRejectCallAction() { showToast("拒接"); hdlLinphone.HDLUpdateCallStatus(CallStatusType.REJECT, InterphoneType.HDL); } public void OnScreenshotSuccessfulAction(Bitmap p0) { showToast("截图成功"); } public void OnUnlockAction() { hdlLinphone.HDLUnlockAction(); } } /// <summary> /// 设置原生的Listener监听 /// </summary> void setOnHDLLinphoneCallListener() { HDLLinphoneKit.Instance.OnHDLLinphoneCallListener = new HDLLinphoneCallListener(this); } #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 Username = string.Empty; /// <summary> /// 密码 /// </summary> public string Password = string.Empty; /// <summary> /// Domain /// </summary> public string Domain = 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/UI/MainPage.cs
@@ -159,8 +159,7 @@ //}) //{ IsBackground = true }.Start(); Common.ApiUtlis.Ins.DownloadData(); //初始化Linphone HDLLinphone.Current.InitLinphone(); GoUserPage(false,true); } } 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); }