HyssosTech.Sdk.C2SIM
0.9.2-prerelease
Prefix Reserved
See the version list below for details.
dotnet add package HyssosTech.Sdk.C2SIM --version 0.9.2-prerelease
NuGet\Install-Package HyssosTech.Sdk.C2SIM -Version 0.9.2-prerelease
<PackageReference Include="HyssosTech.Sdk.C2SIM" Version="0.9.2-prerelease" />
paket add HyssosTech.Sdk.C2SIM --version 0.9.2-prerelease
#r "nuget: HyssosTech.Sdk.C2SIM, 0.9.2-prerelease"
// Install HyssosTech.Sdk.C2SIM as a Cake Addin #addin nuget:?package=HyssosTech.Sdk.C2SIM&version=0.9.2-prerelease&prerelease // Install HyssosTech.Sdk.C2SIM as a Cake Tool #tool nuget:?package=HyssosTech.Sdk.C2SIM&version=0.9.2-prerelease&prerelease
C2SIM SDK
Resources for controlling C2SIM servers and handling C2SIM messages. This class is built on top of the C2SIMClientLib
, and
encapsulates common parameters required to interact with a C2SIM environment running a REST and STOMP services, and potentially
connected to other systems, such as C2 and Simulators. For an overview of this interaction, see the
C2SIM Server Reference Implementation Documentation
The focus is specifically on the C2SIM protocol, rather than legacy ones (e.g. CBML, IBML, IBML9, MSDL) which may be supported by C2SIM environments as well.
The methods in this class make use of generic capabilities offered by the (ported) Client Library to offer higher-level functionality, for example:
- Wrapping a series of basic Library Commands to make a server transition to a state where it is ready to accept Initializations, or Orders, or to join an ongoing session
- Issuing Library messages with required parameters for pushing Orders, Initializations and Reports
- Serializing and deserializing XML messages from/into plain old C# objects
- Exposing generic Library STOMP messages as finer grained events signaling the reception of Initialization, Orders, Reports, and server status changes
To obtain these effects, the Library functionality is invoked with specific parameters, which were obtained by examining the C2SIM GUI Editor code use of the Java C2SIMClientLib
Nuget Installation
A nuget proving support for .NET 6 and .NET Standard 2.0 (compatible with versions of the .NET Framework) is available to install
.NET CLI
dotnet add package HyssosTeck.Sdk.C2SIM
Package Manager
Install-Package HyssosTeck.Sdk.C2SIM
Quick Start
Create a
C2SIMSDK
object and subscribe to events// ... obtain reference to logger that should be used by the SDK ILogger logger = ... C2SIMSDK c2SimSDK = new C2SIMSDK( logger, new C2SIMSDKSettings( // Id string of this app - use C2SIMSDK.GetMachineID() to get a unique id based on the client hardware <submitter id>, // Full C2SIM server endpoint, including host:port/path, e.g. "http://10.2.10.30:8080/C2SIMServer" <rest endpoint>, // C2SIM server password <rest password> // Full STOMP service endpoint, including host:port/destination, e.g. "http://10.2.10.30:61613/topic/C2SIM" <stomp endpoint>, // Protocol - could also be "BML" for example, but the SDK focuses on C2SIM "SISO-STD-C2SIM", // Version of the protocol - 1.0.0 is the published standard "1.0.0" ) );
NOTE: the SDK supports Dependency Injection as part os a .NET Generic Host, which simplifies handling of logging and configuration settings. See the Sample App for an example of how to implement that.
Subscribe to notification events, implementing handlers
c2SimSDK.StatusChangdReceived += C2SimSDK_StatusChangdReceived; c2SimSDK.InitializationReceived += C2SimSDK_InitializationReceived; c2SimSDK.OderReceived += C2SimSDK_OderReceived; c2SimSDK.ReportReceived += C2SimSDK_ReportReceived;
Establish the connection to the notification service to start the message flow
try { // Connect to the notification service to start receiving messages await c2SimSDK.Connect(); } catch (Exception e) { string msg = e.InnerException != null ? e.InnerException.Message : e.Message; // Handle error // ... }
Send commands and messages as required
- Change the state of the server
- ResetToInitializing() - get the server to an
Initializing
state, issuingSTOP, RESET, INITIALIZE
individual commands as needed - SwitchToRunning() - get the server to a
Running
state, issuingSHARE, START
individual commands as needed - JoinSession() - get the server to issue a late join notification, eventually causing an
InitializationReceived
event to be triggered
- ResetToInitializing() - get the server to an
- Push messages
- PushInitializationMessage()
- PushOrderMessage()
- PushReportMessage()
- Access to raw Library functionality
- PushCommand() - C2SIM server commands: STOP, RESET, INITIALIZE, SHARE, START, PAUSE, STATUS, QUERYINIT (see C2SIM Server Message Flow for details)
- PushMessage() - client configured XML messages
- Change the state of the server
Sample app
The methods above are used in a sample app, which accepts commands and messages interactively and sends them to a server. The app also displays notifications received from a server, and can provide insight into the traffic generated by the sample itself or other apps connected to the same server (e.g. the Sketch-Thru-Plan planning workstation)
Objects generated from the C2SIM XSD
Classes representing the four main types of C2SIM messages were generated from the Schemasusing the xsd
tool:
- C2SimXSDInitObject -
xsd C2SIM_SMX_LOX_v1.0.0_Init_flat.xsd /c /namespace:C2SimInit
- C2SimXSDOrderObject -
xsd C2SIM_SMX_LOX_ASX_v1.0.0_Order_flat.xsd /c /namespace:C2SimOrder
- C2SimXSDReportObject -
xsd C2SIM_SMX_LOX_ASX_v1.0.0_Report_flat.xsd /c /namespace:C2SimReport
- C2SimXSDCommandObject -
xsd C2SIM_SMX_LOX_v1.0.0_Command_flat.xsd /c /namespace:C2SimCommand
C2SIM_SMX_LOX_v1.0.0_Command_flat.xsd
is not part of the original OpenC2SIM repository, and it was extracted from the all
encompassing C2SIM_SMX_LOX_v1.0.0.xsd
. Additional elements had then to be included to
make it comply with the actual content of messages received from a
reference server
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
- System.Threading.Tasks.Dataflow (>= 6.0.0)
-
net6.0
- Microsoft.Extensions.Logging (>= 6.0.0)
- Microsoft.Extensions.Options (>= 6.0.0)
- System.Threading.Tasks.Dataflow (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.3.0 | 125 | 4/17/2024 |
1.2.14 | 247 | 11/21/2023 |
1.2.13 | 203 | 6/9/2023 |
1.2.12 | 184 | 6/8/2023 |
1.2.11 | 174 | 6/7/2023 |
1.2.10 | 196 | 4/27/2023 |
1.2.9 | 374 | 11/8/2022 |
1.2.9-pre | 168 | 11/8/2022 |
1.2.8 | 458 | 5/18/2022 |
1.2.7 | 478 | 5/5/2022 |
1.2.6 | 480 | 4/21/2022 |
1.2.5 | 338 | 12/20/2021 |
1.2.5-prerelease | 235 | 12/6/2021 |
1.2.4 | 365 | 12/3/2021 |
1.2.4-prerelease | 226 | 12/2/2021 |
1.2.3 | 340 | 11/30/2021 |
1.2.3-prerelease | 225 | 11/30/2021 |
1.2.2 | 339 | 11/30/2021 |
1.2.1 | 3,247 | 11/24/2021 |
1.2.0 | 5,681 | 11/24/2021 |
1.2.0-prerelease | 4,697 | 11/24/2021 |
1.1.0 | 328 | 11/23/2021 |
1.0.0 | 1,315 | 11/17/2021 |
0.9.4-prerelease | 250 | 11/16/2021 |
0.9.3-prerelease | 245 | 11/16/2021 |
0.9.2-prerelease | 205 | 11/16/2021 |
0.9.1-prerelease | 222 | 11/16/2021 |
0.9.0-prerelease | 256 | 11/16/2021 |
0.0.4-prerelease | 248 | 11/15/2021 |
0.0.3-prerelease | 245 | 11/15/2021 |
0.0.2-prerelease | 216 | 11/15/2021 |
0.0.1-prerelease | 243 | 11/15/2021 |