The XIQS Microsoft.NET Library
From IQsimWiki
(Difference between revisions)
Latest revision as of 08:03, 5 April 2013
Contents |
Documentation
Online
The XIQS framework library documentation for .NET technologies can be consulted online here.
Download
Examples
Below is a sample of use of the XIQS Communication Framework. This sample can be downloaded from the Download section.
using System;
using com.iqsim.xiqs;
namespace com.iqsim.xiqs.test
{
class Program {
public static void Main(string[] args) {
//xiqs server connection
IXConnection con = XConnectionManager.CreateConnection( "127.0.0.1" );
con.Connect();
//test
IXCommand cmd;
IXEvent evt;
//send login
cmd = XiqsFactory.CreateCommand( "loginXIQS", "administrator", "iqsim" );
con.SendCommand( cmd );
evt = con.ReadEvent();
Print( evt );
//get xiqs server info
cmd = XiqsFactory.CreateCommand( "getXIQSInfo" );
con.SendCommand( cmd );
evt = con.ReadEvent();
Print( evt );
//get sim card list
IXSimplefilter f = XiqsFactory.CreateSimplefilter();
f.Limit = 1;
cmd = XiqsFactory.CreateCommand( "getXIQSCardList", f );
con.SendCommand( cmd );
evt = con.ReadEvent();
Print( evt );
//send logout
cmd = XiqsFactory.CreateCommand( "logoutXIQS" );
con.SendCommand( cmd );
evt = con.ReadEvent();
Print( evt );
//close xiqs server connection
con.Close();
}
public static void Print ( IXEvent evt ) {
Console.WriteLine( "XEvent[" + evt.GetType() + "] {" );
for ( int i = 0 ; i < evt.ParamListSize ; i++ ) {
object val = "?";
switch ( evt.GetParamType( i ) ) {
case PAR_TYPE.PAR_INTEGER:
val = evt.GetParamInteger( i );
break;
case PAR_TYPE.PAR_LONG:
val = evt.GetParamLong( i );
break;
case PAR_TYPE.PAR_STRING:
val = evt.GetParamString( i );
break;
case PAR_TYPE.PAR_OBJECT:
Print( evt.GetParamObject( i ) );
continue;
}
Console.WriteLine( " " + evt.GetParamName( i ) + "=" + val );
}
Console.WriteLine( "}" );
}
}
}