Merge branch 'temp-wxr' into WJC
35个文件已添加
1个文件已删除
62个文件已修改
| | |
| | | 437=Device List |
| | | 438=humidity:{0}% air:{1} wind:{2} |
| | | |
| | | |
| | | 1000=Indoor Humidity |
| | | 1001=V-chip |
| | | 1002=Anion |
| | |
| | | 437=设备列表 |
| | | 438=湿度:{0}% 空气:{1} 风速:{2}级 |
| | | |
| | | |
| | | 1000=室内湿度 |
| | | 1001=童锁 |
| | | 1002=负离子 |
| | |
| | | 6078=系统维护中~请稍后再试~ |
| | | 6079=获取数据失败 |
| | | 6080=暂时不支持该功能 |
| | | |
| | | |
| | | 7000=新建自动化 |
| | | 7001=编辑自动化 |
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> |
| | | <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\Phone\FunctionIcon\EnvirSensor\Pm25Bg.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\0.png" /> |
| | | <AndroidAsset Include="Assets\Phone\PirIcon\add.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\AC\More.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> |
| | |
| | | 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); |
| | | |
| | | 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="202103191" android:versionName="1.1.202103191" 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> |
| | |
| | | <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> |
| | |
| | | <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: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; |
| | |
| | | if(expandDataNSD.ContainsKey(new NSString("messageType"))){ |
| | | messageType = expandDataNSD["messageType"] as NSString; |
| | | Utlis.WriteLine("messageType: "+ messageType); |
| | | } |
| | | |
| | | if (expandDataNSD.ContainsKey(new NSString("expantContent"))) |
| | | { |
| | | expantContent = expandDataNSD["expantContent"] as NSString; |
| | | Utlis.WriteLine("expantContent: " + expantContent); |
| | | } |
| | | |
| | | } |
| | |
| | | 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) |
| | | { |
| | | if (pushMes.Extras.Contains("OffLine")) |
| | | { |
| | | //haveToSignOut = true; |
| | | //强制下线 |
| | |
| | | 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); |
| | | |
| | | } |
| | | } |
| | |
| | | <WarningLevel>4</WarningLevel> |
| | | <CodesignEntitlements>Entitlements.plist</CodesignEntitlements> |
| | | <MtouchArch>ARM64</MtouchArch> |
| | | <CodesignKey>iPhone Distribution: HDL Automation Co., Ltd (BVTA78PRYA)</CodesignKey> |
| | | <CodesignProvision>Automatic:AdHoc</CodesignProvision> |
| | | <CodesignKey>Apple Distribution: HDL Automation Co., Ltd (BVTA78PRYA)</CodesignKey> |
| | | <MtouchLink>SdkOnly</MtouchLink> |
| | | </PropertyGroup> |
| | | <ItemGroup> |
| | |
| | | </Reference> |
| | | <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> |
| | |
| | | <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" /> |
| | |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\TempIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\TvocIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\PirIcon\add.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\AC\More.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | <key>UIStatusBarStyle</key> |
| | | <string>UIStatusBarStyleLightContent</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>1.1.202103181</string> |
| | | <string>1.1.202103262</string> |
| | | <key>CFBundleVersion</key> |
| | | <string>202103181</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 |
| | |
| | | continue; |
| | | } |
| | | var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); |
| | | //if (newFunction == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | //{ |
| | | // FunctionList.List.DeleteFunction(localFunction); |
| | | //} |
| | | //else |
| | | //{ |
| | | // MainPage.Log($"deviceType:{localFunction.spk} local:{localFunction.modifyTime} server:{newFunction.modifyTime}"); |
| | | // i++; |
| | | // //if (localFunction.modifyTime != newFunction.modifyTime) |
| | | // //{ |
| | | // // //可优化 |
| | | // // localFunction.name = newFunction.name; |
| | | // // localFunction.collect = newFunction.collect; |
| | | // // localFunction.modifyTime = newFunction.modifyTime; |
| | | // // localFunction.roomIds = newFunction.roomIds; |
| | | // // localFunction.bus = newFunction.bus; |
| | | // // localFunction.SaveFunctionFile(); |
| | | // //} |
| | | // localFunction = newFunction; |
| | | // localFunction.SaveFunctionFile(); |
| | | // deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | //} |
| | | |
| | | if (delFile == localFunction.savePath) |
| | | { |
| | |
| | | } |
| | | delFile = localFunction.savePath; |
| | | FunctionList.List.DeleteFunction(localFunction); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | //处理剩下的新增功能 |
| | | foreach (var newFunction in deviceList.list) |
| | | { |
| | | MainPage.Log(newFunction.savePath); |
| | | newFunction.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(newFunction.savePath); |
| | | } |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取功能信息 |
| | | /// </summary> |
| | | public void GetFunctionInfo(string functionId) |
| | | { |
| | | var deviceResult = Ins.HttpRequest.GetDeviceInfo(functionId); |
| | | if (deviceResult.Code == StateCode.SUCCESS) |
| | | { |
| | | MainPage.Log($"读取设备信息成功"); |
| | | var packList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); |
| | | |
| | | foreach(var function in packList.list) |
| | | { |
| | | function.SaveFunctionFile(); |
| | | FunctionList.List.IniFunctionList(function.savePath,true); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | string RootPath = Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + "/"; |
| | | |
| | | string accountPath; |
| | | string AccountPath { |
| | | string AccountPath |
| | | { |
| | | get |
| | | { |
| | | if (string.IsNullOrEmpty(accountPath) || !accountPath.Contains(UserInfo.Current.ID)) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | 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> |
| | | /// 下载网络图片 |
| | |
| | | { |
| | | 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 != null && jpushMessageInfo.messageType.Contains("Alarm")) |
| | | if (jpushMessageInfo.messageType.Contains(PushMessageType.Alarm.ToString())) |
| | | { |
| | | //报警推送弹窗提示 |
| | | ShowAlarmPushMessage(jpushMessageInfo); |
| | | //new Alert(jpushMessageInfo.Title, jpushMessageInfo.Content, Language.StringByID(StringId.Close)).Show(); |
| | | } |
| | | 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(",")) |
| | | { |
| | | 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; |
| | |
| | | case SPK.LightRGB: |
| | | break; |
| | | case SPK.FloorHeatStandard: |
| | | if (f.status.Find((obj)=>obj.key ==FunctionAttributeKey.Mode) == null) |
| | | { |
| | | foreach (var dic in f.status) |
| | | { |
| | | switch (dic.key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 20, dic.value.ToString() == "on" ? (byte)1 : (byte)0, f.localFunction.bus.LoopId }); |
| | | break; |
| | | case "mode": |
| | | ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { 21, Convert.ToByte(dic.value), f.localFunction.bus.LoopId }); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | ControlBytesSend(Command.InstructionPanelKey, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { |
| | | 25, Convert.ToByte(dic.value), f.localFunction.bus.LoopId }); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | byte onoff_1 = 0; |
| | | byte setTemp_1 = 0; |
| | | byte mode_1 = 0; |
| | |
| | | } |
| | | ControlBytesSend(Command.SetFloorHeat, f.localFunction.bus.SubnetID, f.localFunction.bus.DeviceID, new byte[] { |
| | | f. localFunction.bus.LoopId, onoff_1, 0, setTemp_1, mode_1, setTemp_1, setTemp_1, setTemp_1, 0, 0 }); |
| | | } |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | foreach (var attr in f.status) |
| | |
| | | byte lightBri = Convert.ToByte(function.GetAttrState(FunctionAttributeKey.Brightness)); |
| | | if (lightBri == 0) |
| | | { |
| | | b = 100; |
| | | b1 = 100; |
| | | } |
| | | else |
| | | { |
| | | b = lightBri; |
| | | b1 = lightBri; |
| | | } |
| | | } |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { |
| | |
| | | { |
| | | case SPK.AcStandard: |
| | | var ac = new AC(); |
| | | ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { function.bus.LoopId, 0, 32, 32, 32, 32, 32, 0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, |
| | | ac.GetModeIndex(function), |
| | | ac.GetFanIndex(function), Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), 0 }); |
| | | //ControlBytesSend(Command.SetACMode, subnetId, deviceId, new byte[] { function.bus.LoopId, 0, 32, 32, 32, 32, 32, 0, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, |
| | | // ac.GetModeIndex(function), |
| | | // ac.GetFanIndex(function), Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), 0 }); |
| | | foreach (var dic in commandDictionary) |
| | | { |
| | | switch (dic.Key) |
| | |
| | | case "fan": |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 5, ac.GetFanIndex(function), function.bus.LoopId }); |
| | | break; |
| | | case "temp": |
| | | case FunctionAttributeKey.SetTemp: |
| | | byte modeKey = 4; |
| | | switch (ac.GetModeIndex(function)) |
| | | { |
| | |
| | | case SPK.FloorHeatStandard: |
| | | if (function.Fh_Mode_Temp.Count == 4) |
| | | { |
| | | if (function.GetAttribute(FunctionAttributeKey.Mode) == null) |
| | | { |
| | | foreach (var dic in commandDictionary) |
| | | { |
| | | switch (dic.Key) |
| | | { |
| | | case FunctionAttributeKey.OnOff: |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 20, function.trait_on_off.curValue.ToString() == "on" ? (byte)1 : (byte)0, function.bus.LoopId }); |
| | | break; |
| | | case "mode": |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { 21, fhTemp.GetModeIndex(function), function.bus.LoopId }); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | byte modeKey = 25; |
| | | switch (fhTemp.GetModeIndex(function)) |
| | | { |
| | | case 1: |
| | | modeKey = 25; |
| | | break; |
| | | case 2: |
| | | modeKey = 26; |
| | | break; |
| | | case 3: |
| | | modeKey = 27; |
| | | break; |
| | | case 4: |
| | | modeKey = 28; |
| | | break; |
| | | } |
| | | ControlBytesSend(Command.InstructionPanelKey, function.bus.SubnetID, function.bus.DeviceID, new byte[] { |
| | | modeKey, Convert.ToByte(function.GetAttrState(FunctionAttributeKey.SetTemp)), function.bus.LoopId }); |
| | | break; |
| | | default: |
| | | MainPage.Log($"功能未支持 : {dic.Key}"); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | var onoffString = function.trait_on_off.curValue.ToString(); |
| | | byte b1 = 1; |
| | | if(onoffString == "off") |
| | |
| | | ControlBytesSend(Command.SetFloorHeat, subnetId, deviceId, new byte[] { function.bus.LoopId, b1, |
| | | (byte)tt,fhTemp.GetModeIndex(function), function.Fh_Mode_Temp["normal"], function.Fh_Mode_Temp["day"], function.Fh_Mode_Temp["night"], function.Fh_Mode_Temp["away"], 0, 0 }); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | break; |
| | |
| | | break; |
| | | case SPK.ElectricSocket: |
| | | ControlBytesSend(Command.SetSingleLight, subnetId, deviceId, new byte[] { function.bus.LoopId, function.trait_on_off.curValue.ToString() == "on" ? (byte)100 : (byte)0 }); |
| | | break; |
| | | } |
| | | 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; |
| | |
| | | break; |
| | | } |
| | | 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; |
| | | } |
| | | } |
| | |
| | | case Command.SetACMode: |
| | | case Command.ReadFloorHeat: |
| | | case Command.SetFloorHeat: |
| | | case Command.FreshAirRead: |
| | | case Command.FreshAirControl: |
| | | case Command.FreshAirRead_JinMao: |
| | | case Command.FreshAirControl_JinMao: |
| | | this.sendFlag += string.Format("{0}", target.AddData[0]); |
| | | break; |
| | | case Command.SetLogicLoopColor: |
| | |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[2].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString()); |
| | | function.trait_on_off.curValue = receiveBytes[8] == 1 ? "on" : "off"; |
| | | acFunction.SetMode(receiveBytes[9],function); |
| | | acFunction.SetFan(receiveBytes[10],function); |
| | |
| | | { |
| | | function.Fh_Mode_Temp.Add("away", receiveBytes[7]); |
| | | } |
| | | |
| | | if (function.GetAttribute(FunctionAttributeKey.Mode) == null) |
| | | { |
| | | function.SetAttrState(FunctionAttributeKey.SetTemp, receiveBytes[4].ToString()); |
| | | } |
| | | else |
| | | { |
| | | switch (function.GetAttrState(FunctionAttributeKey.Mode)) |
| | | { |
| | | case "normal": |
| | |
| | | function.lastState = Language.StringByID(StringId.Away); |
| | | break; |
| | | } |
| | | } |
| | | var indoorTemp = 0; |
| | | if (receiveBytes[9] > 128) |
| | | { |
| | |
| | | { |
| | | indoorTemp = receiveBytes[9]; |
| | | } |
| | | function.SetAttrState(FunctionAttributeKey.IndoorTemp, indoorTemp); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, indoorTemp); |
| | | |
| | | if (function.GetAttribute(FunctionAttributeKey.Mode) == null) |
| | | { |
| | | function.lastState = ""; |
| | | } |
| | | else |
| | | { |
| | | function.lastState += " " + function.GetAttrState(FunctionAttributeKey.Mode) + new FloorHeating().GetTempUnitString(function); |
| | | } |
| | | RoomPage.UpdataStates(function); |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | |
| | | { |
| | | if (ac.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | { |
| | | ac.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[1].ToString()); |
| | | ac.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[1].ToString()); |
| | | FunctionPage.UpdataStates(ac); |
| | | } |
| | | } |
| | |
| | | Control.Ins.IsSearchLocalGatewaySuccessful = true; |
| | | Control.Ins.GatewayOnline_Local = true; |
| | | DAL.Mqtt.MqttClient.DisConnectRemote();//断开mqtt |
| | | } |
| | | break; |
| | | case Command.FreshAirControlACK_JinMao: |
| | | case Command.FreshAirReadACK_JinMao: |
| | | var airFresh = FunctionList.List.GetAirFreshList().Find((obj) => obj.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]); |
| | | if (airFresh != null) |
| | | { |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 humidification/fan |
| | | /// 5 节能舒适选择 1-舒适,2-节能 true/false |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 level_1/level_2/level_3/auto |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 true/false |
| | | airFresh.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[2] == 0 ? "off" : "on"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Mode, receiveBytes[3] == 1 ? "humidification" : "fan"); |
| | | airFresh.SetAttrState(FunctionAttributeKey.Energy, receiveBytes[4] == 1 ? "true" : "false"); |
| | | switch (receiveBytes[5]) |
| | | { |
| | | case 0: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "auto"); |
| | | break; |
| | | case 1: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_1"); |
| | | break; |
| | | case 2: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_2"); |
| | | break; |
| | | case 3: |
| | | airFresh.SetAttrState(FunctionAttributeKey.FanSpeed, "level_3"); |
| | | break; |
| | | } |
| | | airFresh.SetAttrState(FunctionAttributeKey.Humidity, receiveBytes[6].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.IndoorTemp, receiveBytes[7].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.IndoorHumidity, receiveBytes[8].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterRemain, receiveBytes[9].ToString()); |
| | | airFresh.SetAttrState(FunctionAttributeKey.FilterTimeout, receiveBytes[10] == 1 ? "true" : "false"); |
| | | } |
| | | break; |
| | | } |
| | |
| | | switch (command) |
| | | { |
| | | case Command.SetSingleLightACK: |
| | | case Command.FreshAirReadACK: |
| | | case Command.FreshAirControlACK: |
| | | case Command.FreshAirReadACK_JinMao: |
| | | case Command.FreshAirControlACK_JinMao: |
| | | receiveFlag += string.Format("{0}", usefulBytes[0]); |
| | | break; |
| | | case Command.SetLogicLoopColorACK: |
| | |
| | | try |
| | | { |
| | | var topic = e.ApplicationMessage.Topic; |
| | | MainPage.Log($"收到mqtt主题:{topic}"); |
| | | //MainPage.Log($"收到mqtt主题:{topic}"); |
| | | //一端口主题处理 |
| | | if (DB_ResidenceData.Instance.GatewayType == 0 && !DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) |
| | | { |
| | |
| | | IsOthreShare = mHome.IsOtherShare, |
| | | accountType = mHome.accountType, |
| | | isRemoteControl = mHome.isRemoteControl, |
| | | isBindGateway = mHome.isBindGateway, |
| | | longitude = mHome.longitude, |
| | | latitude = mHome.latitude, |
| | | deliverstatus = mHome.deliverstatus, |
| | |
| | | Address = mHome.homeAddress, |
| | | isAllowCreateScene = mHome.isAllowCreateScene, |
| | | }; |
| | | if (home.isBindGateway) |
| | | { |
| | | UserInfo.Current.regionList.Add(home); |
| | | } |
| | | } |
| | | if(UserInfo.Current.regionList.Count== 0) |
| | | { |
| | | return "null"; |
| | | } |
| | | //-------如果账号是首次登录 |
| | | if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) |
| | |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备详情 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetDeviceInfo(string functionId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); |
| | | d.Add("deviceIds", new List<string>() { functionId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取设备详情列表 |
| | |
| | | /// 固定域名,正式环境 |
| | | /// 公共域名就近解析 |
| | | /// </summary> |
| | | public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; |
| | | public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; |
| | | /// <summary> |
| | | /// RegionMark |
| | | /// </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; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | ReadAnalog = 0xE50A, |
| | | ReadAnalogACK = 0xE50B, |
| | | |
| | | #region 新风协议 |
| | | //新风协议控制 |
| | | //附加数据: 新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) |
| | | FreshAirControl = 0x144A, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时)+模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirControlACK = 0x144B, |
| | | //2.新风协议读状态 |
| | | //附加数据: 新风通道号(1 - 200) |
| | | FreshAirRead = 0x144C, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) +模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirReadACK = 0x144D, |
| | | #endregion |
| | | |
| | | #region 金茂府 昆明 温州 新风协议 |
| | | /// <summary> |
| | | /// 附加数据长度:1 |
| | | /// 新风编号 1~200 |
| | | /// </summary> |
| | | FreshAirRead_JinMao = 0x1446, |
| | | /// <summary> |
| | | /// 附加数据长度:30 |
| | | /// 1 新风编号 1~200 |
| | | /// 2 类型 第三方类型 0:金茂新风 |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 |
| | | /// 5 节能舒适选择 1-舒适,2-节能 |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 |
| | | /// </summary> |
| | | FreshAirReadACK_JinMao = 0x1447, |
| | | /// <summary> |
| | | /// 附加数据长度:4 |
| | | /// 1 新风编号 1~200 |
| | | /// 2 类型 第三方类型 0:金茂新风 |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 |
| | | /// 5 节能舒适选择 1-舒适,2-节能 |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 1 超时 0 无 |
| | | /// </summary> |
| | | FreshAirControl_JinMao = 0x1448, |
| | | /// <summary> |
| | | /// 附加数据长度:30 |
| | | /// 1 新风编号 1~200 |
| | | /// 2 类型 第三方类型 0:金茂新风 |
| | | /// 3 开关 0-关机,1-开机 |
| | | /// 4 运行模式 1-通风,2-加湿 |
| | | /// 5 节能舒适选择 1-舒适,2-节能 |
| | | /// 6 风速档位 0-自动,1-1档,2-2档,3-3档 |
| | | /// 7 湿度设定 % |
| | | /// 8 室内温度值 ℃ |
| | | /// 9 室内湿度值 ℃ |
| | | /// 10 过滤网剩余 % |
| | | /// 11 过滤网使用超时 |
| | | /// </summary> |
| | | FreshAirControlACK_JinMao = 0x1449, |
| | | #endregion |
| | | |
| | | |
| | | #region 绿建温控器协议 |
| | | /// <summary> |
| | | /// 读取温控器主机指令 |
| | |
| | | LogicstateControl = 0xE014, |
| | | LogicstateControlACK = 0xE015, |
| | | |
| | | #region 新风协议 |
| | | //新风协议控制 |
| | | //附加数据: 新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) |
| | | FreshAirControl = 0x144A, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时)+模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirControlACK = 0x144B, |
| | | |
| | | |
| | | //2.新风协议读状态 |
| | | //附加数据: 新风通道号(1 - 200) |
| | | FreshAirRead = 0x144C, |
| | | //返回:新风通道号(1 - 200) + 开关(0,1) + 风速(0 关,1低,2中,3高) + 模式(0手动,1 自动,2 智能,3 定时) +模拟量(2byte==16bit)+ |
| | | //室内温度(4byte) + 室外温度(4byte) + 室内湿度(4byte)+ PM2.5(4byte) + TVOC(4byte) + CO2(4byte) |
| | | FreshAirReadACK = 0x144D, |
| | | |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 布防设置 |
| | |
| | | /// <summary> |
| | | /// 室内温度 |
| | | /// </summary> |
| | | public const string IndoorTemp = "room_temp"; |
| | | public const string RoomTemp = "room_temp"; |
| | | /// <summary> |
| | | /// value |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public const string AnionTimeLeft = "anion_time_surplus"; |
| | | /// <summary> |
| | | /// 打开登记(风扇) |
| | | /// 打开等级(风扇) |
| | | /// </summary> |
| | | public const string OpenLevel = "openLevel"; |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | public const string Key = "key"; |
| | | |
| | | /// <summary> |
| | | /// 节能 |
| | | /// </summary> |
| | | public const string Energy = "energy"; |
| | | /// <summary> |
| | | /// 湿度 |
| | | /// </summary> |
| | | public const string Humidity = "humidity"; |
| | | /// <summary> |
| | | /// 室内温度 |
| | | /// </summary> |
| | | public const string IndoorTemp = "indoor_temp"; |
| | | /// <summary> |
| | | /// 室内湿度 |
| | | /// </summary> |
| | | public const string IndoorHumidity = "indoor_humidity"; |
| | | /// <summary> |
| | | /// 过滤网剩余量 |
| | | /// </summary> |
| | | public const string FilterRemain = "filter_remain"; |
| | | /// <summary> |
| | | /// 过滤网是否超时警告 |
| | | /// </summary> |
| | | public const string FilterTimeout = "filter_timeout"; |
| | | |
| | | #region tuya |
| | | /// <summary> |
| | |
| | | { |
| | | get |
| | | { |
| | | try |
| | | { |
| | | return Convert.ToByte(loopId, 16); |
| | | }catch |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /// (新风) |
| | | /// </summary> |
| | | public const string AirFreshStandard = "airFresh.standard"; |
| | | /// <summary> |
| | | /// 新风 ——金茂定制 |
| | | /// </summary> |
| | | public const string AirFreshJinmao = "airFresh.jinmao"; |
| | | |
| | | /// <summary> |
| | | /// 新风spk列表 |
| | |
| | | { |
| | | var spkList = new List<string>(); |
| | | spkList.Add(AirFreshStandard); |
| | | spkList.Add(AirFreshJinmao); |
| | | return spkList; |
| | | } |
| | | #endregion |
| | |
| | | /// 红外遥控器 |
| | | /// </summary> |
| | | public const string IrLearn = "ir.learn"; |
| | | |
| | | #region 涂鸦 |
| | | /// <summary> |
| | | /// 家电、涂鸦空气净化器 |
| | |
| | | case FunctionAttributeKey.SetTemp: |
| | | text = Language.StringByID(StringId.Temp); |
| | | break; |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | text = Language.StringByID(StringId.IndoorTemp); |
| | | break; |
| | | case FunctionAttributeKey.Delay: |
| | |
| | | switch (key) |
| | | { |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | us = "°C"; |
| | | break; |
| | | case FunctionAttributeKey.Percent: |
| | |
| | | text = value == "on" ? Language.StringByID(StringId.On) : Language.StringByID(StringId.OFF); |
| | | break; |
| | | case FunctionAttributeKey.SetTemp: |
| | | case FunctionAttributeKey.IndoorTemp: |
| | | case FunctionAttributeKey.RoomTemp: |
| | | case FunctionAttributeKey.Brightness: |
| | | case FunctionAttributeKey.Percent: |
| | | if (value == "") |
| | |
| | | var spkList = SPK.FhSpkList(); |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 新风列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<Function> GetAirFreshList() |
| | | { |
| | | var spkList = SPK.AirFreshSpkList(); |
| | | return Functions.FindAll((obj) => spkList.Contains(obj.spk)); |
| | | } |
| | | #region 家电列表 electricals |
| | | /// <summary> |
| | | /// 家电列表 |
| | |
| | | var tempFunction = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(functionDataString); |
| | | if (tempFunction == null) |
| | | { |
| | | MainPage.Log("null"); |
| | | FileUtlis.Files.DeleteFile(filePath); |
| | | return; |
| | | } |
| | |
| | | /// 是否允许创建场景 |
| | | /// </summary> |
| | | public bool isAllowCreateScene; |
| | | ///// <summary> |
| | | ///// 是否绑定网关 |
| | | ///// </summary> |
| | | //public bool isBindGateway; |
| | | /// <summary> |
| | | /// 是否绑定网关 |
| | | /// </summary> |
| | | public bool isBindGateway; |
| | | }
|
| | |
|
| | | /// <summary> |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 房间功能列表 |
| | | /// </summary> |
| | | List<Function> functions = new List<Function>(); |
| | | ///// <summary> |
| | | ///// 房间功能列表 |
| | | ///// </summary> |
| | | //List<Function> functions = new List<Function>(); |
| | | /// <summary> |
| | | /// 获取房间功能列表 |
| | | /// </summary> |
| | |
| | | { |
| | | if (needRefresh) |
| | | { |
| | | functions = new List<Function>(); |
| | | } |
| | | var functions = new List<Function>(); |
| | | if (functions.Count == 0) |
| | | { |
| | | foreach (var f in FunctionList.List.GetDeviceFunctionList()) |
| | |
| | | } |
| | | return functions; |
| | | } |
| | | /// <summary> |
| | | /// 增加房间功能 |
| | | /// 操作的是缓存数据,不用保存 |
| | | /// </summary> |
| | | public void AddRoomFunction(Function function) |
| | | { |
| | | functions.Add(function); |
| | | } |
| | | /// <summary> |
| | | /// 删除房间功能 |
| | | /// 操作的是缓存数据,不用保存 |
| | | /// </summary> |
| | | public void RemoveRoomFunction(Function function) |
| | | { |
| | | functions.Remove(functions.Find((obj) => obj.sid == function.sid)); |
| | | } |
| | | ///// <summary> |
| | | ///// 增加房间功能 |
| | | ///// 操作的是缓存数据,不用保存 |
| | | ///// </summary> |
| | | //public void AddRoomFunction(Function function) |
| | | //{ |
| | | // functions.Add(function); |
| | | //} |
| | | ///// <summary> |
| | | ///// 删除房间功能 |
| | | ///// 操作的是缓存数据,不用保存 |
| | | ///// </summary> |
| | | //public void RemoveRoomFunction(Function function) |
| | | //{ |
| | | // functions.Remove(functions.Find((obj) => obj.sid == function.sid)); |
| | | //} |
| | | /// <summary> |
| | | /// 房间场景列表 |
| | | /// </summary> |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\EnvironmentalScience\EnvironmentalPage.cs" />
|
| | | <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> |
| | | public static PageLayout BasePageView { get; set; } |
| | | /// <summary> |
| | | /// DisplayCompleted |
| | | /// </summary> |
| | | public static bool DisplayCompleted = false; |
| | | |
| | | //public static UserInfo LoginUser; |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string VersionString = "1.1.0319"; |
| | | public static string VersionString = "1.1.0326"; |
| | | ///// <summary> |
| | | ///// 客户端类型 |
| | | ///// </summary> |
| | |
| | | /// 天气刷新action |
| | | /// </summary> |
| | | public static Action RefreshAir; |
| | | /// <summary> |
| | | /// 回退页面action 没有需要可以不用 |
| | | /// </summary> |
| | | public static Action ReturnRefreshAction; |
| | | /// <summary> |
| | | /// 无登录模式 |
| | | /// </summary> |
| | |
| | | { |
| | | if (e < BasePageView.ChildrenCount - 1) |
| | | { |
| | | MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | } |
| | | |
| | | while (e < BasePageView.ChildrenCount - 1) |
| | | { |
| | | BasePageView.GetChildren(BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | } |
| | | try |
| | | { |
| | | ReturnRefreshAction?.Invoke(); |
| | | ReturnRefreshAction = null; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Log($"后退事件异常:{ex.Message}"); |
| | | } |
| | | //while (e < BasePageView.ChildrenCount - 1) |
| | | //{ |
| | | // BasePageView.GetChildren(BasePageView.ChildrenCount - 1).RemoveFromParent(); |
| | | //} |
| | | }; |
| | | BasePageView.MouseDownEventHandler += (sender, e) => |
| | | { |
| | |
| | | bodyView.AddChidren(btnIcon_bg); |
| | | |
| | | #if DEBUG |
| | | btnIcon_bg.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //ESOnVideo.Current.Test(); |
| | | }; |
| | | |
| | | bool b = false; |
| | | btnIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | //ESOnVideo.Current.Test(false); |
| | | |
| | | //return; |
| | | if (b) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | etAccount.Text = "15971583093";//凉霸"18666455392";//13375012446//13602944661//tzy 18778381374 |
| | | //15971583093 gs//tzy 274116637@qq.com |
| | | etAccount.Text = "18316120654";//凉霸"18666455392";//13375012446//13602944661//tzy 18778381374 |
| | | //15971583093 gs//tzy 274116637@qq.com//Sumant.Bhatia@havells.com 国外服务器测试 |
| | | } |
| | | b = !b; |
| | | etPassword.Text = "123456"; |
| | |
| | | } |
| | | else |
| | | { |
| | | BindingResidencePage page = new BindingResidencePage(); |
| | | MainPage.BaseView.AddChidren(page); |
| | | page.LoadView(); |
| | | //Application.RunOnMainThread(() => |
| | | //{ |
| | | // BindingResidencePage page = new BindingResidencePage(); |
| | | // MainPage.BaseView.AddChidren(page); |
| | | // page.LoadView(); |
| | | //}); |
| | | |
| | | |
| | | |
| | |
| | | UserInfo.Current.LastTime = DateTime.MinValue; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | //登录失败,请先添加住宅! |
| | | Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.FailedGetHomeList)); |
| | | //Utlis.ShowAlertOnMainThread(Language.StringByID(StringId.FailedGetHomeList)); |
| | | } |
| | | } |
| | | } |
| | |
| | | bool LoadMethod_GetResidences() |
| | | { |
| | | var result = false; |
| | | var responsePack = pm.GetHomePager(); |
| | | if (responsePack == StateCode.SUCCESS) |
| | | var code = pm.GetHomePager(); |
| | | if (code == StateCode.SUCCESS) |
| | | { |
| | | ////2020-11-13 待确认,没有住宅,不算登录成功 |
| | | //if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0) |
| | |
| | | //2020-12-10 没有住宅登录成功,但是不能进入主界面 |
| | | result = true; |
| | | } |
| | | else if( code == "null") |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | MainPage.GoUserPage(false); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | // 提示错误 |
| | | IMessageCommon.Current.ShowErrorInfoAlter(responsePack); |
| | | IMessageCommon.Current.ShowErrorInfoAlter(code); |
| | | } |
| | | return result; |
| | | } |
| | |
| | | |
| | | public void LoadPage() |
| | | { |
| | | MainPage.CurPageIndex = 0; |
| | | try |
| | | { |
| | | this.BeginHeaderRefreshingAction = () => |
| | |
| | | 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; |
| | |
| | | |
| | | public void LoadPage() |
| | | { |
| | | MainPage.CurPageIndex = 1; |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | #region top |
| | | FrameLayout topView = new FrameLayout() |
| | |
| | | #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 环境数据 |
| | |
| | | #endregion |
| | | break; |
| | | case ShowFunction.FreshAir: |
| | | functionCount = FunctionList.List.GetAirFreshList().Count; |
| | | break; |
| | | case ShowFunction.Music: |
| | | functionCount = Music.A31MusicModel.A31MusicModelList.Count; |
| | |
| | | functionView.AddChidren(btnName); |
| | | |
| | | if (item != ShowFunction.Environmental && item != ShowFunction.Sensor && item != ShowFunction.VideoIntercom |
| | | && item != ShowFunction.SecurityMonitoring |
| | | && 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 |
| | |
| | | switch (function.Spk_Prefix) |
| | | { |
| | | case FunctionCategory.Curtain: |
| | | |
| | | CurtainFragment(); |
| | | break; |
| | | case FunctionCategory.Sensor: |
| | |
| | | ProgressTextColor = CSS_Color.FirstLevelTitleColor, |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_SecondaryLevel, |
| | | MaxValue = 100, |
| | | Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.BatteryState)), |
| | | Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)), |
| | | Tag = function.sid + "_DimmerBar", |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | }; |
| | |
| | | /// </summary> |
| | | void LoadEvent_SwitchFunction(Button btnSwitch,FunctionAttributes fadeTime = null) |
| | | { |
| | | |
| | | btnSwitch.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | |
| | | if(function.spk == SPK.IrLearn || function.spk == SPK.TvIr) |
| | | { |
| | | new System.Threading.Thread(() => { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | }); |
| | | }) { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | function.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, function.trait_on_off.curValue.ToString()); |
| | | if(fadeTime!= null) |
| | | { |
| | |
| | | |
| | | public void LoadPage() |
| | | { |
| | | MainPage.CurPageIndex = 2; |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | #region top |
| | | topView = new FrameLayout() |
| | |
| | | }; |
| | | 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, |
| | |
| | | return; |
| | | } |
| | | var form = HdlFormLogic.Current.GetFormByName("AddMiniRemoteControlDirection1Page") as AddMiniRemoteControlDirection1Page; |
| | | if (form.AddDeviceEvent != null) |
| | | //if (form.AddDeviceEvent != null) |
| | | { |
| | | //代表这个是由温总那边调用的,直接回调函数 |
| | | form.AddDeviceEvent.Invoke(newDevice); |
| | | form.AddDeviceEvent?.Invoke(newDevice); |
| | | //关闭掉这个界面 |
| | | this.CloseForm(); |
| | | //再把AddMiniRemoteControlDirection1Page界面关了 |
| | | HdlFormLogic.Current.CloseFormByFormName("AddMiniRemoteControlDirection1Page"); |
| | | } |
| | | else |
| | | { |
| | | //代表这并不是由温总的界面调用的,则关闭掉全部的界面 |
| | | HdlFormLogic.Current.CloseAllOpenForm(); |
| | | //然后再把温总的界面new起来 |
| | | new UI2.PersonalCenter.PirDevice.Method().MainView(this, newDevice,()=> { }); |
| | | } |
| | | //else |
| | | //{ |
| | | // //代表这并不是由温总的界面调用的,则关闭掉全部的界面 |
| | | // HdlFormLogic.Current.CloseAllOpenForm(); |
| | | // //然后再把温总的界面new起来 |
| | | // new UI2.PersonalCenter.PirDevice.Method().MainView(this, newDevice,()=> { }); |
| | | //} |
| | | }; |
| | | } |
| | | |
| | |
| | | brand = integratedBrand; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | public void LoadPage(VerticalRefreshLayout refreshView) |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.AddDevice)).LoadTopView(); |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | |
| | | |
| | | |
| | | |
| | | Load3tyBrandDeviceList(); |
| | | Load3tyBrandDeviceList(refreshView); |
| | | |
| | | contentView.BeginHeaderRefreshingAction = () => |
| | | { |
| | | contentView.EndHeaderRefreshing(); |
| | | Load3tyBrandDeviceList(); |
| | | Load3tyBrandDeviceList(refreshView); |
| | | }; |
| | | } |
| | | |
| | | void Load3tyBrandDeviceList() |
| | | void Load3tyBrandDeviceList(VerticalRefreshLayout refreshView) |
| | | { |
| | | var waitPage = new Loading(); |
| | | waitPage.Start(); |
| | |
| | | var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<IntegratedBrandDevice>>(pack.Data.ToString()); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | LoadRow(revData); |
| | | LoadRow(revData, refreshView); |
| | | }); |
| | | } |
| | | else |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | void LoadRow(List<IntegratedBrandDevice> deviceList) |
| | | void LoadRow(List<IntegratedBrandDevice> deviceList, VerticalRefreshLayout refreshView) |
| | | { |
| | | contentView.RemoveAll(); |
| | | bool isFrist = true; |
| | |
| | | case SPK.IrModule: |
| | | var form = new AddMiniRemoteControlDirection1Page(); |
| | | form.AddForm(); |
| | | form.AddDeviceEvent = (functionObj) => { |
| | | refreshView.BeginHeaderRefreshing(); |
| | | }; |
| | | break; |
| | | } |
| | | }; |
| | |
| | | { |
| | | var page = new AddDevciePage(brand); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | page.LoadPage(contentView); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Devices)).LoadTopView_AddIcon("3ty", action); |
| | |
| | | contentView.EndHeaderRefreshing(); |
| | | Load3tyBrandDeviceList(); |
| | | }; |
| | | |
| | | //contentView.BeginHeaderRefreshing(); |
| | | } |
| | | |
| | | void Load3tyBrandDeviceList() |
| | |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //获取列表 |
| | | ////获取列表 |
| | | //HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () => |
| | | //{ |
| | | // Application.RunOnMainThread(() => |
| | |
| | | var library = Newtonsoft.Json.JsonConvert.DeserializeObject<Library>(str); |
| | | if (library != null) |
| | | { |
| | | if (libraryList.Count < 20) |
| | | if (libraryList.Count < 40) |
| | | { |
| | | libraryList.Add(library); |
| | | } |
| | |
| | | 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> |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.Stan; |
| | |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | modeChangeView.AddChidren(btnFanText); |
| | | btnFanIcon.UnSelectedImagePath = acFunction.GetModeIconPath(m,false); |
| | | btnFanIcon.SelectedImagePath = acFunction.GetModeIconPath(m); |
| | | btnFanText.Text = acFunction.GetModeAttrText(m); |
| | | btnFanIcon.UnSelectedImagePath = acFunction.GetFanIconPath(m,false); |
| | | btnFanIcon.SelectedImagePath = acFunction.GetFanIconPath(m); |
| | | btnFanText.Text = acFunction.GetFanAttrText(m); |
| | | |
| | | if (modeList.IndexOf(m) < modeList.Count - 1) |
| | | { |
| | |
| | | |
| | | 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); |
| | | |
| | | var contentView = new FrameLayout() |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | 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), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | |
| | | int index = 0; |
| | | foreach (var attr in device.attributes) |
| | | List<FunctionAttributes> attrList = new List<FunctionAttributes>(); |
| | | attrList.AddRange(device.attributes); |
| | | attrList.Add(new FunctionAttributes() { |
| | | key = "+", |
| | | }); |
| | | |
| | | foreach (var attr in attrList) |
| | | { |
| | | if (attr.key == FunctionAttributeKey.Mode |
| | | || attr.key == FunctionAttributeKey.OnOff |
| | |
| | | { |
| | | row = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(56), |
| | | Width = Application.GetRealWidth(296), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | contentView.AddChidren(row); |
| | | } |
| | | if (attr.key == "+") |
| | | { |
| | | var addView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(88), |
| | | Height = Application.GetRealHeight(40), |
| | | Radius = (uint)Application.GetRealHeight(18), |
| | | BorderColor = CSS_Color.PromptingColor1, |
| | | BorderWidth = (uint)Application.GetRealWidth(2), |
| | | }; |
| | | |
| | | |
| | | if (index % 3 == 1) |
| | | { |
| | | addView.Gravity = Gravity.Center; |
| | | } |
| | | else if (index % 3 == 2) |
| | | { |
| | | addView.X = Application.GetRealWidth(208); |
| | | } |
| | | row.AddChidren(addView); |
| | | |
| | | var btnAdd = new Button() |
| | | { |
| | | Gravity = Gravity.Center, |
| | | UnSelectedImagePath = "Public/PlusSignIcon.png", |
| | | Width = Application.GetRealWidth(32), |
| | | Height = Application.GetRealWidth(32), |
| | | }; |
| | | addView.AddChidren(btnAdd); |
| | | |
| | | btnAdd.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | Action action = () => { |
| | | LoadDialog_IrMoreView(); |
| | | }; |
| | | var addButton = new AcControlPage_AddIrButton(action); |
| | | MainPage.BasePageView.AddChidren(addButton); |
| | | addButton.Show(device); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | var btn = new Button() |
| | | { |
| | |
| | | |
| | | btn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Key, attr.key); |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(attr.key, ""); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | |
| | | new System.Threading.Thread(() => |
| | |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | index++; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | dialog.Show(); |
| | | } |
| | |
| | | device.SetAttrState(FunctionAttributeKey.SetTemp, e.ToString()); |
| | | btnTemp.Text = e.ToString(); |
| | | }; |
| | | arcBar.MouseDownEventHandler = (sender, e) => { |
| | | Console.WriteLine("ddd"); |
| | | MainPage.BasePageView.ScrollEnabled =false; |
| | | }; |
| | | arcBar.MouseUpEventHandler = (sender, e) => { |
| | | Console.WriteLine("ddd2"); |
| | | MainPage.BasePageView.ScrollEnabled = true; |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 控制模式事件 |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = acFunction.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | btnWindSpeed.UnSelectedImagePath = acFunction.GetFanIconPath(device.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
New file |
| | |
| | | using System; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; |
| | | using HDL_ON.UI.UI2.PersonalCenter.PirDevice; |
| | | using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class AcControlPage_AddIrButton : FrameLayout |
| | | { |
| | | Action action; |
| | | |
| | | public AcControlPage_AddIrButton(Action act) |
| | | { |
| | | action = act; |
| | | } |
| | | public void Show(Function control) |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | | UI2.PersonalCenter.PirDevice.View.TopView topView = new UI2.PersonalCenter.PirDevice.View.TopView(); |
| | | topView.topNameBtn.TextID = StringId.tianjiayaokongqi; |
| | | this.AddChidren(topView.FLayoutView()); |
| | | topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; |
| | | |
| | | FrameLayout editfLayout = new FrameLayout |
| | | { |
| | | Y = topView.frameLayout.Bottom, |
| | | BackgroundColor = CSS.CSS_Color.textWhiteColor, |
| | | Height = Application.GetRealHeight(152), |
| | | Width = Application.GetRealWidth(375), |
| | | }; |
| | | this.AddChidren(editfLayout); |
| | | //线 |
| | | Button lineBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(43), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 16 * 2), |
| | | Height = 1, |
| | | BackgroundColor = CSS.CSS_Color.viewLine, |
| | | }; |
| | | editfLayout.AddChidren(lineBtn); |
| | | //请输入按键名称 |
| | | EditText editText = new EditText() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(375 - 16 * 2), |
| | | Height = Application.GetRealHeight(44), |
| | | PlaceholderText = Language.StringByID(StringId.anjianmingcheng), |
| | | PlaceholderTextColor = CSS.CSS_Color.textCancelColor, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextSize = TextSize.text14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | editfLayout.AddChidren(editText); |
| | | //下一步 |
| | | Button saveBtn = new Button |
| | | { |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(44), |
| | | Y = Application.GetRealHeight(92), |
| | | X = Application.GetRealWidth(78), |
| | | TextID = StringId.xiayibu, |
| | | TextSize = TextSize.text16, |
| | | TextColor = CSS.CSS_Color.textWhiteColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | BackgroundColor = CSS.CSS_Color.btnSaveBackgroundColor, |
| | | Radius = (uint)Application.GetRealHeight(22), |
| | | }; |
| | | editfLayout.AddChidren(saveBtn); |
| | | |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | Y = editfLayout.Bottom + Application.GetRealHeight(8), |
| | | Height = Application.GetRealHeight(667 - 64 - 152 - 8), |
| | | Width = Application.GetRealWidth(375), |
| | | BackgroundColor = CSS.CSS_Color.textWhiteColor, |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | //推荐按键 |
| | | Button titleBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(12), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(20), |
| | | TextID = StringId.tuijiananjian, |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.text1Color, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | fLayout.AddChidren(titleBtn); |
| | | //动态加载Button按钮父控件 |
| | | FrameLayout buttonFLayout = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(32), |
| | | Height = Application.GetRealHeight(667 - 64 - 152 - 8 - 12 - 20), |
| | | Width = Application.GetRealWidth(375), |
| | | }; |
| | | fLayout.AddChidren(buttonFLayout); |
| | | #endregion |
| | | Buttons buttons = new Buttons(); |
| | | var buttonNameList = buttons.GetList("默认按钮"); |
| | | buttons.AddButton(buttonFLayout, buttonNameList, (s) => |
| | | { |
| | | editText.Text = s; |
| | | #if __Android__ |
| | | editText.SetSelectionEnd(); |
| | | #endif |
| | | }); |
| | | ///下一步的点击事件 |
| | | saveBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var texts = editText.Text.Trim(); |
| | | if (string.IsNullOrEmpty(editText.Text)) |
| | | { |
| | | //名称不能为空 |
| | | return; |
| | | } |
| | | var butName = control.attributes.Find((c) => c.key == texts); |
| | | if (butName != null) |
| | | { |
| | | //名称已经存在 |
| | | return; |
| | | } |
| | | |
| | | //new引导界面 |
| | | ReplicationView replication = new ReplicationView(); |
| | | replication.Show(this); |
| | | |
| | | |
| | | //添加数据对象 |
| | | AttributesStatus buttonObj = new AttributesStatus(); |
| | | 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) |
| | | { |
| | | 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)); |
| | | } |
| | | }); |
| | | }; |
| | | } |
| | | } |
| | | } |
| | |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnTemp.Text = device.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | btnMode.UnSelectedImagePath = fhTemp.GetModeIconPath(device.GetAttrState(FunctionAttributeKey.Mode)); |
| | | arcBar.Progress = Convert.ToInt32(Convert.ToDouble(device.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (device.trait_on_off.curValue.ToString() == "on") |
| | |
| | | AC temp = new AC(); |
| | | updataTime = DateTime.Now; |
| | | bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState((string)FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = temp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); |
| | | bodyView.btnWindSpeed.UnSelectedImagePath = temp.GetFanIconPath(updateTemp.GetAttrState(FunctionAttributeKey.FanSpeed)); |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | |
| | | if (isAdd) |
| | | { |
| | | function.roomIds.Add(room.roomId); |
| | | room.AddRoomFunction(function); |
| | | //room.AddRoomFunction(function); |
| | | } |
| | | else |
| | | { |
| | | function.roomIds.Remove(room.roomId); |
| | | room.RemoveRoomFunction(function); |
| | | //room.RemoveRoomFunction(function); |
| | | } |
| | | function.UpdataRoomIds(); |
| | | if (function.roomIds.Count == Entity.SpatialInfo.CurrentSpatial.RoomList.Count) |
| | |
| | | |
| | | var row = new FrameLayout() |
| | | { |
| | | //Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(56), |
| | | }; |
| | | contentView.AddChidren(row); |
| | |
| | | { |
| | | row = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetRealHeight(56), |
| | | }; |
| | | contentView.AddChidren(row); |
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; |
| | | } |
| | | |
| | | public class OpthionData |
| | | |
| | | /// <summary> |
| | | /// 获取曲线控件共通Option |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private string GetChartControlCommonOption() |
| | | { |
| | | public int value = 0; |
| | | public string name = ""; |
| | | //{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 |
| | | } |
| | | |
| | | public class ItemStyle |
| | | /// <summary> |
| | | /// 颜色列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<string> ColorList () |
| | | { |
| | | |
| | | var list = new List<string>(); |
| | | return list; |
| | | } |
| | | } |
| | | } |
| | |
| | | Height = Application.GetRealWidth(30), |
| | | UnSelectedImagePath = fhTemp.GetModeIconPath(function.GetAttrState(FunctionAttributeKey.Mode)) |
| | | }; |
| | | if (function.GetAttribute(FunctionAttributeKey.Mode)!=null) |
| | | { |
| | | controlView.AddChidren(btnMode); |
| | | } |
| | | |
| | | btnSwitch = new Button() |
| | | { |
| | |
| | | return; |
| | | } |
| | | bodyView.btnTemp.Text = updateTemp.GetAttrState(FunctionAttributeKey.SetTemp); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.IndoorTemp))) + "°C"; |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.RoomTemp))) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = bodyView.fhTemp.GetModeIconPath(updateTemp.GetAttrState(FunctionAttributeKey.Mode)); |
| | | bodyView.arcBar.Progress = Convert.ToInt32(Convert.ToDouble(updateTemp.GetAttrState(FunctionAttributeKey.SetTemp))); |
| | | if (updateTemp.trait_on_off.curValue.ToString() == "on") |
| | |
| | | dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { |
| | | onDimmerBar = false; |
| | | function.SetAttrState(FunctionAttributeKey.Brightness, dimmerBar.Progress); |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Brightness, dimmerBar.Progress.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | function.SetAttrState(FunctionAttributeKey.FadeTime, barFadeTime.Progress); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | //20201223 删除滑动发送命令,防止控件跳动 |