diff --git a/projects/Infrastructure/Infrastructure.csproj b/projects/Infrastructure/Infrastructure.csproj
index 65c71f95..ec1d4c75 100644
--- a/projects/Infrastructure/Infrastructure.csproj
+++ b/projects/Infrastructure/Infrastructure.csproj
@@ -37,6 +37,7 @@
+
diff --git a/projects/IoT.Shared/Application/Models/SPCommandModel.cs b/projects/IoT.Shared/Application/Models/SPCommandModel.cs
new file mode 100644
index 00000000..096cdf1a
--- /dev/null
+++ b/projects/IoT.Shared/Application/Models/SPCommandModel.cs
@@ -0,0 +1,26 @@
+namespace Application.Models
+{
+ public class SPCommandModel
+ {
+ public string Name { get; set; }
+ public string PortName { get; set; }
+ public int BaudRate { get; set; }
+
+ ///
+ /// None=0,Odd=1,Even=2,Mark=3,Space=4
+ ///
+ public int Parity { get; set; }
+
+ public int DataBits { get; set; }
+
+ ///
+ /// None=0,One=1,Two=2,OnePointFive=3
+ ///
+ public int StopBits { get; set; }
+
+ ///
+ /// hex
+ ///
+ public string Message { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/projects/IoT.Shared/IoT.Shared.csproj b/projects/IoT.Shared/IoT.Shared.csproj
index 81229b4d..f05f9664 100644
--- a/projects/IoT.Shared/IoT.Shared.csproj
+++ b/projects/IoT.Shared/IoT.Shared.csproj
@@ -15,13 +15,10 @@
-
-
-
-
+
diff --git a/projects/IoT.Shared/wwwroot/images/sp.png b/projects/IoT.Shared/wwwroot/images/serialport.png
similarity index 100%
rename from projects/IoT.Shared/wwwroot/images/sp.png
rename to projects/IoT.Shared/wwwroot/images/serialport.png
diff --git a/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs b/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs
index 51612966..719aeedb 100644
--- a/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs
+++ b/projects/IoTNode/DeviceServices/Onvif/OnvifService.cs
@@ -132,6 +132,7 @@ namespace IoTNode.DeviceServices.Onvif
Number = ipCamera.Id,
Ip = ipCamera.Ip,
Icon = "camera",
+ IsOnline = true,
ProductId = product.Id,
NodeId = node.Id
};
diff --git a/projects/IoTNode/DeviceServices/SerialPort/Controllers/SerialPortController.cs b/projects/IoTNode/DeviceServices/SerialPort/Controllers/SerialPortController.cs
index 80777f78..c8dae898 100644
--- a/projects/IoTNode/DeviceServices/SerialPort/Controllers/SerialPortController.cs
+++ b/projects/IoTNode/DeviceServices/SerialPort/Controllers/SerialPortController.cs
@@ -1,12 +1,12 @@
using Application.Models;
-using IoTNode.DeviceServices.SerialPort;
+using IoTNode.DeviceServices.SerialPortManager;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using System;
namespace IoTNode.Controllers
{
- [SwaggerTag("串口")]
+ [SwaggerTag("串口控制器")]
public class SerialPortController : BaseDeviceController
{
private readonly SerialPortService _deviceService;
@@ -16,39 +16,22 @@ namespace IoTNode.Controllers
this._deviceService = deviceService;
}
- [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("添加命令")]
- public ApiResponse AddButton([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number, [SwaggerParameter("名称")]string key, [SwaggerParameter("消息")]string value)
- {
- return this.AsyncAction(() =>
- {
- //this._deviceService.UpdateButtons(number, buttons);
- });
- }
-
- [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("修改命令")]
- public ApiResponse EditButton([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number, [SwaggerParameter("名称")]string key, [SwaggerParameter("消息")]string value)
- {
- return this.AsyncAction(() =>
- {
- //this._deviceService.UpdateButtons(number, buttons);
- });
- }
+ [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("发送指令")]
- [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("删除命令")]
- public ApiResponse DeleteButton([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number, [SwaggerParameter("名称")]string key)
+ public ApiResponse Send([SwaggerParameter("设备编号")]string number, [SwaggerParameter("命令")]string name)
{
return this.AsyncAction(() =>
{
- //this._deviceService.UpdateButtons(number, buttons);
+ this._deviceService.Exec(number, name);
});
}
- [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("执行命令")]
- public ApiResponse PressButton([SwaggerParameter("网关编号")]string gateway, [SwaggerParameter("设备编号")]string number, [SwaggerParameter("按键码")]string key)
+ [HttpGet, Route("/[controller]/[action]"), SwaggerOperation("自定义指令")]
+ public ApiResponse Buttons([SwaggerParameter("设备编号")]string number, [SwaggerParameter("指令")]string buttons)
{
return this.AsyncAction(() =>
{
- this._deviceService.Exec(number, key);
+ this._deviceService.UpdateButtons(number, buttons);
});
}
}
diff --git a/projects/IoTNode/DeviceServices/SerialPort/SerialPortService.cs b/projects/IoTNode/DeviceServices/SerialPort/SerialPortService.cs
index 14606552..5484ad96 100644
--- a/projects/IoTNode/DeviceServices/SerialPort/SerialPortService.cs
+++ b/projects/IoTNode/DeviceServices/SerialPort/SerialPortService.cs
@@ -2,66 +2,60 @@
using Application.Models;
using Infrastructure.Data;
using Infrastructure.Extensions;
-using IoT.Shared.Services;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
-using RJCP.IO.Ports;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
-using System.Runtime.InteropServices;
-using System.Threading;
-using System.Threading.Tasks;
-namespace IoTNode.DeviceServices.SerialPort
+namespace IoTNode.DeviceServices.SerialPortManager
{
public class SerialPortService : BaseDeviceService
{
+ private const string _productNumber = "serialport";
+
public SerialPortService(IServiceProvider applicationServices, IConfiguration configuration)
: base(applicationServices, configuration)
{
}
- public override Task StartAsync(CancellationToken cancellationToken)
- {
- Task.Run(() =>
- {
- using var scope = _applicationServices.CreateScope();
- var iotNodeClient = scope.ServiceProvider.GetService();
- var productNumber = "serialport";
- var categoryRepo = scope.ServiceProvider.GetService>();
- var productRepo = scope.ServiceProvider.GetService>();
- var product = this.UpdateProduct("串口", productNumber, "/SerialPort/", "20", "serialport");
- });
- return base.StartAsync(cancellationToken);
- }
-
public override void Execute()
{
- Notify();
+ this.Notify();
}
- public override Task StopAsync(CancellationToken cancellationToken)
+ public void Exec(string id, string name)
{
- return base.StopAsync(cancellationToken);
+ using var scope = _applicationServices.CreateScope();
+ var repo = scope.ServiceProvider.GetService>();
+ var deviceNumber = $"serialportonHelper.Instance.GetCPUNumber()";
+ var device = repo.ReadOnlyTable().Include(o => o.Data).FirstOrDefault(o => o.Number == deviceNumber);
+ var buttons = device.Data.FirstOrDefault(o => o.Key == "Buttons")?.Value.FromJson>(); ;
+ var button = buttons.FirstOrDefault(o => o.Name == name);
+ ExecInternal(button.PortName, button.BaudRate, button.DataBits, button.Parity, button.StopBits, button.Message);
}
- public void Exec(string id, string code)
+ internal void UpdateButtons(string number, string buttons)
{
- using var scope = _applicationServices.CreateScope();
- var repo = scope.ServiceProvider.GetService>();
- var device = repo.ReadOnlyTable().Include(o => o.Data).FirstOrDefault(o => o.Number == id);
- var port = device.GetDataValue("SerialPort");
- var baud = Convert.ToInt32(device.GetDataValue("Baud"));
- var dataBits = Convert.ToInt32(device.GetDataValue("DataBits"));
- var partity = Convert.ToInt32(device.GetDataValue("Partity"));
- var stopBits = Convert.ToInt32(device.GetDataValue("StopBits"));
- var buttonsValue = device.Data.FirstOrDefault(o => o.Key == "Buttons").Value;
- var buttons = buttonsValue.FromJson>>();
- var message = buttons.FirstOrDefault(o => o.Key == code).Value;
- ExecInternal(port, baud, dataBits, partity, stopBits, message);
+ using (var scope = _applicationServices.CreateScope())
+ {
+ var deviceRepo = scope.ServiceProvider.GetService>();
+ var device = deviceRepo.Table().Include(o => o.Data).FirstOrDefault(o => o.Number == number);
+ if (device != null)
+ {
+ var data = device.Data.FirstOrDefault(o => o.Key == "Buttons");
+ if (data != null)
+ {
+ data.Value = buttons.FromJson>().ToJson();
+ if (deviceRepo.SaveChanges() > 0)
+ {
+ this.SendDataToServer(data);
+ }
+ }
+ }
+ }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "<挂起>")]
@@ -69,23 +63,11 @@ namespace IoTNode.DeviceServices.SerialPort
{
try
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- using var sp = new SerialPortStream(port, baud, dataBits, (RJCP.IO.Ports.Parity)partity, (RJCP.IO.Ports.StopBits)stopBits);
- sp.Open();
- var bytes = message.HexToBytes();
- sp.Write(bytes, 0, bytes.Length);
- sp.Flush();
- sp.Close();
- }
- else
- {
- using var sp = new SerialDevice(port, (BaudRate)baud, (System.IO.Ports.Parity)partity, dataBits, (System.IO.Ports.StopBits)stopBits);
- sp.Open();
- var bytes = message.HexToBytes();
- sp.Write(bytes);
- sp.Close();
- }
+ using var sp = new SerialPort(port, baud, (Parity)partity, dataBits, (StopBits)stopBits);
+ sp.Open();
+ var bytes = message.HexToBytes();
+ sp.Write(bytes, 0, bytes.Length);
+ sp.Close();
}
catch (Exception ex)
{
@@ -95,13 +77,33 @@ namespace IoTNode.DeviceServices.SerialPort
public void Notify()
{
+ this.UpdateProduct("串口控制器", _productNumber, "/SerialPort/", "20", "serialport");
using var scope = _applicationServices.CreateScope();
var repo = scope.ServiceProvider.GetService>();
- var devices = repo.ReadOnlyTable().Include(o => o.Product).Include(o => o.Node).ToList();
- foreach (var device in devices)
+ var deviceNumber = $"serialporton{Helper.Instance.GetCPUNumber()}";
+ var device = repo.ReadOnlyTable().Include(o => o.Data).FirstOrDefault(o => o.Number == deviceNumber);
+ if (device == null)
{
- var deviceDto = device.To();
- this.SendToServer(Methods.EditDevice, deviceDto);
+ var productRepo = scope.ServiceProvider.GetService>();
+ var nodeRepo = scope.ServiceProvider.GetService>();
+ var node = nodeRepo.ReadOnlyTable().FirstOrDefault();
+ var product = productRepo.ReadOnlyTable().FirstOrDefault(o => o.Number == _productNumber);
+ var name = "串口控制器";
+ device = new Device
+ {
+ Id = deviceNumber.ToGuid(),
+ Number = deviceNumber,
+ Name = name,
+ DisplayName = name,
+ ProductId = product.Id,
+ NodeId = node.Id,
+ IsOnline = true,
+ Icon = "serialport"
+ };
+ repo.Add(device);
+ this.UpdateDevice(repo, device);
+ var buttons = new List() { new SPCommandModel { Name = "测试", PortName = "/dev/ttyS0", BaudRate = 9600, Parity = 0, DataBits = 8, StopBits = 1, Message = "" } }.ToJson();
+ this.UpdateData(repo, device, device.CreateData("Buttons", buttons, DeviceDataType.String, "指令", timestamp: DateTimeOffset.Now.ToUnixTimeMilliseconds()));
}
}
}
diff --git a/projects/IoTNode/Startup.cs b/projects/IoTNode/Startup.cs
index def3ac29..171dbffc 100644
--- a/projects/IoTNode/Startup.cs
+++ b/projects/IoTNode/Startup.cs
@@ -17,6 +17,7 @@ using Infrastructure.Data;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Logging;
+using IoTNode.DeviceServices.SerialPortManager;
namespace IoTNode
{
@@ -33,11 +34,11 @@ namespace IoTNode
services.AddSingleton();
services.AddSingleton();
services.AddSingleton();
- //services.AddSingleton();
+ services.AddSingleton();
services.AddHostedService(o => o.GetService());
services.AddHostedService(o => o.GetService());
services.AddHostedService(o => o.GetService());
- //services.AddHostedService(o => o.GetService());
+ services.AddHostedService(o => o.GetService());
base.ConfigureServices(services);
}
diff --git a/tools/serialport/Serial Port Utility.exe b/tools/serialport/Serial Port Utility.exe
new file mode 100644
index 00000000..8dd84072
Binary files /dev/null and b/tools/serialport/Serial Port Utility.exe differ
diff --git a/tools/serialport/Virtual Serial Port Driver/snd.nfo b/tools/serialport/Virtual Serial Port Driver/snd.nfo
new file mode 100644
index 00000000..64bf314c
--- /dev/null
+++ b/tools/serialport/Virtual Serial Port Driver/snd.nfo
@@ -0,0 +1,281 @@
+ . ۲ .
+ . ۲
+ . ۲
+ ۲۲ ۲
+ . ܱ۲
+ . .
+ ۲ ܱܲ .
+ ߱۲ ߲
+ ߲ܱܲܰ
+ . ۲ ܰ
+ ۲ܲܰ
+ ߱۲ ߱
+ ۲
+ ۲ܱ .
+ ߲ܰ
+ ܲ߰ ߰
+ ۲ܰ ܲ
+ ߲ ܲܲ
+ ߱ܲ ߲߲
+ ߲
+ hX! ܲ
+ ۲
+ ۲ ߲
+ ߲ݰ ߲ݰ ߲ ܲ
+
+ ߲۲ ݲݲ߲ ܲ
+ ۲
+ ܲ
+ ߲ ۲
+ ۲
+ ۲
+ ۲
+ ܲ ۲
+ ۲ ߲
+
+ ۲ ۲۲ ۲ ۲
+ ۲
+ ۲ ۲
+ ۲
+
+ ۲ ۲ ۲
+
+
+
+
+ Virtual Serial Port Driver 6.9.1.134
+
+
+
+
+ release information ۱
+ ۱
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ Releaser ................. PakMan Rls type ................ cracked
+ Program name ................... Virtual Serial Port Driver 6.9.1.134
+ URL .......................... http://www.eltima.com/products/vspdxp/
+ Date ................. 2008 09 10 OS ....................... WinAll
+
+
+
+
+
+ release notes ۱
+ ۱
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ With Virtual Serial Port Driver you can create any number of pure
+ virtual serial ports in your system connected into pairs via virtual
+ null-modem cable without having real serial ports occupied.
+
+
+
+
+
+ install notes ۱
+ ۱
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ Step 1: Install the program
+ Step 2: Backup the original vspdctl.dll file
+ Step 3: Replace with the cracked vspdctl.dll file
+ Step 4: Run the application.
+
+ Enjoy!
+
+
+
+
+
+ crew ۱
+ ۱
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ [ PuNk!DuDe.........................founder/reverse engineer/coder ]
+ [ Cektop............................founder/reverse engineer/coder ]
+ [ Fungus....................................reverse engineer/coder ]
+ [ SuperCRacker..............................reverse engineer/coder ]
+ [ Ziggy.....................................reverse engineer/coder ]
+ [ Ufo-Pu55y...................................coder/intro designer ]
+ [ Al-Kaiser.......................................reverse engineer ]
+ [ Apocalypse......................................reverse engineer ]
+ [ DrPepUr.........................................reverse engineer ]
+ [ Encrypto........................................reverse engineer ]
+ [ Hawk............................................reverse engineer ]
+ [ HVC.............................................reverse engineer ]
+ [ Killboy.........................................reverse engineer ]
+ [ Loki............................................reverse engineer ]
+ [ PakMan..........................................reverse engineer ]
+ [ quosego.........................................reverse engineer ]
+ [ Sonny27.........................................reverse engineer ]
+ [ TeaM SnD........................................reverse engineer ]
+ [ +NCR/CRC!........................................tutorial author ]
+ [ metr0............................................tutorial author ]
+ [ Teddy Rogers...........................disgruntled administrator ]
+ [ Ecliptic...............................graphics artists/designer ]
+ [ 3ck5u6.............................................site operator ]
+ [ Bone Enterprise....................................site operator ]
+ [ LoL................................................site operator ]
+ [ The Riddler........................................site operator ]
+ [ Willie.............................................site operator ]
+ [ Xes................................................site operator ]
+ [ Zer0burn...........................................site operator ]
+
+
+
+
+
+ news ۱
+ ۱
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ It is hard to think that just over five years ago Seek n Destroy had
+ no place in the scene, a silent unknown entity yet to be born. Today,
+ five years on and with over 11,500 releases to look back on Seek n
+ Destroy are a well and truly established team that have surpassed
+ what many had thought would be just another minor team that would
+ disappear as quickly as it came. The majority of the original members
+ who helped to form and create Seek n Destroy have either retired or
+ moved on to other projects. What has made Seek n Destroy such an
+ enjoyable team to be a part of - at any time - is that many new and
+ interesting members have come forward sharing the same dreams and
+ desires as those original members to help keep pushing forward Seek n
+ Destroy to new heights that it enjoys today. Seek n Destroy is not
+ just a crack team it is a family and being a family I think it is
+ fair to say we look at each other with pride. We take pride knowing
+ that being a little bit different has made us that little bit better.
+
+ As a member once said, "Not many teams do it to learn and at the same
+ time try and help others. Forgive the self-righteous attitude, but I
+ think its fair to say that we rock most royally".
+
+ Live the dream... Seek n Destroy... five years bolder...
+
+ .....................................................................
+
+ If you are interested in becoming part of SnD and have knowledge and
+ coding skills for developing crack intros and/or demos we would love
+ to hear from you. Positions are open for all talented people in this
+ field.
+
+ .....................................................................
+
+ We continue to look for quality crackers, keygenners & unpackers -
+ coders who can write quality tools and utilities - demo & intro
+ coders - tutorial authors who can write interesting and well
+ structured tutorials - mod/chiptune authors (.mod, .xm, etc. ) If you
+ think you can be part of a friendly team and help to contribute in to
+ a community then feel free to find us...
+
+
+
+
+
+ greetings ۱
+ ۱
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ Over the years we have come to know and love many individuals and
+ many teams. Some teams still stand today and some have unfortunately
+ fallen to bad times. We would like to take this opportunity to thank
+ and give a greeting to: ArTeam, CoolPHat, CracksLatinoS, Fixdown,
+ ICU, MP2k, PEDiY, Resurrection, REVENGE Crew, TSRh, Unpack China,
+ VDown, and all at China Serials2K and the AstaLaVista guys. Not
+ forgetting, or course, the biggest greeting of all to YOU! :)
+
+
+
+
+
+ contact ۱
+ ۱
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ [ WWW-URL1 : .............................http://snd.astalavista.ms ]
+ [ WWW-URL2 : ...............................http://www.snd-team.org ]
+ [ Forum : .............................http://www.sndforum.da.ru ]
+ [ Mail : ............................... Reach us on our forum! ]
+ [ IRC : ............................... #seekndestroy on EFnet ]
+
+
+
+
+
+
+
+ ۲
+ ݰ ݲ ۲
+ ݱ ߲
+ ߲۲
+
+ ܲ
+ ߲
+
+
+
+
+ infofile designed by haliphax of remorse productions (c) 1981
diff --git a/tools/serialport/Virtual Serial Port Driver/vspd.exe b/tools/serialport/Virtual Serial Port Driver/vspd.exe
new file mode 100644
index 00000000..56e71766
Binary files /dev/null and b/tools/serialport/Virtual Serial Port Driver/vspd.exe differ
diff --git a/tools/serialport/Virtual Serial Port Driver/替换补丁下载/vspdconfig.exe b/tools/serialport/Virtual Serial Port Driver/替换补丁下载/vspdconfig.exe
new file mode 100644
index 00000000..95e4b9e2
Binary files /dev/null and b/tools/serialport/Virtual Serial Port Driver/替换补丁下载/vspdconfig.exe differ
diff --git a/tools/serialport/Virtual Serial Port Driver/替换补丁下载/vspdctl.dll b/tools/serialport/Virtual Serial Port Driver/替换补丁下载/vspdctl.dll
new file mode 100644
index 00000000..ef41b41a
Binary files /dev/null and b/tools/serialport/Virtual Serial Port Driver/替换补丁下载/vspdctl.dll differ