Merge remote-tracking branch 'origin/temp-wxr' into dev-tzy
35个文件已添加
19个文件已删除
39个文件已修改
| | |
| | | <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.94B44E9C-E1BC-4BF7-812E-FC71E9B623B2" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Control_Udp.cs"> |
| | | <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget." /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/DAL/DriverLayer/Control.cs"> |
| | | <Files> |
| | | <File FileName="HDL-ON_iOS/Info.plist" /> |
| | | <File FileName="HDL_ON/UI/MainPage.cs" Line="19" Column="44" /> |
| | | <File FileName="HDL_ON/Entity/Enumerative/Command.cs" Line="1864" Column="28" /> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Control_Udp.cs" Line="303" Column="15" /> |
| | | <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" Line="195" Column="50" /> |
| | | <File FileName="HDL_ON/Entity/DB_ResidenceData.cs" Line="95" Column="58" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/ClassificationPage.cs" Line="556" Column="96" /> |
| | | <File FileName="../../../../Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets" Line="1912" Column="3" /> |
| | | <File FileName="HDL_ON/DAL/Server/HttpServerRequest.cs" Line="1" Column="1" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PersonalCenterPageBLL.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage_AddIrButton.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" /> |
| | | <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" /> |
| | | <File FileName="HDL_ON/DAL/Server/HttpServerRequest.cs" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/1ContorlPage/AcControlPage.cs" /> |
| | | <File FileName="HDL_ON/DAL/DriverLayer/Control.cs" Line="404" Column="11" /> |
| | | <File FileName="HDL_ON/UI/UI2/1-HomePage/HomePage.cs" /> |
| | | <File FileName="HDL_ON/Entity/FunctionList.cs" /> |
| | | <File FileName="HDL_ON/UI/UI1-Login/LoginPage.cs" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="DriverLayer" expanded="True"> |
| | | <Node name="Control_Udp.cs" selected="True" /> |
| | | <Node name="Control.cs" selected="True" /> |
| | | </Node> |
| | | <Node name="Server" expanded="True" /> |
| | | <Node name="Mqtt" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True" /> |
| | | </Node> |
| | | <Node name="HDL-ON_Android" expanded="True"> |
| | | <Node name="Properties" expanded="True" /> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="UI1-Login" expanded="True" /> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="1-HomePage" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | <Node name="HDL-ON_iOS" expanded="True" /> |
| | | </Node> |
| | |
| | | <String>Shared.Droid.TouchID/Shared.Droid.TouchID.csproj</String> |
| | | <String>Shared.IOS/Shared.IOS.csproj</String> |
| | | </DisabledProjects> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Release" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.SelectDevice" /> |
| | | <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.364c4b3158493098" /> |
| | | <MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <BreakpointStore /> |
| | | </MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | |
| | | 437=设备列表 |
| | | 438=湿度:{0}% 空气:{1} 风速:{2}级 |
| | | |
| | | |
| | | 1000=室内湿度 |
| | | 1001=童锁 |
| | | 1002=负离子 |
New file |
| | |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using Android.App; |
| | | using Android.Content; |
| | | using Android.Icu.Text; |
| | | using Android.OS; |
| | | using Android.Runtime; |
| | | using Android.Util; |
| | | using Android.Views; |
| | | using Android.Widget; |
| | | using Com.ETouchSky; |
| | | using Com.Tool; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON_Android.FengLinVideo.Interface; |
| | | using Java.Util; |
| | | using Org.Json; |
| | | |
| | | namespace HDL_ON_Android.FengLinVideo.Form |
| | | { |
| | | public class MonitorFragment : Fragment, View.IOnClickListener, VideoState |
| | | { |
| | | |
| | | private View mView; |
| | | private VideoPhone mPhone; |
| | | |
| | | // 截图 |
| | | private LinearLayout screenshotLayout; |
| | | private ImageView screenImage; |
| | | private TextView ScreenText; |
| | | |
| | | //开锁 |
| | | private LinearLayout unlockLayout; |
| | | private ImageView unlockImag; |
| | | private TextView unlockText; |
| | | |
| | | // 更新线程 |
| | | private Thread thread = null; |
| | | |
| | | public MonitorFragment(VideoPhone phone) |
| | | { |
| | | this.mPhone = phone; |
| | | } |
| | | |
| | | public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) |
| | | { |
| | | mView = inflater.Inflate(Resource.Layout.fragment_monitor, container, false); |
| | | |
| | | IniView(); |
| | | |
| | | return mView; |
| | | } |
| | | |
| | | private void IniView() |
| | | { |
| | | screenshotLayout = (LinearLayout)mView.FindViewById(Resource.Id.icon_sceenshotLayout); |
| | | screenImage = (ImageView)mView.FindViewById(Resource.Id.icon_sceenshotImg); |
| | | ScreenText = (TextView)mView.FindViewById(Resource.Id.icon_sceenshotText); |
| | | |
| | | unlockLayout = (LinearLayout)mView.FindViewById(Resource.Id.icon_unlockLayout); |
| | | unlockImag = (ImageView)mView.FindViewById(Resource.Id.icon_unlockImg); |
| | | unlockText = (TextView)mView.FindViewById(Resource.Id.icon_unlockText); |
| | | |
| | | unlockLayout.SetOnClickListener(this); |
| | | screenshotLayout.SetOnClickListener(this); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开锁 |
| | | /// </summary> |
| | | private void Unlock() |
| | | { |
| | | if (mPhone != null) |
| | | { |
| | | try |
| | | { |
| | | unlockImag.Selected = true; |
| | | JSONObject ht = new JSONObject(); |
| | | ht.Put("command", "open");//固定参数 |
| | | ht.Put("room_id", 123); |
| | | ht.Put("devType", 7); |
| | | mPhone.SendCustomData(ht.ToString()); |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新开锁按钮状态 |
| | | /// </summary> |
| | | private void UpdataUnlockState() |
| | | { |
| | | try |
| | | { |
| | | //开锁成功,15秒内不给再点击按钮 |
| | | unlockLayout.Enabled = false; |
| | | if (thread != null) |
| | | { |
| | | try |
| | | { |
| | | thread.Interrupt(); |
| | | } |
| | | catch { } |
| | | thread = null; |
| | | } |
| | | |
| | | thread = new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Thread.Sleep(15 * 1000); |
| | | |
| | | Activity.RunOnUiThread(() => |
| | | { |
| | | if (unlockLayout != null) |
| | | unlockLayout.Enabled = true; |
| | | }); |
| | | } |
| | | catch { } |
| | | }); |
| | | |
| | | thread.Start(); |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | public void OnClick(View v) |
| | | { |
| | | // |
| | | if (v.Equals(unlockLayout)) |
| | | { |
| | | if (mPhone != null) |
| | | Unlock(); |
| | | } |
| | | else if (v.Equals(screenshotLayout)) |
| | | { |
| | | |
| | | //有视频过来可调用此接口进行拍照 |
| | | if (mPhone != null) |
| | | { |
| | | // 内部储存/DCIM/Camera/.....jpg |
| | | screenImage.Selected = true; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | string time = format.Format(new Date(SystemClock.CurrentThreadTimeMillis())); |
| | | string ss = Android.OS.Environment.ExternalStorageDirectory.Path + "/DCIM/Camera"; |
| | | string path = ss + "/" + time + ".jpg"; |
| | | mPhone.Snap(path); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通话状态回调方法 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | public void OnPhoneEvent(string msg) |
| | | { |
| | | try |
| | | { |
| | | // |
| | | TextProtocol tp = new TextProtocol(); |
| | | tp.Parse(msg); |
| | | string event1 = tp.GetString("event"); |
| | | |
| | | switch (event1) |
| | | { |
| | | case "EVT_HangUp"://挂断 |
| | | Activity.Finish(); |
| | | break; |
| | | case "EVT_RECV_CUSTOM_DATA": |
| | | UpdataUnlockState(); |
| | | break; |
| | | case "EVT_SnapAck": |
| | | int error = tp.GetInt("error"); |
| | | string filePath = tp.GetString("filePath"); |
| | | if (error == 0) |
| | | { |
| | | screenImage.Selected = true; |
| | | } |
| | | else |
| | | { |
| | | screenImage.Selected = false; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | public override void OnDestroy() |
| | | { |
| | | base.OnDestroy(); |
| | | |
| | | if (thread != null) |
| | | { |
| | | try |
| | | { |
| | | thread.Interrupt(); |
| | | } |
| | | catch { } |
| | | thread = null; |
| | | } |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading; |
| | | using Android.App; |
| | | using Android.Content; |
| | | using Android.Icu.Text; |
| | | using Android.OS; |
| | | using Android.Runtime; |
| | | using Android.Util; |
| | | using Android.Views; |
| | | using Android.Widget; |
| | | using Com.ETouchSky; |
| | | using Com.Tool; |
| | | using HDL_ON.Common; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON_Android.FengLinVideo.Interface; |
| | | using Java.Util; |
| | | using Org.Json; |
| | | |
| | | namespace HDL_ON_Android.FengLinVideo.Form |
| | | { |
| | | public class ReverseCallFragment : Fragment, View.IOnClickListener, VideoState |
| | | { |
| | | private VideoPhone mPhone; |
| | | private string param = ""; |
| | | private bool isCalling = false; |
| | | |
| | | private View mView; |
| | | |
| | | private ImageView screenshotImg;// 截图 |
| | | private ImageView unlockImg;// 开锁 |
| | | private LinearLayout answerLayout; // 接听 |
| | | private ImageView hangupImg; // 接听 |
| | | private ImageView answerImg;// 挂断 |
| | | private TextView hangupText; |
| | | |
| | | private TextView tvTip; |
| | | |
| | | private System.Threading.Timer timer = null; |
| | | private int Time = 0; |
| | | |
| | | public ReverseCallFragment(VideoPhone _phone, string _param) |
| | | { |
| | | this.mPhone = _phone; |
| | | this.param = _param; |
| | | } |
| | | |
| | | public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) |
| | | { |
| | | mView = inflater.Inflate(Resource.Layout.fragment_call, container, false); |
| | | |
| | | IniView(); |
| | | ReverseCall(param); |
| | | |
| | | return mView; |
| | | } |
| | | |
| | | private void IniView() |
| | | { |
| | | screenshotImg = (ImageView)mView.FindViewById(Resource.Id.callScreenshotImg);// |
| | | unlockImg = (ImageView)mView.FindViewById(Resource.Id.callUnlockImg);// |
| | | tvTip = (TextView)mView.FindViewById(Resource.Id.callTipText); |
| | | answerLayout = (LinearLayout)mView.FindViewById(Resource.Id.callAnswerLayout); |
| | | hangupImg = (ImageView)mView.FindViewById(Resource.Id.callHangupImg); |
| | | answerImg = (ImageView)mView.FindViewById(Resource.Id.callAnswerImg); |
| | | hangupText = (TextView)mView.FindViewById(Resource.Id.callHangupText); |
| | | |
| | | screenshotImg.SetOnClickListener(this); |
| | | unlockImg.SetOnClickListener(this); |
| | | hangupImg.SetOnClickListener(this); |
| | | answerImg.SetOnClickListener(this); |
| | | |
| | | hangupText.SetText(GetString(Resource.String.video_not_answer), null); |
| | | tvTip.SetText(GetString(Resource.String.calling), null); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 一般是推送过的来电信息时调用此接口打开视频窗口。然后可调用mPhone.acceptRing(param);接收来电信息 |
| | | /// </summary> |
| | | /// <param name="param"></param> |
| | | private void ReverseCall(string param) |
| | | { |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.ReverseCall(param); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开锁 |
| | | /// </summary> |
| | | private void Unlock() |
| | | { |
| | | //开锁,当收到来电信息时可进行开锁操作 |
| | | if (mPhone != null) |
| | | { |
| | | try |
| | | { |
| | | unlockImg.Selected = true; |
| | | JSONObject ht = new JSONObject(); |
| | | ht.Put("command", "open");//固定参数 |
| | | ht.Put("room_id", 123); //动态参数 ,传递开门的房间号。这个开门口记录就能记录谁开的门 |
| | | ht.Put("devType", 7); //固定参数 |
| | | mPhone.SendCustomData(ht.ToString()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string erro = e.Message; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新开锁按钮状态,开锁成功,15秒内不给再点击按钮 |
| | | /// </summary> |
| | | private void UpdataUnlockState() |
| | | { |
| | | try |
| | | { |
| | | if (unlockImg == null) return; |
| | | |
| | | unlockImg.Enabled = false; |
| | | |
| | | new Thread(() => |
| | | { |
| | | Thread.Sleep(15 * 1000); |
| | | Activity.RunOnUiThread(() => |
| | | { |
| | | if (unlockImg != null) |
| | | unlockImg.Enabled = true; |
| | | }); |
| | | }).Start(); |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | private string GetTime(int time) |
| | | { |
| | | |
| | | int m = time / 60; |
| | | int s = time % 60; |
| | | |
| | | return UnitFormat(m) + ":" + UnitFormat(s); |
| | | |
| | | } |
| | | |
| | | private static string UnitFormat(int i) |
| | | { |
| | | string retStr = null; |
| | | if (i >= 0 && i < 10) |
| | | retStr = "0" + i; |
| | | else |
| | | retStr = "" + i; |
| | | return retStr; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通话记录计时器,从拉流成功开始计算时间 |
| | | /// </summary> |
| | | private void TimeStarts() |
| | | { |
| | | try |
| | | { |
| | | if (timer != null) |
| | | timer.Dispose(); |
| | | |
| | | TimerCallback timerCallback = new TimerCallback(Tick); |
| | | timer = new System.Threading.Timer(timerCallback, null, 0, 1000); |
| | | |
| | | } |
| | | catch (Exception) { } |
| | | } |
| | | |
| | | private void TimeEnd() |
| | | { |
| | | Time = 0; |
| | | |
| | | if (timer != null) |
| | | { |
| | | timer.Dispose(); |
| | | timer = null; |
| | | } |
| | | } |
| | | |
| | | public void Tick(Object state) |
| | | { |
| | | try |
| | | { |
| | | Activity.RunOnUiThread(() => |
| | | { |
| | | try |
| | | { |
| | | Time++; |
| | | if (tvTip != null) |
| | | tvTip.SetText(GetTime(Time), null); |
| | | } |
| | | catch { } |
| | | }); |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通话消息回调方法 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | public void OnPhoneEvent(string msg) |
| | | { |
| | | try |
| | | { |
| | | // |
| | | TextProtocol tp = new TextProtocol(); |
| | | tp.Parse(msg); |
| | | string event1 = tp.GetString("event"); |
| | | |
| | | switch (event1) |
| | | { |
| | | case "EVT_RECV_CUSTOM_DATA": |
| | | string data = tp.GetString("data"); |
| | | UpdataUnlockState(); |
| | | break; |
| | | case "EVT_StartStream":// 拉流成功,开始记录通话时间 |
| | | isCalling = true; |
| | | TimeStarts(); |
| | | hangupText.SetText(GetString(Resource.String.video_hang_up), null); |
| | | break; |
| | | case "EVT_StopStream": |
| | | if (isCalling == false) |
| | | PostReject();// 拒接 |
| | | else |
| | | PostHangup();// 正常挂断 |
| | | break; |
| | | case "EVT_SnapAck": |
| | | int error = tp.GetInt("error"); |
| | | string filePath = tp.GetString("filePath"); |
| | | if (error == 0) |
| | | { |
| | | screenshotImg.Selected = true; |
| | | PostScreenshot(filePath); |
| | | } |
| | | else |
| | | { |
| | | screenshotImg.Selected = false; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string error = e.Message; |
| | | } |
| | | } |
| | | |
| | | public void OnClick(View v) |
| | | { |
| | | if (v.Equals(answerImg)) |
| | | { |
| | | //接收来电 |
| | | if (mPhone != null) |
| | | { |
| | | if (mPhone.IsRinging) |
| | | { |
| | | string UserData = "user text"; |
| | | //注意:RequestAudio 请求对方音频,RequestVideo请求对方视频 SendAudio发送本地音频 SendVideo 发送本地视频 一般门口不接收到视频,所以最好设置0,减少流量消耗 |
| | | string param = string.Format("RequestAudio=1\r\n" + "RequestVideo=1\r\n" + "SendAudio=1\r\n" + "SendVideo=0r\n" + "UserData=%s\r\n", UserData); |
| | | mPhone.AcceptRing(param); |
| | | answerLayout.Visibility = ViewStates.Gone; |
| | | PostAnswer(); |
| | | } |
| | | } |
| | | } |
| | | else if (v.Equals(hangupImg)) |
| | | { |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.HangUp(); |
| | | TimeEnd(); |
| | | } |
| | | Activity.Finish(); |
| | | } |
| | | else if (v.Equals(screenshotImg)) |
| | | { |
| | | //有视频过来可调用此接口进行拍照 |
| | | if (mPhone != null) |
| | | { |
| | | // 内部储存/DCIM/Camera/.....jpg |
| | | screenshotImg.Selected = true; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | string time = format.Format(new Date(SystemClock.CurrentThreadTimeMillis())); |
| | | string ss = Android.OS.Environment.ExternalStorageDirectory.Path + "/DCIM/Camera"; |
| | | string path = ss + "/" + time + ".jpg"; |
| | | mPhone.Snap(path); |
| | | } |
| | | } |
| | | else if (v.Equals(unlockImg)) |
| | | { |
| | | Unlock(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// post 截图 |
| | | /// </summary> |
| | | /// <param name="path">截图保留的路径</param> |
| | | private void PostScreenshot(string path) |
| | | { |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | string[] str = path.Split("/"); |
| | | string img_name = str.GetValue(str.Length - 1).ToString().Replace(".jpg", ""); |
| | | byte[] images = FileUtlis.Files.ReadFileForPath(path); |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("callId", VideoActivity.CallId); |
| | | d.Add("images", images); |
| | | d.Add("imagesName", img_name); |
| | | string jsonString = HttpUtil.GetSignRequestJson(d); |
| | | |
| | | string url = "/home-wisdom/app/fl/vi/screenshot"; |
| | | ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString); |
| | | Log.Info("FengLinVideo", "Post Screenshot Response code=" + response.Code); |
| | | } |
| | | catch { } |
| | | |
| | | }).Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// post 接听电话记录 |
| | | /// </summary> |
| | | private void PostAnswer() |
| | | { |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("uuid", VideoActivity.UUId);//丰林请求的唯一id string |
| | | d.Add("cmtID", VideoActivity.CmtID);//丰林社区id string |
| | | d.Add("roomno", VideoActivity.Roomno);//丰林房间号 string |
| | | d.Add("unitno", VideoActivity.Unitno);//丰林楼栋号 string |
| | | d.Add("HomeID", VideoActivity.HomeID);//丰林住宅id string |
| | | d.Add("callId", VideoActivity.CallId);//呼叫记录id int |
| | | string jsonString = HttpUtil.GetSignRequestJson(d); |
| | | |
| | | string url = "/home-wisdom/app/fl/vi/answer"; |
| | | ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString); |
| | | Log.Info("FengLinVideo", "Post Answer Response code=" + response.Code); |
| | | } |
| | | catch { } |
| | | |
| | | }).Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// post 挂断电话记录 |
| | | /// </summary> |
| | | private void PostHangup() |
| | | { |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("callId", VideoActivity.CallId);//呼叫记录id int |
| | | d.Add("callDuration", Time);//通话时长(秒) int |
| | | string jsonString = HttpUtil.GetSignRequestJson(d); |
| | | |
| | | string url = "/home-wisdom/app/fl/vi/hang-up"; |
| | | ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString); |
| | | Log.Info("FengLinVideo", "Post Hangup Response code=" + response.Code); |
| | | } |
| | | catch { } |
| | | |
| | | }).Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// post 拒接记录 |
| | | /// </summary> |
| | | private void PostReject() |
| | | { |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("callId", VideoActivity.CallId);//呼叫记录id int |
| | | string jsonString = HttpUtil.GetSignRequestJson(d); |
| | | |
| | | string url = "/home-wisdom/app/fl/vi/reject"; |
| | | ResponsePackNew response = HttpUtil.RequestHttpsPost(url, jsonString); |
| | | Log.Info("FengLinVideo", "Post Reject Response code=" + response.Code); |
| | | } |
| | | catch { } |
| | | |
| | | }).Start(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | namespace HDL_ON_Android.FengLinVideo.Interface |
| | | { |
| | | public interface VideoState |
| | | { |
| | | void OnPhoneEvent(string msg); |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using Android.App; |
| | | using Android.Content; |
| | | using Android.Graphics; |
| | | using Android.Views; |
| | | using Android.Widget; |
| | | using HDL_ON_Android; |
| | | |
| | | namespace GateWay.Droid.FengLinVideo.widget |
| | | { |
| | | public class TipDiaglog : Dialog, View.IOnClickListener, View.IOnTouchListener |
| | | { |
| | | private Context mContext = null; |
| | | |
| | | private string titleText = "提示"; |
| | | private string contentText = ""; |
| | | private string confirmText = "确认"; |
| | | private bool isClose = false; |
| | | |
| | | private TextView contentView = null; |
| | | private TextView titleView = null; |
| | | private TextView okView = null; |
| | | public object Tag = null; |
| | | private OnConfirmClickListener onConfirmClickListener; |
| | | |
| | | public TipDiaglog(Context context) : base(context, Resource.Style.DialogTheme) |
| | | { |
| | | this.mContext = context; |
| | | } |
| | | |
| | | public void SetAutoClose(bool bol)
|
| | | { |
| | | this.isClose = bol; |
| | | } |
| | | |
| | | public void SetTitleText(string _titleText) |
| | | { |
| | | titleText = _titleText; |
| | | if (titleView != null) |
| | | { |
| | | titleView.SetText(titleText, null); |
| | | } |
| | | } |
| | | |
| | | public void SetContentText(string _contentText) |
| | | { |
| | | contentText = _contentText; |
| | | if (contentView != null) |
| | | { |
| | | contentView.SetText(contentText, null); |
| | | } |
| | | } |
| | | |
| | | public void SetConfirmText(string text) |
| | | { |
| | | confirmText = text; |
| | | if (okView != null) |
| | | { |
| | | okView.SetText(confirmText, null); |
| | | } |
| | | } |
| | | |
| | | public override void Create() |
| | | { |
| | | base.Create(); |
| | | |
| | | try |
| | | { |
| | | SetContentView(Resource.Layout.dialog_tip); |
| | | |
| | | contentView = (TextView)FindViewById(Resource.Id.tv_content); |
| | | titleView = (TextView)FindViewById(Resource.Id.tv_title); |
| | | okView = (TextView)FindViewById(Resource.Id.tv_ok); |
| | | |
| | | contentView.SetText(contentText, null); |
| | | titleView.SetText(titleText, null); |
| | | okView.SetText(confirmText, null); |
| | | |
| | | okView.SetOnTouchListener(this); |
| | | okView.SetOnClickListener(this); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string error = e.Message; |
| | | } |
| | | } |
| | | |
| | | public override void OnWindowFocusChanged(bool hasFocus) |
| | | { |
| | | base.OnWindowFocusChanged(hasFocus); |
| | | |
| | | try |
| | | { |
| | | Display display = ((Activity)mContext).WindowManager.DefaultDisplay; |
| | | |
| | | WindowManagerLayoutParams p = Window.Attributes; |
| | | Point point = new Point(); |
| | | display.GetSize(point); |
| | | p.Width = (int)(point.X * 0.7); |
| | | Window.SetGravity(GravityFlags.Center); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string ss = e.Message; |
| | | } |
| | | } |
| | | |
| | | public void SetConfirmClickListener(OnConfirmClickListener l) |
| | | { |
| | | onConfirmClickListener = l; |
| | | } |
| | | |
| | | public void OnClick(View v) |
| | | { |
| | | if (v.Equals(okView)) |
| | | { |
| | | if (onConfirmClickListener != null) |
| | | onConfirmClickListener.onSureClick(this, v, isClose); |
| | | } |
| | | } |
| | | |
| | | public bool OnTouch(View v, MotionEvent e) |
| | | { |
| | | if (e.Action == MotionEventActions.Down) |
| | | { |
| | | v.SetBackgroundResource(Resource.Drawable.sure_background_sel); |
| | | } |
| | | else if (e.Action == MotionEventActions.Up) |
| | | { |
| | | v.SetBackgroundResource(Resource.Drawable.sure_background_def); |
| | | } |
| | | |
| | | return false; |
| | | |
| | | } |
| | | |
| | | public interface OnConfirmClickListener |
| | | { |
| | | void onSureClick(TipDiaglog dialoog, View v,bool bol); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | <Reference Include="AndriodBluetoothLibrary"> |
| | | <HintPath>..\DLL\Android\AndriodBluetoothLibrary.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="cloudp2p"> |
| | | <HintPath>..\DLL\FL\Android\cloudp2p.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="corelooper"> |
| | | <HintPath>..\DLL\FL\Android\corelooper.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="crypt"> |
| | | <HintPath>..\DLL\FL\Android\crypt.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="http"> |
| | | <HintPath>..\DLL\FL\Android\http.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="VideoLibs"> |
| | | <HintPath>..\DLL\FL\Android\VideoLibs.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="videophone"> |
| | | <HintPath>..\DLL\FL\Android\videophone.dll</HintPath> |
| | | </Reference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Compile Include="MainActivity.cs" /> |
| | |
| | | <Compile Include="Other\JLCountrycode.cs" /> |
| | | <Compile Include="Other\JPush\JPushReceiver.cs" /> |
| | | <Compile Include="Other\JPush\JPushService.cs" /> |
| | | <Compile Include="VideoActivity.cs" /> |
| | | <Compile Include="FengLinVideo\Interface\VideoState.cs" /> |
| | | <Compile Include="FengLinVideo\Form\MonitorFragment.cs" /> |
| | | <Compile Include="FengLinVideo\Form\ReverseCallFragment.cs" /> |
| | | <Compile Include="FengLinVideo\widget\TipDiaglog.cs" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <None Include="Resources\AboutResources.txt" /> |
| | |
| | | <Generator> |
| | | </Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\answer.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\back_icon.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\dialog_background.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\hangup.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\mic.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\screenshot_def.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\screenshot_sel.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\screenshot.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\sure_background_def.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\sure_background_sel.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\tip_background.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\unlock_def.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\unlock_sel.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\unlock.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\drawable\video_background.png"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\activity_video_phone.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\dialog_tip.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\fragment_call.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\layout\fragment_monitor.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | <AndroidResource Include="Resources\values-zh\strings.xml"> |
| | | <SubType></SubType> |
| | | <Generator></Generator> |
| | | </AndroidResource> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Folder Include="Resources\drawable\" /> |
| | |
| | | <PackageReference Include="Bugly"> |
| | | <Version>4.3.1</Version> |
| | | </PackageReference> |
| | | <PackageReference Include="Xamarin.Android.Support.Constraint.Layout"> |
| | | <Version>1.1.0</Version> |
| | | </PackageReference> |
| | | <PackageReference Include="Xamarin.Android.Support.Constraint.Layout.Solver"> |
| | | <Version>1.1.0</Version> |
| | | </PackageReference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidAsset Include="Assets\Language.ini" /> |
| | |
| | | if (jpushExpandData != null && jpushExpandData.messageType != null) |
| | | { |
| | | pushMes.messageType = jpushExpandData.messageType; |
| | | pushMes.expantContent = jpushExpandData.expantContent; |
| | | Utlis.WriteLine("PushMes messageType : " + pushMes.messageType); |
| | | } |
| | | |
| | | Utlis.WriteLine("PushMes title : " + pushMes.Title); |
| | | Utlis.WriteLine("PushMes message : " + pushMes.Content); |
| | | Utlis.WriteLine("PushMes extras : " + pushMes.Extras); |
| | | |
| | | HDLCommon.Current.AdjustPushMessage(pushMes); |
| | | Shared.Application.RunOnMainThread(() => |
| | | { |
| | | HDLCommon.Current.AdjustPushMessage(pushMes); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | if (jpushExpandData != null && jpushExpandData.messageType != null) |
| | | { |
| | | pushMes.messageType = jpushExpandData.messageType; |
| | | pushMes.expantContent = jpushExpandData.expantContent; |
| | | Utlis.WriteLine("PushMes messageType : " + pushMes.messageType); |
| | | } |
| | | |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103251" android:versionName="1.1.202103251" package="com.hdl.onpro"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="202103262" android:versionName="1.1.202103262" package="com.hdl.onpro"> |
| | | <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="26" /> |
| | | <!-- 定位权限--> |
| | | <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | |
| | | <item> |
| | | <shape> |
| | | <corners android:radius="20dp" /> |
| | | <solid android:color="#FFFFFF" /> |
| | | </shape> |
| | | </item> |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <item android:drawable="@drawable/screenshot_sel" android:state_selected="true" /> |
| | | <item android:drawable="@drawable/screenshot_sel" android:state_pressed="true" /> |
| | | <item android:drawable="@drawable/screenshot_def" /> |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > |
| | | |
| | | <item> |
| | | <shape android:shape="rectangle"> |
| | | <solid android:color="#ffffff" /> |
| | | <corners android:bottomLeftRadius="20dp" android:bottomRightRadius="20dp"/> |
| | | </shape> |
| | | </item> |
| | | |
| | | </layer-list> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > |
| | | |
| | | <item> |
| | | <shape android:shape="rectangle"> |
| | | <solid android:color="#66000000" /> |
| | | <corners android:bottomLeftRadius="20dp" android:bottomRightRadius="20dp"/> |
| | | </shape> |
| | | </item> |
| | | |
| | | </layer-list> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > |
| | | |
| | | <item> |
| | | <shape android:shape="rectangle"> |
| | | <solid android:color="#66000000" /> |
| | | <corners android:radius="20dp"/> |
| | | <padding android:left="20dp" android:right="20dp" android:bottom="8dp" android:top="8dp"/> |
| | | </shape> |
| | | </item> |
| | | |
| | | </layer-list> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <selector xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <item android:drawable="@drawable/unlock_sel" android:state_selected="true" /> |
| | | <item android:drawable="@drawable/unlock_sel" android:state_pressed="true" /> |
| | | <item android:drawable="@drawable/unlock_def" /> |
| | | </selector> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <LinearLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:background="#FFFFFF" |
| | | android:orientation="vertical"> |
| | | |
| | | <RelativeLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="44dp"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/videoBackImg" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="20dp" |
| | | android:layout_marginLeft="10dp" |
| | | android:layout_centerVertical="true" |
| | | android:contentDescription="@string/video_icon" |
| | | android:src="@drawable/back_icon"/> |
| | | |
| | | <TextView |
| | | android:id="@+id/nameText" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:textColor="@color/colorBlack" |
| | | android:layout_gravity="center_horizontal" |
| | | android:textSize="@dimen/tipTitleTextSize" |
| | | android:layout_centerInParent="true" |
| | | android:text="@string/video_device"/> |
| | | </RelativeLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="210" |
| | | android:orientation="vertical" |
| | | android:background="@drawable/video_background"> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/locaVideo" |
| | | android:layout_width="1px" |
| | | android:layout_height="1px" |
| | | android:visibility="invisible"/> |
| | | |
| | | <FrameLayout |
| | | android:id="@+id/remoteFrame" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"/> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="0dp" |
| | | android:layout_weight="393" |
| | | android:orientation="vertical"> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="horizontal"/> |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <LinearLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:orientation="vertical" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:background="@drawable/dialog_background"> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_title" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:textColor="@color/color_default" |
| | | android:textSize="@dimen/tipTitleTextSize" |
| | | android:gravity="center" |
| | | android:layout_marginTop="24dp" |
| | | android:layout_marginBottom="12dp" |
| | | android:fontFamily="sans-serif-black" |
| | | android:text="@string/video_tip"/> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_content" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:textSize="13sp" |
| | | android:gravity="center" |
| | | android:textColor="@color/color_default" |
| | | android:text="@string/video_hang_up"/> |
| | | |
| | | <View |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1px" |
| | | android:layout_marginTop="24dp" |
| | | android:background="@color/color_disable"/> |
| | | |
| | | <TextView |
| | | android:id="@+id/tv_ok" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:paddingTop="13dp" |
| | | android:paddingBottom="13dp" |
| | | android:gravity="center" |
| | | android:fontFamily="sans-serif-medium" |
| | | android:textSize="16sp" |
| | | android:textColor="#2175d8" |
| | | android:background="@drawable/sure_background_def" |
| | | android:text="@string/video_confirm"/> |
| | | </LinearLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <RelativeLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginLeft="30dp" |
| | | android:layout_marginRight="30dp" |
| | | android:orientation="horizontal"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:layout_weight="1"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/callScreenshotImg" |
| | | android:layout_width="40dp" |
| | | android:layout_height="40dp" |
| | | android:adjustViewBounds="true" |
| | | android:scaleType="centerInside" |
| | | android:layout_marginTop="16dp" |
| | | android:layout_marginBottom="16dp" |
| | | android:layout_marginLeft="13dp" |
| | | android:layout_marginRight="13dp" |
| | | android:contentDescription="@string/video_screenshot" |
| | | android:src="@drawable/screenshot"/> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:layout_weight="1"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/callUnlockImg" |
| | | android:layout_width="40dp" |
| | | android:layout_height="40dp" |
| | | android:adjustViewBounds="true" |
| | | android:scaleType="centerInside" |
| | | android:layout_marginTop="16dp" |
| | | android:layout_marginBottom="16dp" |
| | | android:layout_marginLeft="13dp" |
| | | android:layout_marginRight="13dp" |
| | | android:contentDescription="@string/video_unlock" |
| | | android:src="@drawable/unlock"/> |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="1dp" |
| | | android:layout_marginTop="72dp" |
| | | android:background="#806D798D"/> |
| | | |
| | | <TextView |
| | | android:id="@+id/callTipText" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:textColor="@android:color/white" |
| | | android:textSize="@dimen/tipTextSize" |
| | | android:background="@drawable/tip_background" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_marginTop="110dp"/> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginStart="30dp" |
| | | android:layout_marginEnd="30dp" |
| | | android:layout_below="@id/callTipText" |
| | | android:layout_marginTop="103dp" |
| | | android:orientation="horizontal"> |
| | | |
| | | <LinearLayout |
| | | |
| | | android:layout_width="66dp" |
| | | android:layout_weight="1" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:orientation="vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/callHangupImg" |
| | | android:layout_width="66dp" |
| | | android:layout_height="66dp" |
| | | android:adjustViewBounds="true" |
| | | android:contentDescription="@string/video_not_answer" |
| | | android:scaleType="centerInside" |
| | | android:src="@drawable/hangup"/> |
| | | |
| | | <TextView |
| | | android:id="@+id/callHangupText" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="@string/video_not_answer"/> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/callAnswerLayout" |
| | | android:layout_width="66dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:orientation="vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/callAnswerImg" |
| | | android:layout_width="66dp" |
| | | android:layout_height="66dp" |
| | | android:adjustViewBounds="true" |
| | | android:contentDescription="@string/video_answer" |
| | | android:scaleType="centerInside" |
| | | android:src="@drawable/answer"/> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="@string/video_answer"/> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </RelativeLayout> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <RelativeLayout |
| | | xmlns:android="http://schemas.android.com/apk/res/android" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent"> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/icon_sceenshotLayout" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:layout_marginStart="60dp" |
| | | android:layout_marginTop="60dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/icon_sceenshotImg" |
| | | android:layout_width="66dp" |
| | | android:layout_height="66dp" |
| | | android:contentDescription="@string/video_screenshot" |
| | | android:adjustViewBounds="true" |
| | | android:scaleType="centerInside" |
| | | android:src="@drawable/screenshot"/> |
| | | |
| | | <TextView |
| | | android:id="@+id/icon_sceenshotText" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="19dp" |
| | | android:text="@string/video_screenshot"/> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/icon_unlockLayout" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:gravity="center" |
| | | android:layout_alignParentEnd="true" |
| | | android:layout_marginEnd="60dp" |
| | | android:layout_marginTop="60dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/icon_unlockImg" |
| | | android:layout_width="66dp" |
| | | android:layout_height="66dp" |
| | | android:contentDescription="@string/video_unlock" |
| | | android:adjustViewBounds="true" |
| | | android:scaleType="centerInside" |
| | | android:src="@drawable/unlock"/> |
| | | |
| | | <TextView |
| | | android:id="@+id/icon_unlockText" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="19dp" |
| | | android:text="@string/video_unlock"/> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </RelativeLayout> |
| | | |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <resources> |
| | | <string name="app_name">HDL_ON_Pro</string> |
| | | <string name="action_settings">设置</string> |
| | | <string name="video_screenshot">截图</string> |
| | | <string name="video_unlock">开锁</string> |
| | | <string name="video_answer">接听</string> |
| | | <string name="video_not_answer">拒接</string> |
| | | <string name="video_tip">提示</string> |
| | | <string name="video_hang_up">已挂断</string> |
| | | <string name="video_confirm">确定</string> |
| | | <string name="video_icon">图标</string> |
| | | <string name="video_device">设备</string> |
| | | <string name="video_success">成功</string> |
| | | <string name="video_fail">失败</string> |
| | | <string name="calling">来电中...</string> |
| | | <string name="end_call">通话结束</string> |
| | | <string name="on_the_phone">通话中...</string> |
| | | <string name="unlock_success">开锁成功</string> |
| | | <string name="screenshot_success">截图成功</string> |
| | | </resources> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <resources> |
| | | <color name="colorPrimary">#2c3e50</color> |
| | | <color name="colorPrimaryDark">#1B3147</color> |
| | | <color name="colorAccent">#3498db</color> |
| | | <color name="colorPrimary">#2c3e50</color> |
| | | <color name="colorPrimaryDark">#1B3147</color> |
| | | <color name="colorAccent">#3498db</color> |
| | | <color name="colorBlack">#FF000000</color> |
| | | <color name="color_white">#FFFFFF</color> |
| | | <color name="color_disable">#CCCCCC</color> |
| | | <color name="color_select">#FB744A</color> |
| | | <color name="color_default">#FF333333</color> |
| | | </resources> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <resources> |
| | | <dimen name="fab_margin">16dp</dimen> |
| | | <dimen name="titleTextSize">25sp</dimen> |
| | | <dimen name="tipTextSize">14sp</dimen> |
| | | <dimen name="tipTitleTextSize">16sp</dimen> |
| | | </resources> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <resources> |
| | | <string name="app_name">HDL_ON_Pro</string> |
| | | <string name="action_settings">Settings</string> |
| | | <string name="action_settings">Setting</string> |
| | | <string name="video_screenshot">Screenshot</string> |
| | | <string name="video_unlock">Unlock</string> |
| | | <string name="video_answer">Answer</string> |
| | | <string name="video_not_answer">Reject</string> |
| | | <string name="video_tip">Prompt</string> |
| | | <string name="video_hang_up">Hang up</string> |
| | | <string name="video_confirm">Confirm</string> |
| | | <string name="video_icon">Icon</string> |
| | | <string name="video_device">Device</string> |
| | | <string name="video_success">Success</string> |
| | | <string name="video_fail">Fail</string> |
| | | <string name="calling">Calling...</string> |
| | | <string name="end_call">End of call</string> |
| | | <string name="on_the_phone">On the phone</string> |
| | | <string name="unlock_success">Unlock successfully</string> |
| | | <string name="screenshot_success">Screenshot successfully</string> |
| | | |
| | | </resources> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <resources> |
| | | <!-- 其中parent可以为 android:Theme 或 android:Theme.NoTitleBar; android:windowBackground可以为背景图 --> |
| | | <style name="MyTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen"> |
| | | <item name="android:windowBackground">@drawable/Loading</item> |
| | | <!-- 隐藏状态栏 --> |
| | | <item name="android:windowFullscreen">false</item> |
| | | <!-- 隐藏标题栏 --> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <item name="android:windowTranslucentStatus">true</item> |
| | | </style> |
| | | |
| | | <style name="MyDialogStyle"> |
| | | <item name="android:windowBackground">@android:color/transparent</item> |
| | | <item name="android:windowFrame">@null</item> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <item name="android:windowIsFloating">true</item> |
| | | <item name="android:windowIsTranslucent">true</item> |
| | | <item name="android:windowContentOverlay">@null</item> |
| | | <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> |
| | | <item name="android:backgroundDimEnabled">true</item> |
| | | </style> |
| | | |
| | | <!-- 其中parent可以为 android:Theme 或 android:Theme.NoTitleBar; android:windowBackground可以为背景图 --> |
| | | <style name="MyTheme" parent="@android:style/Theme.NoTitleBar.Fullscreen"> |
| | | <item name="android:windowBackground">@drawable/Loading</item> |
| | | <!-- 隐藏状态栏 --> |
| | | <item name="android:windowFullscreen">false</item> |
| | | <!-- 隐藏标题栏 --> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <item name="android:windowTranslucentStatus">true</item> |
| | | </style> |
| | | <style name="MyDialogStyle"> |
| | | <item name="android:windowBackground">@android:color/transparent</item> |
| | | <item name="android:windowFrame">@null</item> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <item name="android:windowIsFloating">true</item> |
| | | <item name="android:windowIsTranslucent">true</item> |
| | | <item name="android:windowContentOverlay">@null</item> |
| | | <item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item> |
| | | <item name="android:backgroundDimEnabled">true</item> |
| | | </style> |
| | | <style name="DialogTheme" parent="@android:style/Theme.Dialog"> |
| | | <!-- 背景颜色及和透明程度 --> |
| | | <item name="android:windowBackground">@android:color/transparent</item> |
| | | <!-- 是否去除标题 --> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <!-- 是否去除边框 --> |
| | | <item name="android:windowFrame">@null</item> |
| | | <!-- 是否浮现在activity之上 --> |
| | | <item name="android:windowIsFloating">true</item> |
| | | </style> |
| | | <style name="MyTheme1" parent="Theme.AppCompat.Light.NoActionBar"> |
| | | <item name="android:windowBackground">@drawable/Loading</item> |
| | | <!-- 隐藏状态栏 --> |
| | | <item name="android:windowFullscreen">false</item> |
| | | <!-- 隐藏标题栏 --> |
| | | <item name="android:windowNoTitle">true</item> |
| | | <item name="android:windowTranslucentStatus">false</item> |
| | | </style> |
| | | </resources> |
New file |
| | |
| | | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Threading; |
| | | using Android; |
| | | using Android.App; |
| | | using Android.Content; |
| | | using Android.Content.PM; |
| | | using Android.Graphics; |
| | | using Android.OS; |
| | | using Android.Runtime; |
| | | using Android.Support.V4.App; |
| | | using Android.Support.V4.Content; |
| | | using Android.Util; |
| | | using Android.Views; |
| | | using Android.Widget; |
| | | using Com.ETouchSky; |
| | | using Com.Tool; |
| | | using GateWay.Droid.FengLinVideo.widget; |
| | | using HDL_ON.Common; |
| | | using HDL_ON.DAL.Server; |
| | | using HDL_ON_Android.FengLinVideo.Form; |
| | | |
| | | namespace HDL_ON_Android |
| | | { |
| | | [Activity(Label = "VideoActivity", WindowSoftInputMode = SoftInput.AdjustResize, LaunchMode = LaunchMode.SingleInstance, ConfigurationChanges = (ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.LayoutDirection | ConfigChanges.Locale | ConfigChanges.Orientation | ConfigChanges.ScreenSize), Theme = "@style/MyTheme1", ScreenOrientation = ScreenOrientation.Portrait)] |
| | | public class VideoActivity : Activity, View.IOnClickListener, ISurfaceHolderCallback, VideoPhoneJni.ICallBack, TipDiaglog.OnConfirmClickListener |
| | | { |
| | | private static Activity activity; |
| | | private VideoPhone mPhone; |
| | | private ISurfaceHolder mRemoteSurfaceHolder; |
| | | private FrameLayout mRemoteFrameContainer; |
| | | private SurfaceView mSurfaceRemote; |
| | | |
| | | private ImageView ivBack; |
| | | private TextView tvName; |
| | | private MonitorFragment monitorFragment = null; |
| | | private ReverseCallFragment reverseCallFragment = null; |
| | | |
| | | public static string ESVideoUUID = "JJY000019VPLLF";//室外机UUID,例:JJY000007FSEYX f5f6fa |
| | | public static string DeviceName;//室外机的名称,例,室外机 |
| | | public static bool IsCollect;//是否收藏 |
| | | public static int Tpye = 0;//类型,0 监控,1反呼 |
| | | |
| | | public static string UUId; |
| | | public static int CallId;//callId 呼叫记录id |
| | | public static string CmtID;//cmtID 丰林社区号 |
| | | public static string Roomno;//roomno 丰林房间号 |
| | | public static string Unitno;//unitno 丰林楼栋号 string |
| | | public static string HomeID;//HomeID 丰林住宅id |
| | | |
| | | protected override void OnCreate(Bundle savedInstanceState) |
| | | { |
| | | base.OnCreate(savedInstanceState); |
| | | |
| | | try |
| | | { |
| | | activity = this; |
| | | |
| | | ESVideoUUID = Intent.GetStringExtra("ESVideoUUID");//室外机UUID,例:JJY000007FSEYX |
| | | DeviceName = Intent.GetStringExtra("DeviceName");//室外机的名称,例,室外机 |
| | | UUId = Intent.GetStringExtra("uuid");// |
| | | CallId = Intent.GetIntExtra("callId", 0); |
| | | CmtID = Intent.GetStringExtra("cmtID"); |
| | | Roomno = Intent.GetStringExtra("roomno"); |
| | | Unitno = Intent.GetStringExtra("unitno"); |
| | | HomeID = Intent.GetStringExtra("HomeID"); |
| | | |
| | | IsCollect = Intent.GetBooleanExtra("IsCollect", false);//是否收藏 |
| | | Tpye = Intent.GetIntExtra("Type", 0);//类型,0 监控,1反呼 |
| | | |
| | | SetContentView(Resource.Layout.activity_video_phone); |
| | | |
| | | IniView(); |
| | | IniData(); |
| | | |
| | | if (Tpye == 0) |
| | | { |
| | | Monitor(ESVideoUUID); //监控 |
| | | |
| | | monitorFragment = new MonitorFragment(mPhone); |
| | | FragmentManager.BeginTransaction().Replace(Resource.Id.content, monitorFragment).Commit(); |
| | | } |
| | | else |
| | | { |
| | | string param = "address=" + ESVideoUUID + ",tag=mobile://123,"; |
| | | reverseCallFragment = new ReverseCallFragment(mPhone, param); |
| | | FragmentManager.BeginTransaction().Replace(Resource.Id.content, reverseCallFragment).Commit(); |
| | | } |
| | | } |
| | | catch {} |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 必要的一些权限 |
| | | /// </summary> |
| | | private void Permissions() |
| | | { |
| | | String[] mPermissionList = new String[] |
| | | { |
| | | Manifest.Permission.WriteExternalStorage, |
| | | Manifest.Permission.ReadExternalStorage, |
| | | Manifest.Permission.Camera, |
| | | Manifest.Permission.RecordAudio |
| | | }; |
| | | |
| | | foreach (String permissions in mPermissionList) |
| | | { |
| | | if (ContextCompat.CheckSelfPermission(this, permissions) != 0) |
| | | { |
| | | ActivityCompat.RequestPermissions(this, new string[] { permissions }, 1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 隐藏底部导航栏——虚拟按键 |
| | | /// </summary> |
| | | private void HideVirtualButtons() |
| | | { |
| | | WindowManagerLayoutParams windowManager = Window.Attributes; |
| | | var uiOptions = (int)Window.DecorView.SystemUiVisibility; |
| | | var newUiOptions = (int)uiOptions; |
| | | newUiOptions = (int)SystemUiFlags.HideNavigation | (int)SystemUiFlags.Immersive | (int)SystemUiFlags.ImmersiveSticky; |
| | | windowManager.SystemUiVisibility = (StatusBarVisibility)newUiOptions; |
| | | Window.Attributes = windowManager; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 监控 |
| | | /// </summary> |
| | | /// <param name="address"></param> |
| | | private void Monitor(string address) |
| | | { |
| | | //监视功能 从平台拉取监视列表,调用此接口可以一台一台监视 |
| | | if (mPhone != null) |
| | | { |
| | | //此参数 可以向门口机设备传递数据, |
| | | //注意:RequestAudio 请求对方音频,RequestVideo请求对方视频 SendAudio发送本地音频 SendVideo 发送本地视频 一般门口不接收到视频,所以最好设置0,减少流量消耗 |
| | | string UserData = ""; |
| | | string param = "SendAudio=0\r\n" + "SendVideo=0\r\n" + "RequestAudio=0\r\n" + "RequestVideo=0\r\n" + "UserData=" + UserData + "\r\n"; |
| | | mPhone.Monitor(address, param); |
| | | } |
| | | } |
| | | |
| | | private void IniView() |
| | | { |
| | | mRemoteFrameContainer = (FrameLayout)FindViewById(Resource.Id.remoteFrame); |
| | | |
| | | ivBack = (ImageView)FindViewById(Resource.Id.videoBackImg); |
| | | tvName = (TextView)FindViewById(Resource.Id.nameText); |
| | | |
| | | tvName.SetText(DeviceName, null); |
| | | |
| | | ivBack.SetOnClickListener(this); |
| | | } |
| | | |
| | | private void IniData() |
| | | { |
| | | try |
| | | { |
| | | if (mPhone == null) |
| | | { |
| | | string _params = "port=8554\r\n" + "packcode=1021df37c2abe546a4541ca2c4a9c910\r\n"; //初始化对讲端口,默认就好,跟门口机设置要匹配,注意新接口需要增加packcode参数,需要把你们的包名发过来 |
| | | mPhone = new VideoPhone(this, this, _params); |
| | | |
| | | if (mRemoteSurfaceHolder != null) |
| | | { |
| | | mPhone.SetRemoteSurfaceHolder(mRemoteSurfaceHolder, "mRemoteSurfaceHolder!=null"); //设置来电窗口 |
| | | } |
| | | |
| | | ViewGroup v = (ViewGroup)FindViewById(Resource.Id.localVideo); |
| | | mPhone.SetLocalVideoContainer(v);//设置本地视频窗口,一定要调用,不然后会出现没声音 |
| | | } |
| | | else |
| | | { |
| | | mPhone.StopStream(); |
| | | mPhone.Release(); |
| | | mPhone = null; |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | protected override void OnResume() |
| | | { |
| | | base.OnResume(); |
| | | |
| | | HideVirtualButtons(); |
| | | |
| | | Permissions(); |
| | | |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.OnActivityResume(); |
| | | } |
| | | } |
| | | |
| | | protected override void OnPause() |
| | | { |
| | | base.OnPause(); |
| | | if (mPhone != null) |
| | | { |
| | | //mPhone.OnActivityPause(); |
| | | } |
| | | } |
| | | |
| | | protected override void OnDestroy() |
| | | { |
| | | base.OnDestroy(); |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.HangUp(); |
| | | mPhone.Release(); |
| | | mPhone = null; |
| | | //mPhone.OnActivityDestroy(); |
| | | } |
| | | } |
| | | |
| | | public override void OnBackPressed() |
| | | { |
| | | if (mPhone != null) |
| | | mPhone.HangUp(); |
| | | |
| | | Finish(); |
| | | } |
| | | |
| | | public void OnClick(View v) |
| | | { |
| | | if (v.Equals(ivBack)) |
| | | { |
| | | if (mPhone != null) |
| | | mPhone.HangUp(); |
| | | |
| | | Finish(); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// show出视频画面 |
| | | /// 不能用View.INVISIBLE来完全隐藏,否则MediaCodec.configure会报ava.lang.IllegalArgumentException: The surface has been released |
| | | /// </summary> |
| | | private void ShowRemoteVideo() |
| | | { |
| | | try |
| | | { |
| | | if (mSurfaceRemote != null) |
| | | { |
| | | return; |
| | | } |
| | | mSurfaceRemote = new SurfaceView(this, null); |
| | | ISurfaceHolder holder = mSurfaceRemote.Holder; |
| | | holder.AddCallback(this);//ISurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS |
| | | holder.SetType(SurfaceType.PushBuffers); |
| | | |
| | | //发现第一次show时会闪屏一下,后面hide再show时不会闪屏 |
| | | FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); |
| | | //v.setId(View.generateViewId()); |
| | | mSurfaceRemote.LayoutParameters = lp; |
| | | mRemoteFrameContainer.AddView(mSurfaceRemote); |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 关闭画面 |
| | | /// </summary> |
| | | private void HideRemoteVideo() |
| | | { |
| | | try |
| | | { |
| | | if (mSurfaceRemote != null) |
| | | { |
| | | mRemoteFrameContainer.RemoveView(mSurfaceRemote); |
| | | mSurfaceRemote = null; |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 弹出已挂断提示 |
| | | /// </summary> |
| | | private void ShowTipDialog(string title, string text, string btnText, bool isClose) |
| | | { |
| | | try |
| | | { |
| | | TipDiaglog diaglog = new TipDiaglog(this); |
| | | diaglog.SetAutoClose(isClose); |
| | | diaglog.SetTitleText(title);//"提示" |
| | | diaglog.SetContentText(text);//"已挂断" |
| | | diaglog.SetConfirmText(btnText);//"确认" |
| | | diaglog.SetCanceledOnTouchOutside(false); |
| | | diaglog.Show(); |
| | | diaglog.Create(); |
| | | diaglog.SetConfirmClickListener(this); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | string ss = e.Message; |
| | | } |
| | | } |
| | | |
| | | public void SurfaceChanged(ISurfaceHolder holder, [GeneratedEnum] Format format, int width, int height) |
| | | { |
| | | mRemoteSurfaceHolder = holder; |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.SetRemoteSurfaceHolder(holder, "surfaceChanged"); |
| | | } |
| | | } |
| | | |
| | | public void SurfaceCreated(ISurfaceHolder holder) |
| | | { |
| | | mRemoteSurfaceHolder = holder; |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.SetRemoteSurfaceHolder(holder, "surfaceCreated"); |
| | | } |
| | | } |
| | | |
| | | public void SurfaceDestroyed(ISurfaceHolder holder) |
| | | { |
| | | mRemoteSurfaceHolder = null; |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.SetRemoteSurfaceHolder(null, "surfaceDestroyed"); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开始拉流 |
| | | /// 注意:由于android框架限制,要满足如下条件才能开流:activity要在前台,并且surfaceview可用 |
| | | /// </summary> |
| | | /// <param name="reason"></param> |
| | | private void StartStream(String reason) |
| | | { |
| | | if (mPhone != null) |
| | | { |
| | | try |
| | | { |
| | | //开流之前可配置视频尺寸,码率,帧率 针对的是本地 |
| | | //mPhone.SetVideoSize(640, 480);//1920x1080,1280x720,640x480 |
| | | //mPhone.SetBps(1.5 * 1024 * 1024); |
| | | //mPhone.SetFps(30); |
| | | mPhone.StartStream(); |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通话状态回调方法 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | public void OnPhoneEvent(string msg) |
| | | { |
| | | try |
| | | { |
| | | if (monitorFragment != null) |
| | | { |
| | | monitorFragment.OnPhoneEvent(msg); |
| | | } |
| | | |
| | | if (reverseCallFragment != null) |
| | | { |
| | | reverseCallFragment.OnPhoneEvent(msg); |
| | | } |
| | | |
| | | TextProtocol tp = new TextProtocol(); |
| | | tp.Parse(msg); |
| | | string event1 = tp.GetString("event"); |
| | | Log.Info("FengLinVideo", "OnPhoneEvent event=" + event1); |
| | | switch (event1) |
| | | { |
| | | case "EVT_Ringing": |
| | | mPhone.RequestCallerSendVideo(); |
| | | ShowRemoteVideo(); |
| | | break; |
| | | case "EVT_Connected": |
| | | if (!mPhone.IsStreamRunning) |
| | | { |
| | | //由于android框架限制,要满足如下条件才能开流: activity要在前台,并且surfaceview可用 |
| | | StartStream("EVT_Connected"); |
| | | } |
| | | ShowRemoteVideo(); |
| | | break; |
| | | case "EVT_StartStream": |
| | | StartStream("EVT_StreamStream"); |
| | | break; |
| | | case "EVT_StopStream": |
| | | mPhone.StopStream(); |
| | | break; |
| | | case "EVT_MonitorConnected": |
| | | if (!mPhone.IsStreamRunning) |
| | | { |
| | | StartStream("EVT_MonitorConnected"); |
| | | } |
| | | ShowRemoteVideo(); |
| | | break; |
| | | case "EVT_HangUp": |
| | | HideRemoteVideo(); |
| | | if (mPhone != null) |
| | | { |
| | | mPhone.StopStream(); |
| | | } |
| | | //Toast.MakeText(this, GetString(Resource.String.end_call), ToastLength.Short).Show(); |
| | | this.Finish(); |
| | | //ShowTipDialog(tip, hang_up, confirm, true); |
| | | break; |
| | | case "EVT_RECV_CUSTOM_DATA": |
| | | string data = tp.GetString("data"); |
| | | Toast.MakeText(this, GetString(Resource.String.video_success), ToastLength.Short).Show(); |
| | | break; |
| | | case "EVT_SnapAck": |
| | | int error = tp.GetInt("error"); |
| | | string filePath = tp.GetString("filePath"); |
| | | if (error == 0) |
| | | { |
| | | Toast.MakeText(this, GetString(Resource.String.video_success), ToastLength.Short).Show(); |
| | | } |
| | | else |
| | | { |
| | | Toast.MakeText(this, GetString(Resource.String.video_fail), ToastLength.Short).Show(); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | public void OnRecvAudioFrame(byte[] p0) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | |
| | | public void OnRecvVideoFrame(byte[] p0) |
| | | { |
| | | //throw new NotImplementedException(); |
| | | } |
| | | |
| | | public void onSureClick(TipDiaglog dialoog, View v, bool bol) |
| | | { |
| | | dialoog.Dismiss(); |
| | | if (bol) |
| | | this.Finish(); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | Console.WriteLine(userInfo); |
| | | //HDLCommon.Current.ShowAlert("DidReceiveRemoteNotification:" + userInfo.ToString()); |
| | | |
| | | |
| | | if (application.ApplicationState == UIApplicationState.Active || application.ApplicationState == UIApplicationState.Background) |
| | | { |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置当前使用语言 |
| | | /// </summary> |
| | | void SetCurrentLanguage() |
| | | { |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.SetLanguage)) |
| | | { |
| | | if (NSLocale.PreferredLanguages[0].Contains("zh-")) |
| | | { |
| | | Language.CurrentLanguage = "Chinese"; |
| | | } |
| | | else if (NSLocale.PreferredLanguages[0].Contains("cs-")) |
| | | { |
| | | Language.CurrentLanguage = "Czech"; |
| | | } |
| | | else |
| | | { |
| | | Language.CurrentLanguage = "English"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Language.CurrentLanguage = OnAppConfig.Instance.SetLanguage; |
| | | } |
| | | } |
| | | |
| | | public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions) |
| | | { |
| | | SetCurrentLanguage(); |
| | | //Shared.Application.FontSize = 12; |
| | | //Bugly.Bugly.StartWithAppId("b58fb35436"); |
| | | |
| | | //取消EditText默认密码输入方式 |
| | | //Shared.Application.IsEditTextContentTypePassword = false; |
| | | //默认使用苹方字体 |
| | | Shared.Application.IsUsePingFang = true; |
| | | //保持屏幕常亮或者自动锁屏 |
| | | application.IdleTimerDisabled = false; |
| | | base.FinishedLaunching(application, launchOptions); |
| | | |
| | | Window = new UIWindow(UIScreen.MainScreen.Bounds); |
| | | rootViewController = new UINavigationController(new ViewController()) { NavigationBarHidden = true }; |
| | |
| | | |
| | | AppCenter.Start("e1add75a-82c6-4a5c-a902-4705b195748e", typeof(Analytics), typeof(Crashes)); |
| | | |
| | | base.FinishedLaunching(application, launchOptions); |
| | | |
| | | SharedMethod.SharedMethod.sharedApp = application; |
| | | //NSString* nsCount = [[NSLocale currentLocale] objectForKey: NSLocaleCountryCode]; |
| | | application.StatusBarStyle = UIStatusBarStyle.DarkContent; |
| | | |
| | | //string nsCount = NSLocale.CurrentLocale.CountryCode; |
| | | |
| | | //if ( UserInfo.Current != null && nsCount != UserInfo.Current.areaCode.ToString()) |
| | | //{ |
| | | // //int.TryParse(nsCount,out UserInfo.Current.areaCode); |
| | | // //2020-11-18 |
| | | // UserInfo.Current.areaCode = nsCount; |
| | | // OnAppConfig.Instance.SaveUserConfig(); |
| | | //} |
| | | |
| | | |
| | | application.RegisterForRemoteNotificationTypes(UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound); |
| | | |
| | | //window.AccessibilityNavigationStyle = UIAccessibilityNavigationStyle.Automatic; |
| | | // check for a notification |
| | | DealWithPushMes(launchOptions); |
| | | |
| | | if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) |
| | | { |
| | | var notificationSettings = UIUserNotificationSettings.GetSettingsForTypes(UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound, null); |
| | | application.RegisterUserNotificationSettings(notificationSettings); |
| | | application.RegisterForRemoteNotifications(); |
| | | } |
| | | else |
| | | { |
| | | //==== register for remote notifications and get the device token |
| | | // set what kind of notification types we want |
| | | UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge; |
| | | // register for remote notifications |
| | | UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes); |
| | | } |
| | | |
| | | if (UIApplication.SharedApplication.ApplicationIconBadgeNumber > 0) |
| | | { |
| | | //RemoteInfo.Current.ReadMsgList(true); |
| | | } |
| | | |
| | | //Harpy.Harpy.SharedInstance.PresentingViewController = this.Window.RootViewController; |
| | | //Harpy.Harpy.SharedInstance.WeakDelegate = this; |
| | | //Harpy.Harpy.SharedInstance.AlertType = Harpy.HarpyAlertType.Skip; |
| | | //Harpy.Harpy.SharedInstance.DebugEnabled = false; |
| | | //Harpy.Harpy.SharedInstance.ForceLanguageLocalization = Harpy.Constants.HarpyLanguageChineseSimplified; |
| | | |
| | | //if (UIApplication.SharedApplication.ApplicationIconBadgeNumber > 0) |
| | | //{ |
| | | // //RemoteInfo.Current.ReadMsgList(true); |
| | | //} |
| | | //中文国内key、英文海外key |
| | | EZSDK.IOS.EZSDK.InitLibWithAppKey("1aa98a90489b4838b966b57018b4b04b", "1aa98a90489b4838b966b57018b4b04b"); |
| | | |
| | | |
| | | Console.WriteLine("FinishedLaunching"); |
| | | return true; |
| | | } |
| | |
| | | var title = alert["title"] as NSString; |
| | | var expandData = ""; |
| | | var messageType = ""; |
| | | var expantContent = ""; |
| | | if (userInfo.ContainsKey(new NSString("expandData"))) |
| | | { |
| | | var expandDataStr = userInfo["expandData"] as NSString; |
| | |
| | | expandData = expandDataNSD.ToString(); |
| | | if(expandDataNSD.ContainsKey(new NSString("messageType"))){ |
| | | messageType = expandDataNSD["messageType"] as NSString; |
| | | Utlis.WriteLine("messageType: "+ messageType); |
| | | Utlis.WriteLine("messageType: " + messageType); |
| | | } |
| | | |
| | | |
| | | if (expandDataNSD.ContainsKey(new NSString("expantContent"))) |
| | | { |
| | | expantContent = expandDataNSD["expantContent"] as NSString; |
| | | Utlis.WriteLine("expantContent: " + expantContent); |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | |
| | | Title = title, |
| | | Content = body, |
| | | Extras = expandData, |
| | | messageType = messageType |
| | | messageType = messageType, |
| | | expantContent = expantContent |
| | | }; |
| | | Utlis.WriteLine("PushMes title : " + pushMes.Title); |
| | | Utlis.WriteLine("PushMes message : " + pushMes.Content); |
| | |
| | | |
| | | if (bFinishedLaunching) |
| | | { |
| | | if (pushMes.Extras != null && pushMes.Extras.Contains("OffLine")) |
| | | if (pushMes.Extras != null) |
| | | { |
| | | //haveToSignOut = true; |
| | | //强制下线 |
| | | UserInfo.Current.LastTime = DateTime.MinValue; |
| | | UserInfo.Current.headImagePagePath = "LoginIcon/2.png";//重置用户头像 |
| | | UserInfo.Current.SaveUserInfo(); |
| | | HDLCommon.Current.ShowAlert(Language.StringByID(StringId.LoggedOnOtherDevices)); |
| | | if (pushMes.Extras.Contains("OffLine")) |
| | | { |
| | | //haveToSignOut = true; |
| | | //强制下线 |
| | | UserInfo.Current.LastTime = DateTime.MinValue; |
| | | UserInfo.Current.headImagePagePath = "LoginIcon/2.png";//重置用户头像 |
| | | UserInfo.Current.SaveUserInfo(); |
| | | HDLCommon.Current.ShowAlert(Language.StringByID(StringId.LoggedOnOtherDevices)); |
| | | } |
| | | else |
| | | { |
| | | HDLCommon.Current.AdjustPushMessage(pushMes); |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | catch |
| | | { |
| | | |
| | | //HDLCommon.Current.ShowAlert("catch2222"); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | if (userInfo != null) |
| | | { |
| | | HandleNotificationMessageUserInfo(userInfo, true); |
| | | //HandleNotificationMessageUserInfo(userInfo, true); |
| | | |
| | | } |
| | | } |
| | |
| | | <Reference Include="EZSDK.IOS"> |
| | | <HintPath>..\DLL\IOS\EZSDK.IOS.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="Shared.IOS.ESVideoOnSDK"> |
| | | <HintPath>..\DLL\FL\iOS\Shared.IOS.ESVideoOnSDK.dll</HintPath> |
| | | </Reference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <PackageReference Include="Newtonsoft.Json"> |
| | |
| | | <Compile Include="ZXingOverlayView.cs" /> |
| | | <Compile Include="Other\JLCountrycode.cs" /> |
| | | <Compile Include="BlueWifi.cs" /> |
| | | <Compile Include="Other\ESVideo.cs" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <BundleResource Include="Resources\Phone\LoginIcon\ShowPasswordIcon.png" /> |
| | |
| | | <key>UIStatusBarStyle</key> |
| | | <string>UIStatusBarStyleLightContent</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>1.1.202103252</string> |
| | | <string>1.1.202103262</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>202103252</string> |
| | | <string>202103262</string> |
| | | <key>NSLocationWhenInUseUsageDescription</key> |
| | | <string>Use geographic location to provide services such as weather</string> |
| | | <key>NSAppleMusicUsageDescription</key> |
| | |
| | | 437=Device List |
| | | 438=humidity:{0}% air:{1} wind:{2} |
| | | |
| | | |
| | | |
| | | 1000=Indoor Humidity |
| | | 1001=V-chip |
| | | 1002=Anion |
| | |
| | | 436=已添加功能 |
| | | 437=设备列表 |
| | | 438=湿度:{0}% 空气:{1} 风速:{2}级 |
| | | |
| | | |
| | | 1000=室内湿度 |
| | | 1001=童锁 |
| | |
| | | { |
| | | base.ViewDidLoad(); |
| | | |
| | | |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.SetLanguage)) |
| | | { |
| | | if (NSLocale.PreferredLanguages[0].Contains("zh-")) |
| | | { |
| | | Language.CurrentLanguage = "Chinese"; |
| | | } |
| | | else if (NSLocale.PreferredLanguages[0].Contains("cs-")) |
| | | { |
| | | Language.CurrentLanguage = "Czech"; |
| | | } |
| | | else |
| | | { |
| | | Language.CurrentLanguage = "English"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Language.CurrentLanguage = OnAppConfig.Instance.SetLanguage; |
| | | } |
| | | HDL_ON.MainPage.Show(); |
| | | |
| | | try |
| | |
| | | |
| | | namespace HDL_ON.Common |
| | | { |
| | | public class FileUtlis |
| | | public class FileUtlis |
| | | { |
| | | static Common.FileUtlis _temp; |
| | | public static Common.FileUtlis Files |
| | |
| | | string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; |
| | | |
| | | string accountPath; |
| | | string AccountPath { |
| | | string AccountPath |
| | | { |
| | | get |
| | | { |
| | | if (string.IsNullOrEmpty(accountPath) || !accountPath.Contains(UserInfo.Current.ID)) |
| | |
| | | { |
| | | get |
| | | { |
| | | if(DB_ResidenceData.Instance.CurrentRegion == null || DB_ResidenceData.Instance.CurrentRegion.RegionID == null) |
| | | if (DB_ResidenceData.Instance.CurrentRegion == null || DB_ResidenceData.Instance.CurrentRegion.RegionID == null) |
| | | { |
| | | return AccountPath; |
| | | } |
| | | if (string.IsNullOrEmpty(regionPath) || !regionPath.Contains(DB_ResidenceData.Instance.CurrentRegion.RegionID )) |
| | | if (string.IsNullOrEmpty(regionPath) || !regionPath.Contains(DB_ResidenceData.Instance.CurrentRegion.RegionID)) |
| | | { |
| | | regionPath = Path.Combine(AccountPath, DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | if (!Directory.Exists(regionPath)) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public byte[] ReadFile(string fileName) |
| | | { |
| | | FileStream fs = null; |
| | |
| | | } |
| | | } |
| | | |
| | | // 读取指定路径文件内容 |
| | | public byte[] ReadFileForPath(string path) |
| | | { |
| | | FileStream fs = null; |
| | | try |
| | | { |
| | | if (File.Exists(path)) |
| | | { |
| | | fs = new FileStream(path, FileMode.Open, FileAccess.Read); |
| | | } |
| | | else |
| | | { |
| | | return new byte[0]; |
| | | } |
| | | byte[] bytes = new byte[fs.Length]; |
| | | fs.Read(bytes, 0, bytes.Length); |
| | | return bytes; |
| | | } |
| | | catch |
| | | { |
| | | return new byte[0]; |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (fs != null) |
| | | { |
| | | fs.Close(); |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 下载网络图片 |
| | | /// </summary> |
| | | /// <param name="fileName"></param> |
| | | /// <param name="url"></param> |
| | | public void DownLoadImage(string fileName, string url,Action action) |
| | | public void DownLoadImage(string fileName, string url, Action action) |
| | | { |
| | | if (!File.Exists(fileName)) |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | | FileStream fs = null; |
| | | try |
| | | { |
| | |
| | | fs.Write(recevieBytes, 0, recevieBytes.Length); |
| | | fs.Flush(); |
| | | } |
| | | catch (Exception ex) { |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"down image : {ex.Message}"); |
| | | } |
| | | finally |
| | |
| | | } |
| | | } |
| | | }); |
| | | }else |
| | | } |
| | | else |
| | | { |
| | | action?.Invoke(); |
| | | } |
| | |
| | | #region ■ 推送处理_______________________ |
| | | /// <summary> |
| | | /// 推送消息处理 |
| | | /// 注意:Android要在主线程(UI线程)执行 |
| | | /// </summary> |
| | | /// <param name="jpushMessageInfo"></param> |
| | | public void AdjustPushMessage(JPushMessageInfo jpushMessageInfo) |
| | | { |
| | | try |
| | | { |
| | | if (jpushMessageInfo.Extras != null && jpushMessageInfo.Extras.Contains("OffLine")) |
| | | { |
| | | Shared.Application.RunOnMainThread(() => |
| | | { |
| | | ////账号在别处登陆,被踢下线 跳转到登录页面 |
| | | //new Alert(Language.StringByID(StringId.Tip), Language.StringByID(StringId.LoggedOnOtherDevices), Language.StringByID(StringId.Close)).Show(); |
| | | //退出登录操作 |
| | | CheckLogout(); |
| | | //Extras为空不处理 |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.Extras)) return; |
| | | |
| | | }); |
| | | return; |
| | | if (jpushMessageInfo.Extras.Contains(PushMessageType.OffLine.ToString())) |
| | | { |
| | | CheckLogout(); |
| | | } |
| | | else |
| | | { |
| | | Shared.Application.RunOnMainThread(() => |
| | | GetPushMessageAction?.Invoke(); |
| | | |
| | | //messageType为空不处理 |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.messageType)) return; |
| | | |
| | | //报警推送才弹窗提示(messageType包含Alarm关键字的) |
| | | if (jpushMessageInfo.messageType.Contains(PushMessageType.Alarm.ToString())) |
| | | { |
| | | GetPushMessageAction?.Invoke(); |
| | | //报警推送才弹窗提示(messageType包含Alarm关键字的) |
| | | if (jpushMessageInfo.messageType != null && jpushMessageInfo.messageType.Contains("Alarm")) |
| | | //报警推送弹窗提示 |
| | | ShowAlarmPushMessage(jpushMessageInfo); |
| | | } |
| | | else if (jpushMessageInfo.messageType.Contains(PushMessageType.FLCall.ToString())) |
| | | { |
| | | if (string.IsNullOrEmpty(jpushMessageInfo.expantContent)) return; |
| | | |
| | | ESVideoInfo eSVideoInfo = GetESOnVideoJson(jpushMessageInfo.expantContent); |
| | | |
| | | if (eSVideoInfo == null) return; |
| | | |
| | | if (string.IsNullOrEmpty(eSVideoInfo.uuid)) return; |
| | | |
| | | if (eSVideoInfo.uuid.Contains(",")) |
| | | { |
| | | //报警推送弹窗提示 |
| | | ShowAlarmPushMessage(jpushMessageInfo); |
| | | //new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); |
| | | var uuid = eSVideoInfo.uuid.Split(','); |
| | | eSVideoInfo.ESVideoUUID = uuid[0]; |
| | | } |
| | | else |
| | | { |
| | | eSVideoInfo.ESVideoUUID = eSVideoInfo.uuid; |
| | | } |
| | | |
| | | }); |
| | | return; |
| | | ESOnVideo.Current.ShowESvideoVideoIntercom(eSVideoInfo); |
| | | |
| | | } |
| | | } |
| | | } |
| | | catch(Exception EX) |
| | | { |
| | | Utlis.WriteLine("catch: " + EX.ToString()); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="jsonStr"></param> |
| | | /// <returns></returns> |
| | | ESVideoInfo GetESOnVideoJson(string jsonStr) |
| | | { |
| | | try |
| | | { |
| | | if (!string.IsNullOrEmpty(jsonStr)) |
| | | { |
| | | return Newtonsoft.Json.JsonConvert.DeserializeObject<ESVideoInfo>(jsonStr); |
| | | } |
| | | return null; |
| | | } |
| | | catch |
| | | { |
| | | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | public static class StringId |
| | | { |
| | | //public const int EnergyMonitoring = 439; |
| | | public const int EnvirSensorValueTip = 438; |
| | | public const int DeviceList = 437; |
| | | public const int AddedDevice = 436; |
| | |
| | | } |
| | | break; |
| | | case FunctionCategory.AirFresh: |
| | | |
| | | switch(function.spk) |
| | | { |
| | | case SPK.AirFreshJinmao: |
| | | //1 新风编号 1~200 |
| | | //2 类型 第三方类型 0:金茂新风 |
| | | //3 开关 0 - 关机,1 - 开机 |
| | | //4 运行模式 1 - 通风,2 - 加湿 |
| | | byte airFreshMode = 1; |
| | | if (function.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | { |
| | | airFreshMode = 2; |
| | | } |
| | | //5 节能舒适选择 1 - 舒适,2 - 节能 |
| | | byte airFreshEnergy = 1; |
| | | if( function.GetAttrState(FunctionAttributeKey.Energy)=="true") |
| | | { |
| | | airFreshEnergy = 2; |
| | | } |
| | | //6 风速档位 0 - 自动,1 - 1档,2 - 2档,3 - 3档 |
| | | byte airFreshFan = 0; |
| | | switch(function.GetAttrState(FunctionAttributeKey.FanSpeed)) |
| | | { |
| | | case "auto": |
| | | airFreshFan = 0; |
| | | break; |
| | | case "level_1": |
| | | airFreshFan = 1; |
| | | break; |
| | | case "level_2": |
| | | airFreshFan = 2; |
| | | break; |
| | | case "level_3": |
| | | airFreshFan = 3; |
| | | break; |
| | | } |
| | | //7 湿度设定 % |
| | | //8 室内温度值 ℃ |
| | | //9 室内湿度值 ℃ |
| | | //10 过滤网剩余 % |
| | | //11 过滤网使用超时 1 超时 0 无 |
| | | ControlBytesSend(Command.FreshAirControl_JinMao, subnetId, deviceId, new byte[] { |
| | | function.bus.LoopId,0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0 , |
| | | airFreshMode,airFreshEnergy, |
| | | airFreshFan, |
| | | Convert.ToByte( function.GetAttrState(FunctionAttributeKey.Humidity)), |
| | | 0,0,0,0 |
| | | //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorTemp)), |
| | | //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.IndoorHumidity)), |
| | | //Convert.ToByte( function.GetAttrState(FunctionAttributeKey.FilterRemain)), |
| | | //function.GetAttrState(FunctionAttributeKey.FilterTimeout) =="true"?1:0, |
| | | }); |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | #region 发送命令立即更新UI |
| | |
| | | } |
| | | ControlBytesSend(Command.ReadDeviceLoopInfo, subnetId, deviceId, new byte[] { 5, sensorType, function.bus.LoopId }); |
| | | break; |
| | | case FunctionCategory.AirFresh: |
| | | switch(function.spk) |
| | | { |
| | | case SPK.AirFreshJinmao: |
| | | ControlBytesSend(Command.FreshAirRead_JinMao, subnetId, deviceId, new byte[] { function.bus.LoopId }); |
| | | break; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | try |
| | | { |
| | | var topic = e.ApplicationMessage.Topic; |
| | | MainPage.Log($"收到mqtt主题:{topic}"); |
| | | //MainPage.Log($"收到mqtt主题:{topic}"); |
| | | //一端口主题处理 |
| | | if (DB_ResidenceData.Instance.GatewayType == 0 && !DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) |
| | | { |
| | |
| | | /// </summary> |
| | | public const string API_POST_EZ_GetChildToken = "/home-wisdom/platform/childToken"; |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #region ■ -- 丰林相关相关接口___________________________ |
| | | /// <summary> |
| | | /// 检查住宅是否绑定丰林,并获取门口机列表 |
| | | /// </summary> |
| | | public const string API_POST_FL_Check = "/home-wisdom/app/fl/vi/check"; |
| | | /// <summary> |
| | | /// 接听 |
| | | /// </summary> |
| | | public const string API_POST_FL_Answer = "/home-wisdom/app/fl/vi/answer"; |
| | | /// <summary> |
| | | /// 拒接 |
| | | /// </summary> |
| | | public const string API_POST_FL_Reject = "/home-wisdom/app/fl/vi/reject"; |
| | | /// <summary> |
| | | /// 开锁成功 |
| | | /// </summary> |
| | | public const string API_POST_FL_Unlock= "/home-wisdom/app/fl/vi/unlock"; |
| | | /// <summary> |
| | | /// 通话视频截图上传 |
| | | /// </summary> |
| | | public const string API_POST_FL_Screenshot = "/home-wisdom/app/fl/vi/screenshot"; |
| | | /// <summary> |
| | | /// 挂断 |
| | | /// </summary> |
| | | public const string API_POST_FL_HangUp = "/home-wisdom/app/fl/vi/hang-up"; |
| | | /// <summary> |
| | | /// 获取通话记录 |
| | | /// </summary> |
| | | public const string API_POST_FL_GetCallList = "/home-wisdom/app/fl/vi/list"; |
| | | /// <summary> |
| | | /// 删除通话记录 |
| | | /// </summary> |
| | | public const string API_POST_FL_DeleteCallInfo = "/home-wisdom/app/fl/vi/delete"; |
| | | #endregion |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | /// 信息类型 |
| | | /// </summary> |
| | | public string messageType = ""; |
| | | /// <summary> |
| | | /// 扩展数据内容 |
| | | /// </summary> |
| | | public string expantContent = ""; |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | using System; |
| | | using HDL_ON; |
| | | using HDL_ON.DAL.Server; |
| | | using System.Threading; |
| | | using System.Collections.Generic; |
| | | |
| | | #if __IOS__ |
| | | using Shared.IOS.ESVideoOnSDK; |
| | | using UIKit; |
| | | using Foundation; |
| | | #else |
| | | |
| | | using Android.Content; |
| | | |
| | | #endif |
| | | |
| | | namespace Shared |
| | | { |
| | | /// <summary> |
| | | /// 丰林可视对讲 |
| | | /// </summary> |
| | | public class ESOnVideo |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | private static ESOnVideo m_Current = null; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public static ESOnVideo Current |
| | | { |
| | | get |
| | | { |
| | | if (m_Current == null) |
| | | { |
| | | m_Current = new ESOnVideo(); |
| | | } |
| | | return m_Current; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 门口机、丰林小区信息和房间信息等参数 |
| | | /// </summary> |
| | | public ESVideoInfo esVideoInfo; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public void InitESVideoSDK() |
| | | { |
| | | //ESVideo. |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 监控页面 |
| | | /// </summary> |
| | | /// <param name="mESVideoInfo"></param> |
| | | public void ShowESVideoMonitor(ESVideoInfo mESVideoInfo) |
| | | { |
| | | this.esVideoInfo = mESVideoInfo; |
| | | |
| | | #if __IOS__ |
| | | ESOnMonitorViewController vc = new ESOnMonitorViewController(); |
| | | vc.MESVideoID = mESVideoInfo.ESVideoUUID; |
| | | //vc.MESRoomID = mESVideoInfo.ESRoomID; |
| | | vc.DeviceName = mESVideoInfo.DeviceName; |
| | | //vc.RoomName = mESVideoInfo.RoomName; |
| | | vc.MESCallDelegate = new OnESCallDelegate(this); |
| | | Shared.Application.currentVC.NavigationController.PushViewController(vc, true); |
| | | #else |
| | | |
| | | Intent 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", mESVideoInfo.HomeID); |
| | | intent.PutExtra("callId", mESVideoInfo.callId); |
| | | intent.PutExtra("Type", 0); |
| | | Shared.Application.Activity.StartActivity(intent); |
| | | |
| | | #endif |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 被呼叫页面 |
| | | /// </summary> |
| | | /// <param name="mESVideoInfo"></param> |
| | | public void ShowESvideoVideoIntercom(ESVideoInfo mESVideoInfo) |
| | | { |
| | | this.esVideoInfo = mESVideoInfo; |
| | | #if __IOS__ |
| | | ESOnIntercomViewController vc = new ESOnIntercomViewController(); |
| | | vc.MESVideoID = mESVideoInfo.ESVideoUUID; |
| | | //vc.MESRoomID = mESVideoInfo.ESRoomID; |
| | | vc.DeviceName = mESVideoInfo.DeviceName; |
| | | //vc.RoomName = mESVideoInfo.RoomName; |
| | | //vc.MESCallDelegate = new OnESCallDelegate(this); |
| | | mOnESCallDelegate = new OnESCallDelegate(this); |
| | | vc.MESCallDelegate = mOnESCallDelegate; |
| | | Shared.Application.currentVC.NavigationController.PushViewController(vc, true); |
| | | #else |
| | | |
| | | Intent 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", mESVideoInfo.HomeID); |
| | | intent.PutExtra("callId", mESVideoInfo.callId); |
| | | intent.PutExtra("Type", 1); |
| | | Shared.Application.Activity.StartActivity(intent); |
| | | |
| | | #endif |
| | | } |
| | | |
| | | #region 动作回调,提交记录到云端 |
| | | |
| | | /// <summary> |
| | | /// 判断callId是否为空 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | bool CheckESVideoInfoIsNullOrEmpty() |
| | | { |
| | | return (esVideoInfo == null || string.IsNullOrEmpty(esVideoInfo.callId)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 接听 |
| | | /// </summary> |
| | | void AnswerAction() |
| | | { |
| | | //Utlis.WriteLine("AnswerAction"); |
| | | |
| | | if (CheckESVideoInfoIsNullOrEmpty()) return; |
| | | |
| | | new Thread(() => |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(esVideoInfo); |
| | | var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Answer, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | //Utlis.WriteLine("POST 接听成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("POST 接听失败 code: " + revertObj.Code); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = false }.Start(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 挂断 |
| | | /// </summary> |
| | | /// <param name="callDuration"></param> |
| | | void HangUpAction(int callDuration) |
| | | { |
| | | //Utlis.WriteLine("HangUpAction :" + callDuration); |
| | | |
| | | if (CheckESVideoInfoIsNullOrEmpty()) return; |
| | | |
| | | new Thread(() => |
| | | { |
| | | Dictionary<string, object> dic = new Dictionary<string, object>(); |
| | | dic.Add("callId", esVideoInfo.callId); |
| | | dic.Add("callDuration", callDuration); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(dic); |
| | | var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_HangUp, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | //Utlis.WriteLine("POST 挂断成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("POST 挂断失败 code: "+ revertObj.Code); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = false }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 拒接 |
| | | /// </summary> |
| | | void RejectCallAction() |
| | | { |
| | | //Utlis.WriteLine("RejectCallAction"); |
| | | |
| | | if (CheckESVideoInfoIsNullOrEmpty()) return; |
| | | |
| | | new Thread(() => |
| | | { |
| | | Dictionary<string, object> dic = new Dictionary<string, object>(); |
| | | dic.Add("callId", esVideoInfo.callId); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(dic); |
| | | var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Reject, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | //Utlis.WriteLine("POST 拒接成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("POST 拒接失败 code: " + revertObj.Code); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = false }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 截图成功 |
| | | /// </summary> |
| | | void ScreenshotSuccessfulAction(byte[] dataBytes) |
| | | { |
| | | //Utlis.WriteLine("ScreenshotSuccessfulAction"); |
| | | |
| | | if (CheckESVideoInfoIsNullOrEmpty()) return; |
| | | |
| | | new Thread(() => |
| | | { |
| | | //var imageName = Guid.NewGuid().ToString(); |
| | | Dictionary<string, object> dic = new Dictionary<string, object>(); |
| | | dic.Add("callId", esVideoInfo.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; |
| | | /// <summary> |
| | | /// 开锁成功 |
| | | /// </summary> |
| | | void UnlockAction() |
| | | { |
| | | //Utlis.WriteLine("UnlockAction"); |
| | | |
| | | if (CheckESVideoInfoIsNullOrEmpty()) return; |
| | | |
| | | //3S内不允许触发第二次 |
| | | if(UnlockDateTime.AddSeconds(3) > DateTime.Now) |
| | | { |
| | | |
| | | Utlis.WriteLine("3S内不允许触发第二次"); |
| | | //丰林SDKbug,呼叫的时候开锁成功会有2次回调, |
| | | return; |
| | | } |
| | | |
| | | UnlockDateTime = DateTime.Now; |
| | | |
| | | new Thread(() => |
| | | { |
| | | Dictionary<string, object> dic = new Dictionary<string, object>(); |
| | | dic.Add("callId", esVideoInfo.callId); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(dic); |
| | | var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Unlock, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | | //Utlis.WriteLine("POST 开锁成功"); |
| | | } |
| | | else |
| | | { |
| | | Utlis.WriteLine("POST 开锁失败 code: " + revertObj.Code); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = false }.Start(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #if __IOS__ |
| | | #region OnESCallDelegate |
| | | /////// <summary> |
| | | /////// OnESCallDelegate 继承响应事件 |
| | | /////// </summary> |
| | | OnESCallDelegate mOnESCallDelegate; |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class OnESCallDelegate : ESCallDelegate |
| | | { |
| | | |
| | | [Weak] ESOnVideo _ESOnVideo; |
| | | |
| | | public OnESCallDelegate(ESOnVideo mESOnVideo) |
| | | { |
| | | _ESOnVideo = mESOnVideo; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 接听 |
| | | /// </summary> |
| | | public override void OnAnswerAction() |
| | | { |
| | | _ESOnVideo.AnswerAction(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 挂断 |
| | | /// </summary> |
| | | /// <param name="callDuration"></param> |
| | | public override void OnHangUpAction(int callDuration) |
| | | { |
| | | _ESOnVideo.HangUpAction(callDuration); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 拒接 |
| | | /// </summary> |
| | | public override void OnRejectCallAction() |
| | | { |
| | | _ESOnVideo.RejectCallAction(); |
| | | } |
| | | |
| | | /// <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 |
| | | _ESOnVideo.ScreenshotSuccessfulAction(dataBytes); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 开锁成功 |
| | | /// </summary> |
| | | public override void OnUnlockAction() |
| | | { |
| | | _ESOnVideo.UnlockAction(); |
| | | } |
| | | |
| | | } |
| | | |
| | | #endregion |
| | | #endif |
| | | |
| | | /// <summary> |
| | | /// 测试方法 |
| | | /// </summary> |
| | | /// <param name="isMonitor"></param> |
| | | public void Test(bool isMonitor = true) |
| | | { |
| | | ESVideoInfo eSVideoInfo = new ESVideoInfo() |
| | | { |
| | | DeviceName = "室外机88", |
| | | ESVideoUUID = "JJY000019VPLLF", |
| | | |
| | | }; |
| | | if (isMonitor) |
| | | { |
| | | ShowESVideoMonitor(eSVideoInfo); |
| | | } |
| | | else |
| | | { |
| | | eSVideoInfo.callId = "88888"; |
| | | ShowESvideoVideoIntercom(eSVideoInfo); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public class ESVideoInfo |
| | | { |
| | | /// <summary> |
| | | /// 室外机的UUID |
| | | /// 例:JJY000007FSEYX |
| | | /// </summary> |
| | | public string ESVideoUUID = string.Empty; |
| | | /// <summary> |
| | | /// 室外机的名称 |
| | | /// 例:室外机 |
| | | /// </summary> |
| | | public string DeviceName = "室外机"; |
| | | /// <summary> |
| | | /// 丰林请求的唯一id |
| | | /// </summary> |
| | | public string uuid; |
| | | /// <summary> |
| | | /// 丰林社区id |
| | | /// </summary> |
| | | public string cmtID; |
| | | /// <summary> |
| | | /// 丰林房间号 |
| | | /// </summary> |
| | | public string roomno; |
| | | /// <summary> |
| | | /// 丰林楼栋号 |
| | | /// </summary> |
| | | public string unitno; |
| | | ///// <summary> |
| | | ///// 丰林住宅Id |
| | | ///// </summary> |
| | | //public string HomeID; |
| | | /// <summary> |
| | | /// 呼叫记录Id |
| | | /// </summary> |
| | | public string callId; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | if (tempFunction == null) |
| | | { |
| | | MainPage.Log("null"); |
| | | |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | |
| | | }
|
| | | }
|
| | | } |
| | | MainPage.Log("add"); |
| | | Functions.Add(tempFunction); |
| | | } |
| | | if (filePath.StartsWith("SceneData_")) |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\EchartsOption_Pie.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\SetPir.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\AcControlPage_AddIrButton.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\Send.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\EnergyMainPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\ESOnVideo.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)DAL\" />
|
| | |
| | | <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\1ContorlPage\" />
|
| | | <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\" />
|
| | | <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\" />
|
| | | <Folder Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Energy\" />
|
| | | <Folder Include="$(MSBuildThisFileDirectory)DAL\ThirdPartySdk\" />
|
| | | </ItemGroup>
|
| | | </Project> |
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string VersionString = "1.1.0325"; |
| | | public static string VersionString = "1.1.0326"; |
| | | ///// <summary> |
| | | ///// 客户端类型 |
| | | ///// </summary> |
| | |
| | | }; |
| | | bodyView.AddChidren(btnIcon_bg); |
| | | |
| | | #if DEBUG |
| | | #if DEBUG |
| | | btnIcon_bg.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //ESOnVideo.Current.Test(); |
| | | }; |
| | | |
| | | bool b = false; |
| | | btnIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //ESOnVideo.Current.Test(false); |
| | | |
| | | //return; |
| | | if (b) |
| | | { |
| | |
| | | try |
| | | { |
| | | int index = 0; |
| | | foreach (var function in FunctionList.List.GetDeviceFunctionList()) |
| | | var list = FunctionList.List.GetDeviceFunctionList(); |
| | | foreach (var function in list) |
| | | { |
| | | //音乐模块有主从关系,需要特殊处理 |
| | | if (function.Spk_Prefix == FunctionCategory.Music) |
| | | { |
| | | var music = function as Music.A31MusicModel; |
| | | //var music = function as Music.A31MusicModel; |
| | | var music = Music.A31MusicModel.A31MusicModelList.Find((obj) => obj.sid == function.sid); |
| | | if (music == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (music.ServerClientType == -1) |
| | | { |
| | | continue; |
| | |
| | | #endregion |
| | | break; |
| | | case ShowFunction.EnergyMonitoring: |
| | | #region 能源 |
| | | functionCount = FunctionList.List.GetElectricals().Count; |
| | | functionOnCount = FunctionList.List.GetElectricals().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | #endregion |
| | | functionCount = 1; |
| | | break; |
| | | case ShowFunction.Environmental: |
| | | #region 环境数据 |
| | |
| | | |
| | | if (item != ShowFunction.Environmental && item != ShowFunction.Sensor && item != ShowFunction.VideoIntercom |
| | | && item != ShowFunction.SecurityMonitoring && item != ShowFunction.FreshAir |
| | | && item != ShowFunction.EnergyMonitoring |
| | | && functionCount != 0) |
| | | { |
| | | Button btnFunctionCount = new Button() |
| | |
| | | #endregion |
| | | break; |
| | | case ShowFunction.EnergyMonitoring: |
| | | #region 能源监测 |
| | | btnName.TextID = StringId.EnergyMonitoring; |
| | | btnFunctionViewBg.MouseUpEventHandler = (sender, e) => { |
| | | var skipView = new EnergyMainPage(); |
| | | MainPage.BasePageView.AddChidren(skipView); |
| | | skipView.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | #endregion |
| | | break; |
| | | case ShowFunction.Environmental: |
| | | #region 环境数据 |
| | |
| | | break; |
| | | case ShowFunction.FreshAir: |
| | | btnName.TextID = StringId.FreshAir; |
| | | #region Light |
| | | Button btnFreshAirPower = new Button() |
| | | { |
| | | X = Application.GetRealWidth(120), |
| | | Y = specialList.Contains(index) ? Application.GetRealWidth(160) : Application.GetRealWidth(117), |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | SelectedImagePath = "Public/PowerOpen.png", |
| | | UnSelectedImagePath = "Public/PowerClose.png", |
| | | IsSelected = functionOnCount > 0, |
| | | Tag = item + "_AllControl", |
| | | }; |
| | | functionView.AddChidren(btnFreshAirPower); |
| | | |
| | | btnFreshAirPower.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadEvent_SwitchFunction(btnFreshAirPower, item, functionView); |
| | | }; |
| | | functionPageTitleId = StringId.FreshAir; |
| | | |
| | | #endregion |
| | | break; |
| | | case ShowFunction.Music: |
| | | btnName.TextID = StringId.Music; |
| | |
| | | |
| | | } |
| | | //界面跳转--音乐跳转自己的界面--环境跳转自己的界面 |
| | | if (item != ShowFunction.Music && item != ShowFunction.Environmental && item != ShowFunction.SecurityMonitoring) |
| | | if (item != ShowFunction.Music && item != ShowFunction.Environmental && item != ShowFunction.SecurityMonitoring |
| | | && ShowFunction.EnergyMonitoring!= item) |
| | | { |
| | | btnFunctionViewBg.MouseUpEventHandler = (sender, e) => |
| | | { |
| | |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | break; |
| | | case ShowFunction.FreshAir: |
| | | foreach (var f in FunctionList.List.GetAirFreshList()) |
| | | { |
| | | f.trait_on_off.curValue = onoff; |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, f.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(f, d); |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | else |
| | |
| | | //push.frameLayout.Height = Application.GetRealHeight(50); |
| | | //push.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight); |
| | | //push.btnText.TextID = StringId.push; |
| | | //push.btnNextIcon.Width = Application.GetMinRealAverage(36); |
| | | //push.btnNextIcon.Height = Application.GetMinRealAverage(36); |
| | | //push.btnNextIcon.Width = Application.GetRealWidth(36); |
| | | //push.btnNextIcon.Height = Application.GetRealWidth(36); |
| | | //push.btnNextIcon.X = Application.GetRealWidth(305); |
| | | //push.btnNextIcon.UnSelectedImagePath = "LogicIcon/off.png"; |
| | | //push.btnNextIcon.SelectedImagePath = "LogicIcon/on.png"; |
| | |
| | | //notification.btnText.TextID = StringId.notification; |
| | | //viewLayout.AddChidren(notification.FLayoutView()); |
| | | /////上下间隔62像素 |
| | | //viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(62) }); |
| | | //viewLayout.AddChidren(new FrameLayout { Height = Application.GetRealHeight(40) }); |
| | | #endregion |
| | | |
| | | #region 保存 |
| | |
| | | /// </summary> |
| | | public Button btnStateIcon = new Button |
| | | { |
| | | Width = Application.GetMinRealAverage(28), |
| | | Height = Application.GetMinRealAverage(28), |
| | | Width = Application.GetRealWidth(28), |
| | | Height = Application.GetRealWidth(28), |
| | | Y = Application.GetRealHeight(8), |
| | | X = Application.GetRealWidth(TextSize.left12), |
| | | |
| | |
| | | public Button btnLienIcon = new Button |
| | | { |
| | | |
| | | Width = Application.GetMinRealAverage(20), |
| | | Height = Application.GetMinRealAverage(20), |
| | | Width = Application.GetRealWidth(20), |
| | | Height = Application.GetRealWidth(20), |
| | | Y = Application.GetRealHeight(66), |
| | | X = Application.GetRealWidth(48), |
| | | |
| | |
| | | }; |
| | | bodyView.AddChidren(btnOnTitle); |
| | | |
| | | #if DEBUG |
| | | btnOnIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | ESOnVideo.Current.Test(); |
| | | }; |
| | | |
| | | btnOnTitle.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | ESOnVideo.Current.Test(false); |
| | | }; |
| | | |
| | | #endif |
| | | |
| | | Button btnOnVersion = new Button() |
| | | { |
| | | Y = btnOnTitle.Bottom, |
| | |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //获取列表 |
| | | ////获取列表 |
| | | //HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () => |
| | | //{ |
| | | // Application.RunOnMainThread(() => |
| | |
| | | ///这里:监听MTTP推送下来主题; |
| | | if (mqttdate != null) |
| | | { |
| | | //休眠500毫秒,为等待云端创建deviceid; |
| | | System.Threading.Thread.Sleep(500); |
| | | //休眠1000毫秒,为等待云端创建deviceid; |
| | | System.Threading.Thread.Sleep(1000); |
| | | //读取添加遥控器deviceID,才知道是否添加成功; |
| | | GetControl(frame, control, (device) => |
| | | { |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using Shared; |
| | |
| | | UIView(vv); |
| | | |
| | | } |
| | | |
| | | void GoToShowSortSelection(List<string> dataList) |
| | | { |
| | | Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>(); |
| | | |
| | | foreach (var data in dataList) |
| | | { |
| | | //提取字符串第一位 |
| | | //string s = data.Substring(0, 1); |
| | | var key = GetCharSpellCode(data); |
| | | |
| | | if (dict.ContainsKey(key)) |
| | | { |
| | | var value = dict[key]; |
| | | if (value == null) |
| | | { |
| | | value = new List<string>(); |
| | | } |
| | | value.Add(data); |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | var value = new List<string>(); |
| | | value.Add(data); |
| | | dict.Add(key, value); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | JLCountrycode.CountryCodeView.Current.ShowSortSelection("选择红外品牌", dict, (countryName) => |
| | | { |
| | | //Console.WriteLine("countryName: " + countryName); |
| | | Utlis.ShowTip("选中了:" + countryName); |
| | | |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取汉字首字母 |
| | | /// </summary> |
| | | /// <param name="textValue"></param> |
| | | /// <returns></returns> |
| | | private string GetCharSpellCode(string textValue) |
| | | { |
| | | long iCnChar; |
| | | |
| | | byte[] ZW = Encoding.GetEncoding("gb2312").GetBytes(textValue); |
| | | |
| | | //如果是字母,则直接返回 |
| | | if (ZW.Length == 1) |
| | | { |
| | | return textValue.ToUpper(); |
| | | } |
| | | else |
| | | { |
| | | // get the array of byte from the single char |
| | | int i1 = (short)(ZW[0]); |
| | | int i2 = (short)(ZW[1]); |
| | | iCnChar = i1 * 256 + i2; |
| | | } |
| | | |
| | | |
| | | |
| | | // iCnChar match the constant |
| | | if ((iCnChar >= 45217) && (iCnChar <= 45252)) |
| | | { |
| | | return "A"; |
| | | } |
| | | else if ((iCnChar >= 45253) && (iCnChar <= 45760)) |
| | | { |
| | | return "B"; |
| | | } |
| | | else if ((iCnChar >= 45761) && (iCnChar <= 46317)) |
| | | { |
| | | return "C"; |
| | | } |
| | | else if ((iCnChar >= 46318) && (iCnChar <= 46825)) |
| | | { |
| | | return "D"; |
| | | } |
| | | else if ((iCnChar >= 46826) && (iCnChar <= 47009)) |
| | | { |
| | | return "E"; |
| | | } |
| | | else if ((iCnChar >= 47010) && (iCnChar <= 47296)) |
| | | { |
| | | return "F"; |
| | | } |
| | | else if ((iCnChar >= 47297) && (iCnChar <= 47613)) |
| | | { |
| | | return "G"; |
| | | } |
| | | else if ((iCnChar >= 47614) && (iCnChar <= 48118)) |
| | | { |
| | | return "H"; |
| | | } |
| | | else if ((iCnChar >= 48119) && (iCnChar <= 49061)) |
| | | { |
| | | return "J"; |
| | | } |
| | | else if ((iCnChar >= 49062) && (iCnChar <= 49323)) |
| | | { |
| | | return "K"; |
| | | } |
| | | else if ((iCnChar >= 49324) && (iCnChar <= 49895)) |
| | | { |
| | | return "L"; |
| | | } |
| | | else if ((iCnChar >= 49896) && (iCnChar <= 50370)) |
| | | { |
| | | return "M"; |
| | | } |
| | | |
| | | else if ((iCnChar >= 50371) && (iCnChar <= 50613)) |
| | | { |
| | | return "N"; |
| | | } |
| | | else if ((iCnChar >= 50614) && (iCnChar <= 50621)) |
| | | { |
| | | return "O"; |
| | | } |
| | | else if ((iCnChar >= 50622) && (iCnChar <= 50905)) |
| | | { |
| | | return "P"; |
| | | } |
| | | else if ((iCnChar >= 50906) && (iCnChar <= 51386)) |
| | | { |
| | | return "Q"; |
| | | } |
| | | else if ((iCnChar >= 51387) && (iCnChar <= 51445)) |
| | | { |
| | | return "R"; |
| | | } |
| | | else if ((iCnChar >= 51446) && (iCnChar <= 52217)) |
| | | { |
| | | return "S"; |
| | | } |
| | | else if ((iCnChar >= 52218) && (iCnChar <= 52697)) |
| | | { |
| | | return "T"; |
| | | } |
| | | else if ((iCnChar >= 52698) && (iCnChar <= 52979)) |
| | | { |
| | | return "W"; |
| | | } |
| | | else if ((iCnChar >= 52980) && (iCnChar <= 53640)) |
| | | { |
| | | return "X"; |
| | | } |
| | | else if ((iCnChar >= 53689) && (iCnChar <= 54480)) |
| | | { |
| | | return "Y"; |
| | | } |
| | | else if ((iCnChar >= 54481) && (iCnChar <= 55289)) |
| | | { |
| | | return "Z"; |
| | | } |
| | | else return (""); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载UI界面 |
| | | /// </summary> |
| | |
| | | /// <summary> |
| | | /// 当前个数 |
| | | /// </summary> |
| | | public Button geBtn = new Button |
| | | public TextButton geBtn = new TextButton |
| | | { |
| | | Y = Application.GetRealHeight(40), |
| | | X = Application.GetRealWidth(72), |
| | |
| | | geBtn.Width = geBtn.GetTextWidth(); |
| | | devfLayout.AddChidren(sumBtn); |
| | | sumBtn.X = geBtn.Right; |
| | | sumBtn.TextAlignment = TextAlignment.CenterLeft; |
| | | devfLayout.AddChidren(stateIconBtn); |
| | | devfLayout.AddChidren(stateTextBtn); |
| | | devfLayout.AddChidren(lineBtn); |
| | |
| | | |
| | | var bodyView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(463), |
| | | Height = Application.GetRealHeight(375), |
| | | Y = Application.GetRealHeight(423), |
| | | Height = Application.GetRealHeight(296), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | div.AddChidren(bodyView); |
| | |
| | | { |
| | | Y = Application.GetRealHeight(16), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(296), |
| | | Width = Application.GetRealWidth(296+200), |
| | | |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | |
| | | var row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | }; |
| | | contentView.AddChidren(row); |
| | | var row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | |
| | | int index = 0; |
| | | int index = 0; |
| | | List<FunctionAttributes> attrList = new List<FunctionAttributes>(); |
| | | attrList.AddRange(device.attributes); |
| | | attrList.Add(new FunctionAttributes() { |
| | | key = "+", |
| | | }); |
| | | |
| | | |
| | | foreach (var attr in attrList) |
| | | { |
| | |
| | | row = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(56), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | } |
| | |
| | | btnAdd.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | var addButton = new AcControlPage_AddIrButton(); |
| | | Action action = () => { |
| | | LoadDialog_IrMoreView(); |
| | | }; |
| | | var addButton = new AcControlPage_AddIrButton(action); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(device); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | |
| | | |
| | | index++; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | dialog.Show(); |
| | | } |
| | |
| | | { |
| | | public class AcControlPage_AddIrButton : FrameLayout |
| | | { |
| | | public AcControlPage_AddIrButton() |
| | | Action action; |
| | | |
| | | public AcControlPage_AddIrButton(Action act) |
| | | { |
| | | action = act; |
| | | } |
| | | public void Show(Function control) |
| | | { |
| | |
| | | buttonObj.key = "key" + control.attributes.Count.ToString(); |
| | | buttonObj.value = texts; |
| | | |
| | | PirSend.CodeStudy(new Control() { deviceId = control.deviceId,sid = control.sid }, buttonObj, (mqttData) => |
| | | { |
| | | if (mqttData != null)// && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") |
| | | { |
| | | Method method = new Method(); |
| | | Method.buttondata = ""; |
| | | var mqttdate = method.MqttDate("按键", control.sid, 25); |
| | | if (mqttdate != null) |
| | | { |
| | | this.RemoveFromParent(); |
| | | control.attributes.Add(new FunctionAttributes() { key = buttonObj.key, value = new System.Collections.Generic.List<string>() { buttonObj.value } }); |
| | | } |
| | | else |
| | | { |
| | | replication.RemView(); |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); |
| | | } |
| | | |
| | | }); |
| | | |
| | | |
| | | PirSend.CodeStudy(new Control() { deviceId = control.deviceId, sid = control.sid }, buttonObj, (mqttData) => |
| | | { |
| | | if (mqttData != null) |
| | | { |
| | | control.attributes.Add(new FunctionAttributes() { key = buttonObj.key, value = new System.Collections.Generic.List<string>() { buttonObj.value } }); |
| | | this.RemoveFromParent(); |
| | | action?.Invoke(); |
| | | //new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiachenggong)); |
| | | } |
| | | else |
| | | { |
| | | this.RemoveFromParent(); |
| | | new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class EnergyMainPage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | public EnergyMainPage() |
| | | { |
| | | bodyView = this; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.EnergyMonitoring)).LoadTopView(); |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | |
| | | var generalTableView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(80), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealWidth(148), |
| | | Radius = (uint)Application.GetRealWidth(5), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(generalTableView); |
| | | |
| | | TextButton btnTotalValue = new TextButton() |
| | | { |
| | | X = Application.GetRealWidth(18), |
| | | Y = Application.GetRealWidth(24), |
| | | Width = Application.GetRealWidth(18), |
| | | Height = Application.GetRealWidth(52), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 40, |
| | | Text = "000" |
| | | }; |
| | | generalTableView.AddChidren(btnTotalValue); |
| | | |
| | | btnTotalValue.Width = btnTotalValue.GetTextWidth(); |
| | | |
| | | var btnTotalValueUint = new Button() |
| | | { |
| | | X = btnTotalValue.Right, |
| | | Y = Application.GetRealWidth(24), |
| | | Width = Application.GetRealWidth(60), |
| | | Height = Application.GetRealWidth(28), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | IsBold = true, |
| | | Text = "kW‧h", |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | generalTableView.AddChidren(btnTotalValueUint); |
| | | |
| | | var btnValue = new Button() |
| | | { |
| | | X = Application.GetRealWidth(18), |
| | | Y = btnTotalValue.Bottom, |
| | | Width = Application.GetRealWidth(209), |
| | | Height = Application.GetRealWidth(28), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | IsBold = true, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | generalTableView.AddChidren(btnValue); |
| | | |
| | | var echartsView = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(118), |
| | | Height = Application.GetRealWidth(118), |
| | | X = Application.GetRealWidth(227), |
| | | //Y = Application.GetRealWidth(16), |
| | | }; |
| | | generalTableView.AddChidren(echartsView); |
| | | MyEchartsViewOn myEchartsView = new MyEchartsViewOn() { |
| | | Width = Application.GetRealWidth(118), |
| | | Height = Application.GetRealWidth(118), |
| | | }; |
| | | |
| | | echartsView.AddChidren(myEchartsView); |
| | | Dictionary<string, string> list = new Dictionary<string, string>(); |
| | | list.Add("电冰箱", "12"); |
| | | list.Add("电风扇", "2"); |
| | | list.Add("空调", "9"); |
| | | list.Add("洗衣机", "3"); |
| | | list.Add("电脑", "33"); |
| | | var echartsPie = new EchartsOption_Pie(); |
| | | var echartRootJson = echartsPie.InitDateJson(list); |
| | | //var echartRootJsonString = Newtonsoft.Json.JsonConvert.SerializeObject(echartRootJson); |
| | | myEchartsView.ShowWithOption(echartRootJson); |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | public class EchartsOption_Pie |
| | | { |
| | | public string name = ""; |
| | | |
| | | public string type = "pie"; |
| | | |
| | | public string radius = "55%"; |
| | | |
| | | public List<OpthionData> data = new List<OpthionData>(); |
| | | |
| | | public string itemStyle = ""; |
| | | |
| | | public EchartsOption_Pie() |
| | | public string InitDateJson(Dictionary<string, string> list) |
| | | { |
| | | //组装Value |
| | | string valueText = string.Empty; |
| | | foreach (var dic in list) |
| | | { |
| | | valueText += "{value:" + dic.Value + ",name:'" + dic.Key + "'},\r\n"; |
| | | } |
| | | //获取曲线控件共通Option |
| | | //{0}:光标移动时,那条竖线的颜色 |
| | | //{1}:X轴的组员项 |
| | | //{2}:Y轴的单位格式 |
| | | //{3}:X轴组员对应的值 |
| | | //{4}:曲线的颜色 |
| | | string commonJson = this.GetChartControlCommonOption(); |
| | | commonJson = commonJson.Replace("{0}", valueText); |
| | | return commonJson; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取曲线控件共通Option |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private string GetChartControlCommonOption() |
| | | { |
| | | //{0}:数据 |
| | | |
| | | //tooltip: |
| | | // { |
| | | // trigger: 'item', |
| | | // padding: 40, |
| | | // textStyle: |
| | | // { |
| | | // fontSize: 38, |
| | | // }, |
| | | // show: true, |
| | | // trigger: 'item', |
| | | // position:['1%', '1%'] |
| | | // }, |
| | | #if __IOS__ |
| | | return @"{ |
| | | series : [ |
| | | { |
| | | right: '54%', |
| | | bottom:'54%', |
| | | labelLine: false, |
| | | type: 'pie', |
| | | data:[ |
| | | {0} |
| | | ], |
| | | itemStyle: { |
| | | normal:{ |
| | | color:function(params) { |
| | | var colorList = [ |
| | | '#80AEFF','#FFD154','#FF9D54','#FE6A6A','#B183C3','#ADE764', |
| | | '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0' |
| | | ]; |
| | | return colorList[params.dataIndex] |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | ] |
| | | }"; |
| | | #else |
| | | return @"{ |
| | | series : [ |
| | | { |
| | | //right: '54%', |
| | | //bottom:'54%', |
| | | labelLine: false, |
| | | type: 'pie', |
| | | data:[ |
| | | {0} |
| | | ], |
| | | itemStyle: { |
| | | normal:{ |
| | | color:function(params) { |
| | | var colorList = [ |
| | | '#80AEFF','#FFD154','#FF9D54','#FE6A6A','#B183C3','#ADE764', |
| | | '#D7504B','#C6E579','#F4E001','#F0805A','#26C0C0' |
| | | ]; |
| | | return colorList[params.dataIndex] |
| | | } |
| | | }, |
| | | } |
| | | } |
| | | ] |
| | | }"; |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 颜色列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<string> ColorList () |
| | | { |
| | | var list = new List<string>(); |
| | | return list; |
| | | } |
| | | } |
| | | |
| | | public class OpthionData |
| | | { |
| | | public int value = 0; |
| | | public string name = ""; |
| | | } |
| | | |
| | | public class ItemStyle |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.IO; |
| | | using System.Net; |
| | | |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.Video |
| | | { |
| | | public class Send |
| | | { |
| | | public Send() |
| | | { |
| | | } |
| | | |
| | | ///// <summary> |
| | | ///// 获取可视对讲列表 |
| | | ///// </summary> |
| | | //static async System.Threading.Tasks.Task<List<VideoCalss>> GetVideoInfoList(CloudsVideo clouds) |
| | | //{ |
| | | // List<VideoCalss> eSVideoInfosList = new List<VideoCalss>(); |
| | | // var jobject = new JObject(); |
| | | // jobject.Add("cmtID", clouds.FLCommunityID); |
| | | // jobject.Add("unitno", clouds.FLBuildingID); |
| | | // jobject.Add("method", "getUUIDList"); |
| | | // var url = "http://112.74.164.111:180/api.php/Device/getmonitorUUID"; |
| | | // var str = await Send.HttpWebRequest(url, jobject.ToString(), "POST"); |
| | | // if (string.IsNullOrEmpty(str)) |
| | | // { |
| | | // return eSVideoInfosList; |
| | | // } |
| | | // var json = JObject.Parse(str); |
| | | // if (json == null) |
| | | // { |
| | | // return eSVideoInfosList; |
| | | // } |
| | | // if (json["resCode"].ToString() != "0") |
| | | // { |
| | | // return eSVideoInfosList; |
| | | // } |
| | | // var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(json["list"].ToString()); |
| | | // if (list.Count == 0) |
| | | // { |
| | | // return eSVideoInfosList; |
| | | // } |
| | | // foreach (var videoInfo in list) |
| | | // { |
| | | // VideoCalss eSVideoInfo = new VideoCalss(); |
| | | // eSVideoInfo.ESRoomID = int.Parse(clouds.FLRoomID); |
| | | // string str1 = clouds.FLBuildingID.Substring(0, 2).TrimStart('0'); |
| | | // string str2 = clouds.FLBuildingID.Substring(2, 2).TrimStart('0'); |
| | | // eSVideoInfo.RoomName = str1 + Language.StringByID(R.MyInternationalizationString.dong) + str2 + Language.StringByID(R.MyInternationalizationString.unit); |
| | | // eSVideoInfo.DeviceName = videoInfo["aliasName"]; |
| | | // if (videoInfo["uuid"].Contains(",")) |
| | | // { |
| | | // var uuid = videoInfo["uuid"].Split(','); |
| | | // eSVideoInfo.ESVideoUUID = uuid[0]; |
| | | // } |
| | | // else |
| | | // { |
| | | // eSVideoInfo.ESVideoUUID = videoInfo["uuid"]; |
| | | // } |
| | | // eSVideoInfosList.Add(eSVideoInfo); |
| | | // } |
| | | // return eSVideoInfosList; |
| | | //} |
| | | |
| | | ///// <summary> |
| | | ///// 请求服务器的方法(支持请求方式为POST/GET) |
| | | ///// </summary> |
| | | ///// <param name="getUrl">请求的地址</param> |
| | | ///// <param name="str">请求数据</param> |
| | | ///// <param name="method">请求方式为POST/GET</param> |
| | | ///// <param name="second">超时时间</param> |
| | | ///// <returns></returns> |
| | | //public static async System.Threading.Tasks.Task<string> HttpWebRequest(string getUrl, string str, string method, int second = 3, bool _bool = false) |
| | | //{ |
| | | // try |
| | | // { |
| | | // HttpWebRequest request = WebRequest.Create(getUrl) as HttpWebRequest; //创建请求 |
| | | // request.Method = method; //请求方式为POST/GET |
| | | // request.ContentType = "application/json"; |
| | | // request.Timeout = second * 1000;//超时时间 |
| | | // if (_bool) |
| | | // { |
| | | // //用于高胜可视对讲接口 |
| | | // request.Headers.Add("Authorization", Config.Instance.Token); |
| | | // } |
| | | // if (method == "POST") |
| | | // { |
| | | // byte[] jsonbyte = System.Text.Encoding.UTF8.GetBytes(str); |
| | | // request.ContentLength = jsonbyte.Length; |
| | | // Stream postStream = request.GetRequestStream(); |
| | | // postStream.Write(jsonbyte, 0, jsonbyte.Length); |
| | | // postStream.Close(); |
| | | // } |
| | | // //发送请求并获取相应回应数据 |
| | | // HttpWebResponse res; |
| | | // try |
| | | // { |
| | | // res = (HttpWebResponse)request.GetResponse(); |
| | | // } |
| | | // catch (WebException ex) |
| | | // { |
| | | // res = (HttpWebResponse)ex.Response; |
| | | // } |
| | | // StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8); |
| | | // string content = sr.ReadToEnd(); //获得响应字符串 |
| | | // return content; |
| | | // } |
| | | // catch |
| | | // { |
| | | // return null; |
| | | // } |
| | | // } |
| | | |
| | | } |
| | | } |