Link Search Menu Expand Document

Raptor SDK Setup

Dec 7 2023 at 12:00 AM

  1. Overview - Installing the Driver SDK
    1. 1. Install SDK Template from a NuGet Package
    2. 2. Download the SDK Template Package
    3. 3. Generate and Run a Project Template

Overview - Installing the Driver SDK

The V-Raptor SDK provides boilerplate code with a customisable framework that lets the user quickly set up and build a microservice. The guide below will show how to install the V-Raptor SDK on a local machine to build a Driver microservice.

Prerequisites

The following needs to be installed on your local machine to use the SDK on your machine:

  • DotNetCore (ensure that the latest DotNet version is installed, which is DotNet7 at the time of this guide’s publication).
  • Visual Studio (latest release).
  • Git (latest release).
  • NuGet (latest release).

1. Install SDK Template from a NuGet Package

Install the latest version of the full SDK template from a NuGet package.

The NuGet command line interface does not support interactive mode which allows credentials to be provided during installation of NuGet packages. This process therefore uses the Package Manager Console in Visual Studio to install the package.

Configuring the NuGet Package Source

To install the package, configure the IoT.nxt private-dev package source for the NuGet Package Manager.

Open Visual Studio and navigate to the Tools menu, then select “Options”:

VStudio Options

Figure 1 - Options in Visual Studio

In the Options window:

Options Window

Figure 2 - Options Window

  1. Scroll down to find “NuGet Package Manager” and expand the dropdown. Select “Package Sources”.
  2. Click the ADD (the green + icon) button at the top right of the window to add a Package Source.
  3. In the Name field, enter the name IoT.nxt.
  4. In the Source field, ender the URL that points to the V-Raptor SDK stream. This is the stream where the SDK will be published. Note that credentials might be needed for this step.
  5. Click Update.
  6. Click OK.

2. Download the SDK Template Package

In Visual Studio, select the Tools menu and open the NuGet Package Manager sub-menu. Select the Package Manager Console menu item.

Package Manager Console

Figure 3 - Select Package Manager Console

This will open the Package Manager Console. In the console window, type the following:

nuget install IoTnxt.Raptor.Device.Template -version <VersionNumber>

It will look like this in the Package Manager Console:

Package Manager Console Command

Figure 4 - Command in Package Manager Console

VersionNumber: Replace this with the latest released version of the template package. An example of a version number is 4.0.14.1.

The Package Manager will install the package. You will get the following error at the end:

Error NU5000: Package ‘IoTnxt.Raptor.Device.Template 4.0.14.1’ has a package type ‘Template’ that is not supported

Ignore this message. The package has been installed correctly.

Installing the SDK Template with DotNet

Open a PowerShell or Command window. Run the following command (for Windows) to install the Raptor Device Template package:

dotnet new –install IoTnxt.Raptor.Device.Template::<VersionNumber>

The VersionNumber will be the same as the version number used when installing the NuGet Package in the Package Manager Console.

The Template (Raptor.Device.Template) will now be installed in DotNet, ready to be used:

Raptor Device Template

Figure 5 - Raptor.Device.Template

Run the command:

dotnet new --list

A list of currently installed SDK Templates will be displayed (see the image above). The Template for IoTnxt.Raptor.Device.Service (raptordeviceservice) will be in this list once it has been installed.

NOTE
For Linux operating systems, the Template can be downloaded and installed locally.

For Linux (install locally):

Open a PowerShell or Command window and type the following:

dotnet new install ~/Downloads/IoTnxt.Raptor.Device.Template.<VersionNumber>.nupkg

Install with Linux

Figure 6 - Install with Linux

As shown above, the command downloads and installs the Template locally, with:

Template Name: IoTnxt.Raptor.Device.Service (raptordeviceservice)

The Template has now been successfully installed. The next section will show how to run the Template.

3. Generate and Run a Project Template

Create a folder for the V-Raptor project that will include the Driver SDK Template.

To create a Device Name for your Driver, open a PowerShell or Command window in the folder created above and insert the following command:

dotnet new raptordeviceservice –devicename <DeviceName>

For a Linux operating system:

dotnet new raptordeviceservice –-devicename <DeviceName>

Once a folder and Device Name has been created, a complete SDK solution of files for a V-Raptor project will be installed and ready to use. DeviceName will appear as part of all Device Template names in the SDK project’s files. This solution can be compiled and run immediately, and will connect to the Collector microservice to send data for all types of Devices, including:

  • Receptor Device
  • Scheduled Device
  • Scheduled Receptor Device

The solution is divided into four solution folder types:

Solution Folder Types

Figure 7 - Solution Folder Types

  1. Devices - Stores Abstract and Concrete projects for Devices (Device Interfaces) associated with the Raptor Device Service (the full SDK solution).
  2. Protocols - Stores Abstract and Concrete projects for Protocols associated with the Raptor Device Service (the full SDK solution).
  3. Services - Contains the Raptor Device Service’s Program.cs file (the root composite file for the Driver Service).
  4. Tests - Contains the Unit Test projects and services, if required.