Actions

AlphaCom SDK Stentofon.AlphaCom.Example.Stations.exe

From Zenitel Wiki

Revision as of 10:47, 10 June 2009 by Kjellove (talk) (About the application)

AlphaCom SDK Example2 - Station Handling

About the application

AlphaComSDK ExampleAppConfig.JPG
AlphaComSDK ExampleApp2.JPG

Config

The application is a Windows Forms project with two Forms, the Main Window and Config window for inserting the IP address of the AlphaCom. The application config file is the default config file for the Stentofon.AlphaCom.AlphaNet.dll named Stentofon.AlphaCom.AlphaNet.xml defined in the namespace Stentofon.AlphaCom.AlphaNet.Config.

If no config file at startup the application will open the config window. The config window can also be opened by clicking the 'Config' button in the Main Window.

Application Initialisation

The AlphaNetClient object is initialized with the AlphaNetClientConfig object containing the IP address etc. The AutoDiscoverAllNodes and AutoGetStationState properties is also set to get all StationState objects:

_client = new AlphaNetClient(_formConfig.ClientConfig) { AutoDiscoverAllNodes = true, AutoGetStationState = true };

All The StationState objects will be stored in InMemory structure using the Stentofon.AlphaCom.Data.dll:

_stateStorage = new AlphaComState(AlphaComStateStorages.IN_MEMORY);

Handlers For TCP Up/Down, Node Connection Up/down, StationState, StationBusy/StationFree, StationConnect/StationDisconnect is registered:

_client.OnTCPConnectionUp += HandleTCPUp;
_client.OnTCPConnectionDown += HandleTCPDown;
_client.OnNodeConnectionUp += HandleNodeUp;
_client.OnNodeConnectionDown += HandleNodeDown;
_client.OnStationStateReceived += HandleStationState;
_client.OnStationBusyReceived += HandleStationBusy;
_client.OnStationFreeReceived += HandleStationFree;
_client.OnStationConnect += HandleStationConnect;
_client.OnStationDisconnect += HandleStationDisconnect;

Do the connection:

try{
_client.StartListening();
_client.StartMonitorThread();
}
catch (Exception ex){
connected = false;
}