XserverIoTCommon 10.2.0.4
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package XserverIoTCommon --version 10.2.0.4
NuGet\Install-Package XserverIoTCommon -Version 10.2.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XserverIoTCommon" Version="10.2.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XserverIoTCommon --version 10.2.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XserverIoTCommon, 10.2.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install XserverIoTCommon as a Cake Addin #addin nuget:?package=XserverIoTCommon&version=10.2.0.4 // Install XserverIoTCommon as a Cake Tool #tool nuget:?package=XserverIoTCommon&version=10.2.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Required UWP Target settings:
Min version: Windows 10 Fall Creators Update (10.0; Build 16299)
Required UWP Capabilities:
<Capability Name="internetClient" />
<Capability Name="internetClientServer"/>
<Capability Name="privateNetworkClientServer"/>
Authentication class:
// Log in to Xserver.IoT
public static async Task<Result> Login(string UserName, string Password, string ServiceIP = "localhost")
example: var res = await Authentication.Login("operator", "operator", "10.29.2.154");
// Gets UserId object
public static Models.Com.Common.IUserId GetComServiceUserId()
example:
IActiveAlarms AlarmRequest = new IActiveAlarms();
AlarmRequest.IUserId = Authentication.GetComServiceUserId();
AlarmRequest.NumberOfItems = 0; //No Limit
var resultackalarm = await RestAPI.RestClientPOST("/com/alarms/getactivealarms", ServiceName.Com, AlarmRequest);
RestAPI methods:
/// GET RestAPI request
public static async Task<IO.RestClient.RestClient.Result> RestClientGET(string RequestUri, ServiceName Service)
/// POST RestAPI request
public static async Task<IO.RestClient.RestClient.Result> RestClientPOST(string RequestUri, ServiceName Service, object objectcontent)
/// POST RestAPI request with Auth object
public static async Task<IO.RestClient.RestClient.Result> RestClientPOSTAuthObj(string RequestUri, ServiceName Service, object SerializeObject)
Realtime objects and methods:
public List<ISourceInfo> ListOfSources { get; internal set; }
public List<ISourceQuantitiesInfo> ListOfQuantities { get; internal set; }
//Uploads ListOfSources and ListOfQuantities objects from Xserver.Com service
public async Task<Result> GetSourcesQuantities()
//Gets SourceId and QuantityId (error return value null)
public QuantityInfo GetIds(string SourceName, string QuantityName)
//Gets value of the quantity of the Source (error return value null)
public async Task<QuantityValueItem> GetValue(string SourceName, string QuantityName)
//Gets values of the quantities of the Sources (error return value null)
public async Task<List<QuantityValueItem>> GetValues(List<QuantitiesRequestItem> QuantitiesRequestList)
//Writes value of the quantity of the Source (error return value null)
public async Task<QuantityWriteResult> WriteValue(string SourceName, string QuantityName, double WriteValue)
/// Adds new values to PeriodLog
public async Task<Result> PeriodicLogAddNewValues(List<LogItem> LogItems)
/// Adds new values to DifferenceLog
public async Task<Result> DifferenceLogAddNewValues(List<EventItem> LogItems)
EventLogging methods:
//Adds a new event into the EventLog
public static void AddLogMessage(MessageType MessageType, string Message)
HttpRestServerService methods:
/// If true then REST HTTP server is running
public bool IsStartHttpServer { get; set; }
/// Start and Initialize Http server
public async Task<IO.SimpleHttpServer.Result> HttpRESTServerStart()
/// Stop Http server
public async Task<IO.SimpleHttpServer.Result> HttpRESTServerStop()
/// Send response to client
public async Task<IO.SimpleHttpServer.Result> ServerResponse(HTTPStatusCodes HTTPStatus, Windows.Storage.Streams.IOutputStream OStream, string SendData)
Examples:
private async void Button_Click(object sender, RoutedEventArgs e)
{
var res = await Authentication.Login("operator", "operator", "10.29.2.154");
}
private async void Button_Click_1(object sender, RoutedEventArgs e)
{
var result = await RestAPI.RestClientGET("/com/getsources", ServiceName.Com);
}
private async void Button_Click_2(object sender, RoutedEventArgs e)
{
var result = await RestAPI.RestClientPOSTAuthObj("/data/system/gettemplatedevices", ServiceName.Data, null);
}
private async void Button_Click_3(object sender, RoutedEventArgs e)
{
var res = await Authentication.Login("admin", "admin", "10.29.2.12");
}
private async void Button_Click_4(object sender, RoutedEventArgs e)
{
IActiveAlarms AlarmRequest = new IActiveAlarms();
AlarmRequest.IUserId = Authentication.GetComServiceUserId();
AlarmRequest.NumberOfItems = 0; //No Limit
var resultackalarm = await RestAPI.RestClientPOST("/com/alarms/getactivealarms", ServiceName.Com, AlarmRequest);
}
Realtime RealtimeObj = new Realtime();
private async void Button_Click_5(object sender, RoutedEventArgs e)
{
var res = await Authentication.Login("operator", "operator", "10.29.2.154");
var res1 = await RealtimeObj.GetSourcesQuantities();
}
private void Button_Click_6(object sender, RoutedEventArgs e)
{
var res = RealtimeObj.GetIds("Main PLC", "Light");
}
private async void Button_Click_7(object sender, RoutedEventArgs e)
{
var Light = await RealtimeObj.GetValue("Main PLC", "Light");
}
private async void Button_Click_8(object sender, RoutedEventArgs e)
{
List<QuantitiesRequestItem> Reqs = new List<QuantitiesRequestItem>();
QuantitiesRequestItem oner = new QuantitiesRequestItem();
QuantitiesRequestItem oner1 = new QuantitiesRequestItem();
oner.SourceName = "Main PLC";
oner.QuantityName = "Light";
oner1.SourceName = "Main PLC";
oner1.QuantityName = "Status";
Reqs.Add(oner);
Reqs.Add(oner1);
var ress = await RealtimeObj.GetValues(Reqs);
}
private async void Button_Click_9(object sender, RoutedEventArgs e)
{
var writeresult = await RealtimeObj.WriteValue("Main PLC", "Status", 0);
}
private async void Button_Click_10(object sender, RoutedEventArgs e)
{
DateTime actualtime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
List<LogItem> LogItems = new List<LogItem>();
LogItem oneitem = new LogItem();
oneitem.SourceName = "VirtualDev";
oneitem.QuantityName = "Test1";
oneitem.TimestampUTC = null; //If TimestampUTC is null, the current UTC is used.
oneitem.Value = DateTime.Now.Second;
LogItems.Add(oneitem);
LogItem oneitem1 = new LogItem();
oneitem1.SourceName = "VirtualDev";
oneitem1.QuantityName = "Test2";
oneitem1.TimestampUTC = actualtime; //If TimestampUTC is null, the current UTC is used.
oneitem1.Value = DateTime.Now.Second + 10;
LogItems.Add(oneitem1);
var result = await RealtimeObj.PeriodicLogAddNewValues(LogItems);
}
private async void Button_Click_11(object sender, RoutedEventArgs e)
{
DateTime actualtime = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, DateTime.UtcNow.Day, DateTime.UtcNow.Hour, DateTime.UtcNow.Minute, DateTime.UtcNow.Second);
List<EventItem> EventItems = new List<EventItem>();
EventItem oneitem = new EventItem();
oneitem.SourceName = "VirtualDev";
oneitem.QuantityName = "Test3";
oneitem.TimestampUTC = actualtime; //If TimestampUTC is null, the current UTC is used.
oneitem.Value = DateTime.Now.Second;
oneitem.ChangePercent = DateTime.Now.Second+10;
oneitem.TolerancePercentage = DateTime.Now.Second;
EventItems.Add(oneitem);
var result = await RealtimeObj.DifferenceLogAddNewValues(EventItems);
}
More details: https://github.com/IntelliSenseIoT/XserverIoTOnboardTask.github.io
Product | Versions Compatible and additional computed target framework versions. |
---|---|
Universal Windows Platform | uap was computed. uap10.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
UAP 0.0
- IO.RestClient (>= 10.0.0.23)
- IO.SimpleHttpServer (>= 10.0.0.15)
- Models.Com (>= 10.0.0.147)
- Models.Data (>= 10.2.0.4)
- Newtonsoft.Json (>= 12.0.3)
- OPCUA.Library (>= 10.0.0.4)
- Service.Common (>= 10.2.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on XserverIoTCommon:
Package | Downloads |
---|---|
IoTServerInsertionAPI
The insertion API allows the IoT Server to send data to other systems. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
10.3.4 | 222 | 7/5/2023 |
10.3.2 | 2,416 | 11/25/2021 |
10.2.3.1 | 377 | 10/7/2021 |
10.2.1.5 | 392 | 3/25/2021 |
10.2.1.4 | 409 | 3/24/2021 |
10.2.1.3 | 388 | 3/18/2021 |
10.2.1.2 | 387 | 3/4/2021 |
10.2.1.1 | 391 | 2/23/2021 |
10.2.1 | 396 | 2/11/2021 |
10.2.0.16 | 434 | 11/25/2020 |
10.2.0.15 | 489 | 11/19/2020 |
10.2.0.14 | 476 | 11/19/2020 |
10.2.0.13 | 433 | 10/28/2020 |
10.2.0.12 | 473 | 10/27/2020 |
10.2.0.11 | 430 | 10/27/2020 |
10.2.0.10 | 446 | 10/27/2020 |
10.2.0.9 | 479 | 10/21/2020 |
10.2.0.7 | 514 | 9/29/2020 |
10.2.0.5 | 461 | 9/24/2020 |
10.2.0.4 | 498 | 9/17/2020 |
10.2.0.3 | 526 | 9/16/2020 |
10.1.0.7 | 514 | 6/25/2020 |
10.1.0.6 | 589 | 6/24/2020 |
10.1.0.4 | 491 | 5/21/2020 |
10.1.0.2 | 533 | 5/19/2020 |