From IQsimWiki
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Documentation
Online
The XIQS framework library documentation for Java can be consulted online here.
Download
See the Download section
Examples
Below is a sample of use of the XIQS Communication Framework. This sample can be downloaded from the Download section.
package com.iqsim.protocol.example;
import java.io.IOException;
import com.iqsim.protocol.xiqs.*;
import com.iqsim.protocol.xiqs.XParam.PAR_TYPE;
public class Program {
public static void main ( String[] args ) {
try {
final String XIQS_SRV_HOST = "localhost";
IXConnection con = XConnectionManager.createConnection( XIQS_SRV_HOST );
con.connect();
//send necessary login command to server
sendCommand( con, "loginXIQS", "administrator", "admin_pass" );
// create a new object list filter
IXSimplefilter filter = XiqsFactory.createSimplefilter();
//limit list view to 10 objects
filter.setLimit( 10 );
//get 10 sim objects from partition of id 2 (admin) using filter
sendCommand( con, "getXIQSCardList", 2, filter );
//close connection
con.close();
}
catch ( Exception e ) {
e.printStackTrace();
}
}
private static void sendCommand ( IXConnection con, String cmdname, Object ... params )
throws IOException, FilterExistException, InvalidArgumentTypeException {
//create a new command object
IXCommand cmd = XiqsFactory.createCommand( cmdname, params );
//send command to xiqs server
con.sendCommand( cmd );
//read xiqs server answer
IXEvent evt = con.readEvent( true );
//print result on screen output
println( evt );
}
private static void println ( IXEvent evt ) {
System.out.println( "XiqsEvent[type=" + evt.getEventType() + "] {" );
for ( int i = 0 ; i < evt.getParamListSize() ; i++ ) {
if ( PAR_TYPE.PAR_OBJECT != evt.getParamType( i ) )
System.out.println( " " + evt.getParamName( i ) + "=" + evt.getParamValue( i ) );
else {
IXEvent obj = evt.getParamObject( i );
System.out.println( " " + obj.getName() + " {" );
for ( int j = 0 ; j < obj.getParamListSize() ; j++ )
System.out.println( " " + obj.getParamName( j ) + "=" + obj.getParamValue( j ) );
System.out.println( " }" );
}
}
System.out.println( "}" );
}
}
|