The XIQS Microsoft.NET Library

From xiqs
Jump to navigation Jump to search

Documentation

Online

The XIQS framework library documentation for .NET technologies 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.
<addhtml> <style type="text/css"> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; /*white-space: pre;*/ }

.csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #a31515; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; }

.csharpcode .lnum { color: #606060; } </style>

<span class="kwrd">using</span> System;<br />
<span class="kwrd">using</span> com.iqsim.xiqs;<br />
<br />
<span class="kwrd">namespace</span> com.iqsim.xiqs.test<br />
{<br />
   <span class="kwrd">class</span> Program {<br />
      <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args) {<br />
         <span class="rem">//xiqs server connection</span><br />
         IXConnection con = XConnectionManager.CreateConnection( <span class="str">"127.0.0.1"</span> );<br />
         con.Connect();         <br />
         <span class="rem">//test</span><br />
         IXCommand cmd;<br />
         IXEvent evt;         <br />
         <span class="rem">//send login</span><br />
         cmd = XiqsFactory.CreateCommand( <span class="str">"loginXIQS"</span>, <span class="str">"administrator"</span>, <span class="str">"iqsim"</span> );<br />
         con.SendCommand( cmd );<br />
         evt = con.ReadEvent();<br />
         Print( evt );         <br />
         <span class="rem">//get xiqs server info</span><br />
         cmd = XiqsFactory.CreateCommand( <span class="str">"getXIQSInfo"</span> );<br />
         con.SendCommand( cmd );<br />
         evt = con.ReadEvent();<br />
         Print( evt );         <br />
         <span class="rem">//get sim card list</span><br />
         IXSimplefilter f = XiqsFactory.CreateSimplefilter();<br />
         f.Limit = 1;<br />
         cmd = XiqsFactory.CreateCommand( <span class="str">"getXIQSCardList"</span>, f );<br />
         con.SendCommand( cmd );<br />
         evt = con.ReadEvent();<br />
         Print( evt );         <br />
         <span class="rem">//send logout</span><br />
         cmd = XiqsFactory.CreateCommand( <span class="str">"logoutXIQS"</span> );<br />
         con.SendCommand( cmd );<br />
         evt = con.ReadEvent();<br />
         Print( evt );         <br />
         <span class="rem">//close xiqs server connection</span><br />
         con.Close();<br />
      }<br />
         <br />
      <span class="kwrd">public</span> <span class="kwrd">static</span> <span class="kwrd">void</span> Print ( IXEvent evt ) {<br />
         Console.WriteLine( <span class="str">"XEvent["</span> + evt.GetType() + <span class="str">"] {"</span> );         <br />
         <span class="kwrd">for</span> ( <span class="kwrd">int</span> i = 0 ; i < evt.ParamListSize ; i++ ) {<br />
            <span class="kwrd">object</span> val = <span class="str">"?"</span>;   <br />
            <br />
            <span class="kwrd">switch</span> ( evt.GetParamType( i ) ) {<br />
               <span class="kwrd">case</span> PAR_TYPE.PAR_INTEGER:<br />
                  val = evt.GetParamInteger( i );<br />
                  <span class="kwrd">break</span>;<br />
               <span class="kwrd">case</span> PAR_TYPE.PAR_LONG:<br />
                  val = evt.GetParamLong( i );<br />
                  <span class="kwrd">break</span>;<br />
               <span class="kwrd">case</span> PAR_TYPE.PAR_STRING:<br />
                  val = evt.GetParamString( i );<br />
                  <span class="kwrd">break</span>;<br />
               <span class="kwrd">case</span> PAR_TYPE.PAR_OBJECT:<br />
                  Print( evt.GetParamObject( i ) );<br />
                  <span class="kwrd">continue</span>;<br />
            }    <br />
            <br />
            Console.WriteLine( <span class="str">" "</span> + evt.GetParamName( i ) + <span class="str">"="</span> + val );<br />
         }<br />
         <br />
         Console.WriteLine( <span class="str">"}"</span> );<br />
      }<br />
   }<br />
}<br />

</addhtml>