Synergex.SynergyDE.DeviceLicensing.DeviceLicensing

 

WNSupported in Synergy .NET on Windows

 

 

namespace Synergex.SynergyDE.DeviceLicensing
public class DeviceLicensing

Synergex provides a DeviceLicensing namespace that contains the functionality needed to implement device licensing in your applications. See Device Licensing (Windows) for instructions.

Methods

Activate

public static async DeviceLicensing.Activate(token, password, descrip), 
&  @Task<LicenseError> 

Activates a device. Your application should prompt the user for the token, password, and device description, or obtain that information in some other manner. This method must be called by your ISynergyDeviceCallback.ActivationDialog() method.

token

The token passed from the ActivationDialog() method. (string)

password

The password passed from the ActivationDialog() method. (string)

descrip

The unique device description passed from the ActivationDialog() method. Must be unique within the license block. (string)

If the activation is successful, Activate() returns a completed task with LicenseError.None. If activation is not successful, Activate() returns one of the following: DeviceMismatch, Unauthorized, Expired, Revoked, NoSlots, DuplicateDevice, NotFound, Timeout, Connectivity, MiscError, InternalLicensingServerError. See Synergex.SynergyDE.DeviceLicensing.LicenseError for details.

Deactivate

public static async DeviceLicensing.Deactivate, @Task<LicenseError>

Deactivates the device and clears all license information stored on the device. You can use this routine to provide an application option that allows the device end user to deactivate a device that is being replaced. This application option might also be invoked under the direction of Synergex to assist in problem solving.

If deactivation is successful, Deactivate() returns a completed task with LicenseError.None. If deactivation is not successful, Deactivate() returns one of the following: NotActivated, NotTransferable, DeviceMismatch, NotFound, Timeout, Connectivity, MiscError, InternalLicensingServerError. If Deactivate() returns NotActivated, DeviceMismatch, or NotFound, the license information will still be cleared. See Synergex.SynergyDE.DeviceLicensing.LicenseError for details on these errors.

Synchronize

public static async DeviceLicensing.Synchronize(auto_reactivate), @Task<LicenseError>

Synchronizes the device license service with the device. This method gets current device license information from the device license service and stores it on the device. It must be called by your ISynergyDeviceCallback.Synchronize() method.

auto_reactivate

Flag that indicates that a “device mismatch” error condition should attempt to activate as a new device. If true, activate on a device mismatch. If false, don’t activate on a device mismatch. (boolean)

If synchronization is successful, Synchronize() returns a completed task with LicenseError.None. If synchronization is not successful, Synchronize() returns one of the following: NotActivated, Expired, Revoked, DeviceMismatch, NoSlots, NotFound, Timeout, Connectivity, MiscError, InternalLicensingServerError. See Synergex.SynergyDE.DeviceLicensing.LicenseError for details.

GetDeviceGUID

public static async DeviceLicensing.GetDeviceGUID, @Task<LicenseError>

Generates a unique identifier for the device. This method must be called by your ISynergyDeviceCallback.Init() method.

If the call is successful, GetDeviceGUID() returns a completed task with LicenseError.None. If the call is not successful, GetDeviceGUID() returns one of the following: InvalidAttribute, MultipleInit, Timeout, Connectivity, MiscError, InternalLicensingServerError. See Synergex.SynergyDE.DeviceLicensing.LicenseError for details.

GetLicenseInfo

public static DeviceLicensing.GetLicenseInfo, @LicenseInfo

Retrieves local license information that is stored on the device, and then populates the fields in the LicenseInfo class. To ensure the most current server-side information, call DeviceLicensing.Synchronize() first.

We recommend you use this method to provide an application option that displays the device description, as well as debug information to assist Synergex in problem solving.

WaitForLicense

public static DeviceLicensing.WaitForLicense, void

Suspends the application user interface until the device license startup processing is complete. This method is for device-licensed applications on Windows servers, desktops, laptops, or tablets only.

WaitForLicense() must be called at the beginning of the application, prior to any other device licensing calls unless you are using an application log-in, in which case you don’t need to do this because you are already suspending the application from proceeding until successful log-in. (Suspension occurs via the implemented callbacks.)

Examples

The following example is an excerpt from a .NET assembly that imports the DeviceLicensing namespace, adds the SynergyDeviceLicense attribute, and retrieves local licensing information.

import Synergex.SynergyDE.DeviceLicensing
{assembly:SynergyDeviceLicenseAttribute(PublicKey="<RSAKeyValue><Modulus>
snLo26dxGIlGg2/rYVg3Jv579uFKxG9DmZkYyagWNOrssoz09PW4/94T3ZxpVEpN4r+xq3CWh
V6OiQmYiKJ+pP7X7OFx1vgOJTjfFT1XZaiqwMerMJ2aeOe1mQ3Yy+y27rQk8pkuE+nqdVti4t
08+zFsgSu9vJvUsamUQ+zEXCk=</Modulus><Exponent>AQAB</Exponent><P>8BHw5im2B
UPKrMiMvO2JfgQmn4ZO9/YKmz7XXOhEZFGZ7V7Bh1XZWiRf+NEfTaIuNj7VaizJ7JdTlhIZ/8
Bw==</P><Q>vko2QXxRkLVGAUkRUVwEKwfXa7FKhjFujpbuMF1/vOG8r2CeVICZ6jo1zUN7tc
GXgBMIrttrILT02XEzVQ6Tw==</Q><DP>uzcCijtU+14WnA/50QvdAIFSEWjs/MhfpxY+IG6f
2TdVlGLugaI4GZkmfnkn2ZT81+BEeT3qz2+043nPyY0d2Q==</DP><DQ>btTUkwGwnAf7C3l7
LamK4vsNbcgsaB9zksIvyxW6H64u8srIjTmsvRk2DFmJGpvSgwNVlTAA369Gzw72iWtIZaMOw
==</DQ><InverseQ>pBRV6OggGZ7gxV9XCM93NoxIoPsn5o+vXj2oyrVh1gnUgm30qByGnbHg
VWtY2zjuNYtFiV6PZNZmmmfTkRRODGBbw==</InverseQ><D>qK0tptMzeDnqSTt1huJX36gV
jVuPzPZPM9UfNR6JPyQA8RWERjgu0s0cghHjDiXeUUNZsAOl6q1mJtVb3IJul3NYS0qlaQVJf
R8q/2rg/QqdV9szFKBz/+nbnuiZsbtK9EZAdGAE3RJNZzsvOOulcfgy6gYMfHzIyJpfvQ0LE=
</D></RSAKeyValue>", AppGUID="99f6af0c-7030-4379-b629-5cfffce726bc", 
Class=^typeof(ns1.class1))}
main
record
    avar, a10
proc
    data li, @LicenseInfo
    data ls, LicenseStatus
    avar = "hey"
    DeviceLicensing.WaitForLicense()
    li = DeviceLicensing.GetLicenseInfo() 
    if (li != ^null) then
      begin
        console.writeline(li.description)
        ls = li.status
        if (ls == LicenseStatus.Active) then
          begin
            console.write("success: status is ")
            console.writeline(ls)
          end
        else
          begin
            console.write("fail: status is ")
            console.writeline(ls)
          end
      end
    else
      begin
        console.writeline("fail: li is null")
      end 

See also