Click or drag to resize

ExtendedServiceDevice Constructor

Constructor to instantiate a new Extended Service Device class.

Namespace: Crestron.SimplSharp
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public ExtendedServiceDevice(
	uint paramID
)

Parameters

paramID  UInt32
The IP ID of the device that the programmer assigned for this application.
Remarks
The user of extended service should instantiate the extended service device as soon as the module initialization is done or as soon as the remote device for the service is registered in the program.
Example
The following example will show basic usage of the Extended Service Device in SIMPLE# module of 3 Series control system.
C#
public class ExtendedServiceDeviceTest
{
    ExtendedServiceDevice myDevice;

    //The user should start up the extended service as soon as the module initialization is done.
    public void StartUpExtendedService(uint paramID)
    { 
        //Instantiate the extended service device with the proper IP ID.
        myDevice = new ExtendedServiceDevice(paramID);
        //Subscribe to the  receive event handler.
        myDevice.ReceiveEvent += ReceiveEventHandler;
        //Connect to a supported service.
        myDevice.Connect(eCrestronExtendedService.CRPCPacketToUserModule);
    }
    //Once receive device online event, the user should start the next phase operation like
    //CRPC registration..
    public void SendCRPCRegistrationPacketToDevice()
    {
      string CRPCPacketString = "This is a CRPC registration packet in required format";
      uint channelNoToUse = 1;

     if(myDevice.IsOnline) 
        myDevice.SendString(channelNoToUse,CRPCPacketString,CrestronStringEncoding.eEncodingUTF16);
    }
    //Receive Event Handler
    void ReceiveEventHandler(object sender, ExtendedServiceEventArgs args)
    {
        switch (args.Type)
        {
            case eExtendedServiceEventType.Online:
                ErrorLog.Notice(String.Format("Extended service device online status {0}.\r\n",myDevice.IsOnline));
                break;
            case eExtendedServiceEventType.String:
                ErrorLog.Notice(String.Format("Ex-service device gets incoming string in format {0}: {1}.\r\n", args.IncomingStringEncoding.ToString(),args.StringValue));
                break;
            default:
                break;
        }
    }
}

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also