Licence Management
Licences are required to access functionality within MASTA. Licences can be managed using using the MASTA API.
using SMT.MastaAPI.Licensing;
.
.
.
var serverDetails = LicenceServer.GetServerSettings();
SMTConsole.WriteLine($"Address: {serverDetails.Ip}");
// For RLM licensing the Port and WebPort can be set
SMTConsole.WriteLine($"Port: {serverDetails.Port}");
SMTConsole.WriteLine($"WebPort: {serverDetails.WebPort}");
// For customers that use a a Licence Group Server the following details should be set
SMTConsole.WriteLine($"Licence Groups Address: {serverDetails.LicenceGroupsIp}");
SMTConsole.WriteLine($"Licence Groups Port: {serverDetails.LicenceGroupsPort}");
The output from this code would be something similar to
Address: 192.172.101.2
Port: 5053
WebPort: 5054
Licence Groups Address: 192.172.101.2
Licence Groups Port: 5101
Whether using a HASP dongle or an RLM server, details can be changed using properties and methods on the LicenceServer class
using SMT.MastaAPI.Licensing;
.
.
.
// Set just the address of the HASP dongle/RLM server
var address = "192.172.101.2";
LicenceServer.ServerAddress = address;
// For RLM servers the port and web port can be set
var port = 5053;
var webPort = 5054;
LicenceServer.ServerPort = port;
LicenceServer.WebServerPort = webPort;
// Update several details
var serverDetails = new LicenceServerDetails
{
ServerAddress = "192.172.101.2",
ServerPort = 5053,
WebServerPort = 5054,
LicenceGroupsIp = "192.172.101.2",
LicenceGroupsPort = 5101
};
LicenceServer.UpdateServerSettings(serverDetails);
Details of the various modules that are available using the HASP dongle/RLM server can be examined
using SMT.MastaAPI.Licensing;
using System.Collections.Generic;
using System.Linq;
.
.
.
var availableModules = LicenceServer.GetAvailableModuleDetails();
foreach ( var module in availableModules )
{
SMTConsole.Write(module.IsLicensed);
SMTConsole.Write('\t');
SMTConsole.Write(module.UserCount);
SMTConsole.Write('\t');
SMTConsole.Write(module.MaximumUsers);
SMTConsole.Write('\t');
SMTConsole.Write(module.Code);
SMTConsole.Write('\t');
SMTConsole.Write(module.Description);
SMTConsole.WriteLine();
}
The licence for a module or set of modules can be requested
using SMT.MastaAPI.Licensing;
var moduleCode = "MC101";
bool moduleLicensed = LicenceServer.RequestModule(moduleCode);
The result of calling RequestModule is a boolean value that indicates whether the requested module is now licensed.
There are further methods available on the LicenceServer class, please consult the MASTA API documentation for further information.