Files
harbour-core/contrib/hbwin/tests/simwce.prg
vszakats 9687850865 2013-03-16 02:10 UTC+0100 Viktor Szakats (harbour syenar.net)
* (all files)
    * stripped svn header
    * minor cleanups
    ; use following command to find out the history of files:
       git log
       git log --follow
       git blame
       git annotate
2013-03-16 02:11:42 +01:00

72 lines
2.1 KiB
Plaintext

/*
* Harbour Project source code:
* SIM test code
*
* Copyright 2009 Jose Luis Capel <jlcapel@hotmail.com>
* www - http://harbour-project.org
*/
#require "hbwin"
#include "hbsim.ch"
PROCEDURE Main()
#if defined( __PLATFORM__WINCE )
LOCAL o := wce_Sim():New()
LOCAL a
IF o:lInitialize()
Alert( "Api Sim initialized!!" + Str( o:nLastError ) )
ELSE
Alert( "Api Sim NOT initialized!!. Error " + Str( o:nLastError ) )
ENDIF
#if 0
IF o:lNumberOfPhoneBookEntries( SIM_PBSTORAGE_SIM, @nTotal, @nUsed )
Alert( "Total Entries: " + Str( nTotal ) + " ---- Used Entries: " + Str( nUsed ) )
ELSE
Alert( "Error " + Str( o:nLastError ) + " phone book entries" )
ENDIF
a := o:aGetAllPhoneBookEntries()
AEval( a, {| n | Alert( "Phone: " + n[ 1 ] + hb_eol() + "Name: " + n[ 2 ] + hb_eol() + "Adr. Type: " + Str( n[ 3 ] ) + hb_eol() + "Plan Type: " + Str( n[ 4 ] ) ) } )
#endif
IF ! o:lGetSimPhoneEntry( 1, SIM_PBSTORAGE_SIM, @a )
Alert( "Pos 1 error" )
ELSE
Alert( "VALTYPE-> " + ValType( a ) + " LEN -> " + Str( Len( a ) ), a[ 1 ][ 1 ] )
AEval( a, {| n | Alert( "Phone: " + n[ 1 ] + hb_eol() + "Name: " + n[ 2 ] + hb_eol() + "Adr. Type: " + Str( n[ 3 ] ) + hb_eol() + "Plan Type: " + Str( n[ 4 ] ), "pos 1" ) } )
ENDIF
IF ! o:lGetSimPhoneEntry( 110, SIM_PBSTORAGE_SIM, @a )
Alert( "Pos 123 error" )
ELSE
AEval( a, {| n | Alert( "Phone: " + n[ 1 ] + hb_eol() + "Name: " + n[ 2 ] + hb_eol() + "Adr. Type: " + Str( n[ 3 ] ) + hb_eol() + "Plan Type: " + Str( n[ 4 ] ), "pos 110" ) } )
ENDIF
IF ! o:lSetSimPhoneEntry( 80, SIM_PBSTORAGE_SIM, "660099696", "pepeluis", SIM_NUMPLAN_UNKNOWN, SIM_ADDRTYPE_NATIONAL )
Alert( "Error writing pos 80 Errpr=>" + Str( o:nLastError ) )
ENDIF
IF ! o:lDelSimPhoneEntry( 80, SIM_PBSTORAGE_SIM )
Alert( "Error deletein pos 80 Errpr=>" + Str( o:nLastError ) )
ENDIF
IF ! o:lDeInitialize()
Alert( "Not De-Initialized SIM api. Error :" + Str( o:nLastError ) )
ELSE
Alert( "Api Sim Deinitialized!!!" )
ENDIF
o:End()
#else
? "This test requires WinCE to run."
#endif
RETURN