Former-commit-id: de34aa6f96cb5714b052e175038abcbe08f3d40a
TangShanKaiPing
wanggang 6 years ago
parent 47dff34b9e
commit 70cdfe4b57

@ -2,7 +2,6 @@
using CoreGraphics;
using CoreMedia;
using CoreVideo;
using Foundation;
using SkiaSharp.Views.iOS;
using System;
using System.IO;

@ -4,7 +4,6 @@ using CoreGraphics;
using CoreVideo;
using Demo.Controls;
using Foundation;
using System;
using System.Linq;
using UIKit;
@ -49,8 +48,7 @@ namespace Demo.iOS.Controls
{
return;
}
NSError error;
var input = new AVCaptureDeviceInput(device, out error);
var input = new AVCaptureDeviceInput(device, out NSError error);
CaptureSession.AddInput(input);
//
@ -59,7 +57,6 @@ namespace Demo.iOS.Controls
output.SetSampleBufferDelegateQueue(new SampleBufferDelegate(), new DispatchQueue("myQueue"));
CaptureSession.AddOutput(output);
//
Layer.AddSublayer(previewLayer);
CaptureSession.StartRunning();
IsPreviewing = true;

@ -9,7 +9,13 @@ namespace Application.Domain.Entities
static DeviceId()
{
List.Add(new DeviceId { Name = "外挂式插座", Category = "电器", Icon = "socket", RawCategory = "Generic", EName = "Smart plug", RawDeviceId = 0x0051 });
List.Add(new DeviceId { RawDeviceId = 0x0002, Name = "0x0002", Category = "电器", Icon = "socket", RawCategory = "Generic", EName = "On/Off Output" });
List.Add(new DeviceId { RawDeviceId = 0x0009, Name = "0x0009", Category = "电器", Icon = "socket", RawCategory = "Generic", EName = "Mains Power Outlet" });
List.Add(new DeviceId { RawDeviceId = 0x0051, Name = "0x0051", Category = "电器", Icon = "socket", RawCategory = "Generic", EName = "Smart plug" });
List.Add(new DeviceId { RawDeviceId = 0x0106, Name = "0x0106", Category = "传感器", Icon = "socket", RawCategory = "Lighting", EName = "Light Sensor" });
List.Add(new DeviceId { RawDeviceId = 0x0202, Name = "0x0202", Category = "电器", Icon = "socket", RawCategory = "Closures", EName = "Window Covering Device" });
List.Add(new DeviceId { RawDeviceId = 0x0309, Name = "0x0309", Category = "传感器", Icon = "socket", RawCategory = "HVAC", EName = "PM2.5 Sensor" });
List.Add(new DeviceId { RawDeviceId = 0x0402, Name = "0x0402", Category = "传感器", Icon = "socket", RawCategory = "Intruder Alarm Systems", EName = "IAS Zone" });
}
public string Name { get; set; }

@ -13,15 +13,17 @@ namespace Application.Domain.Entities
public int Endpoint { get; set; }
public int ProfileId { get; set; }
public int DeviceId { get; set; }
public int Status { get; set; }
public int SwitchState { get; set; }
public int NameLength { get; set; }
public string CName { get; set; }
public int Online { get; set; }
public int IsOnline { get; set; }
public string IEEE { get; set; }
public int SNLength { get; set; }
public string RawSN { get; set; }
public int ZoneType { get; set; }
public int Power { get; set; }
public int Battery { get; set; }
public int EpCount { get; set; }
public string Data { get; set; }
public string Safe { get; set; }
public string RawValue { get; set; }

@ -135,17 +135,20 @@ namespace FBeeService
device.Endpoint = endpoint;
device.ProfileId = profileId;
device.DeviceId = deviceId;
device.Status = ms.ReadByte();
device.SwitchState = ms.ReadByte();
device.NameLength = ms.ReadByte();
device.CName = ms.ReadASIIString(device.NameLength);
device.Online = ms.ReadByte();
if (device.NameLength > 0)
{
device.CName = ms.ReadASIIString(device.NameLength);
}
device.IsOnline = ms.ReadByte();
device.IEEE = ms.ReadHexString(8);
device.SNLength = ms.ReadByte();
device.RawSN = ms.ReadHexString(device.SNLength);
device.ZoneType = ms.ReadByte();
device.Power = ms.ReadByte();
device.ZoneType = ms.ReadInt();
device.Battery = ms.ReadByte();
device.EpCount = ms.ReadByte();
device.Data = ms.ReadHexString(4);
device.Safe = ms.ReadHexString(2);
device.RawValue = BitConverter.ToString(data);
deviceRepo.SaveChanges();
}
@ -164,7 +167,7 @@ namespace FBeeService
using (var scope = _applicationServices.CreateScope())
{
var repo = scope.ServiceProvider.GetService<IRepository<FBeeDevice>>();
var device = repo.ReadOnlyTable().FirstOrDefault(o => o.Online != 0 && o.IEEE == ieee);
var device = repo.ReadOnlyTable().FirstOrDefault(o => o.IsOnline != 0 && o.IEEE == ieee);
var address = device.Address;
var list = new List<byte>();
list.Add(0x0c);
@ -197,7 +200,7 @@ namespace FBeeService
list.Add(0x02);
list.AddRange(address.HexToBytes());
list.AddRange(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
list.Add(0x01);
list.Add((byte)device.Endpoint);
list.AddRange(new byte[] { 0x00, 0x00 });
list.Add(status);
this.Write(sn, RequestType.x82, list);
@ -224,7 +227,7 @@ namespace FBeeService
var device = deviceRepo.Table().FirstOrDefault(o => o.Sn == sn && o.Address == address);
if (device != null)
{
device.Power = ms.ReadInt();
device.SwitchState = ms.ReadInt();
deviceRepo.SaveChanges();
}
else
@ -412,7 +415,15 @@ namespace FBeeService
}
else
{
propDataLength = Convert.ToInt32(Regex.Match(propDataType.GetName(), @"\d+").Groups[1].Value);
try
{
propDataLength = Convert.ToInt32(Regex.Match(propDataType.GetName(), @"(\d+)$").Groups[1].Value);
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
propDataLength = 1;
}
}
}
else

@ -1,17 +1,21 @@
@model List<FBeeDevice>
@{
this.HtmlTitle = "设备列表";
var index = 0;
}
<div class="box">
<table class="table table-bordered">
<tr>
<th></th>
<th>Sn编号</th>
<th>IEEE地址</th>
<th>地址</th>
<th>EP</th>
<th>名称</th>
<th>英文名称</th>
<th>分类</th>
<th>分类编号</th>
<th>电源开关</th>
<th>电</th>
<th>在线</th>
<th>开关</th>
<th>删除</th>
@ -19,14 +23,18 @@
@foreach (var item in Model)
{
<tr>
<th>@(++index)</th>
<td>@item.Sn</td>
<td>@item.IEEE</td>
<td>@item.Address</td>
<td>@item.Endpoint</td>
<td>@item.Name</td>
<td>@item.EName</td>
<td>@item.CategoryName</td>
<td>@item.CategoryNumber</td>
<td><input type="checkbox" readonly disabled @Html.Raw(item.Power == 1 ? "checked" : "") /></td>
<td><input type="checkbox" readonly disabled @Html.Raw(item.Status == 1 ? "checked" : "") /></td>
<td>@item.Battery</td>
<td><input type="checkbox" readonly disabled @Html.Raw(item.IsOnline == 0 ? "" : "checked") /></td>
<td><input type="checkbox" readonly disabled @Html.Raw(item.SwitchState == 0 ? "" : "checked") /> @item.SwitchState</td>
<td>
<a class="btn btn-primary cmd" href="/api/x82?sn=@item.Sn&ieee=@item.IEEE&status=1">开</a>
<a class="btn btn-primary cmd" href="/api/x82?sn=@item.Sn&ieee=@item.IEEE&status=0">关</a>

@ -5,5 +5,6 @@
"System": "Information",
"Microsoft": "Information"
}
}
}
},
"UseMiniProfiler": false
}.
Loading…
Cancel
Save