Files
harbour-core/contrib/hbwin/tests/simwce.prg
Viktor Szakats 58faf91453 2016-01-14 19:17 UTC+0100 Viktor Szakats (vszakats users.noreply.github.com)
* *
    % remove brandings and homepage [1] from copyright header. Pass 1 - using script.
      [1] nobody has access to it anymore AFAIK - and it's also just
          a redirect since long
    ! update url in copyright header
    ; this should make the diff between 3.4 and 3.2 easier to manage
2016-01-14 19:18:17 +01:00

70 lines
2.0 KiB
Plaintext

/*
* SIM test code
*
* Copyright 2009 Jose Luis Capel <jlcapel@hotmail.com>
*/
#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