2009-07-30 12:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbwin/Makefile
  + contrib/hbwin/hbsim.ch
  + contrib/hbwin/wce_simc.c
  + contrib/hbwin/wce_smsc.c
  + contrib/hbwin/wce_sim.prg
  + contrib/hbwin/tests/testsim.prg
    + Added SIM reading and SMS sending interfaces for WinCE.
      This is a contribution from Jose Luis Capel. Many thanks for it.

    ; NOTE:
      mingwarm doesn't support these APIs unfortunately, poccarm does,
      and msvcarm as well, but I couldn't try the latter.
      (I've applied formatting, cleanups and some minor fixes)
      Jose and all, please review and test.

  * examples/httpsrv/uhttpd.prg
  * examples/httpsrv/uhttpd.hbp
  * examples/httpsrv/readme.txt
    % Given less focus on the socket selection issue. Now the only
      difference is .prg level API and local API is fully portable.
    * Made the proprietary one the default on all platforms.
      (it looks much more obvious/simple to use, also requires less
      STATIC variables)

  * contrib/hbwin/win_misc.c
    ! Fix for WinCE.

  * ChangeLog
    ! Typos.
This commit is contained in:
Viktor Szakats
2009-07-30 10:01:06 +00:00
parent 1237de4177
commit b3e422d967
11 changed files with 714 additions and 15 deletions

View File

@@ -17,6 +17,37 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-30 12:00 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbwin/Makefile
+ contrib/hbwin/hbsim.ch
+ contrib/hbwin/wce_simc.c
+ contrib/hbwin/wce_smsc.c
+ contrib/hbwin/wce_sim.prg
+ contrib/hbwin/tests/testsim.prg
+ Added SIM reading and SMS sending interfaces for WinCE.
This is a contribution from Jose Luis Capel. Many thanks for it.
; NOTE:
mingwarm doesn't support these APIs unfortunately, poccarm does,
and msvcarm as well, but I couldn't try the latter.
(I've applied formatting, cleanups and some minor fixes)
Jose and all, please review and test.
* examples/httpsrv/uhttpd.prg
* examples/httpsrv/uhttpd.hbp
* examples/httpsrv/readme.txt
% Given less focus on the socket selection issue. Now the only
difference is .prg level API and local API is fully portable.
* Made the proprietary one the default on all platforms.
(it looks much more obvious/simple to use, also requires less
STATIC variables)
* contrib/hbwin/win_misc.c
! Fix for WinCE.
* ChangeLog
! Typos.
2009-07-30 08:48 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* source/common/hbdate.c
+ Enhancement to hb_timeUTCOffset(). (using thread safe
@@ -77,7 +108,7 @@
+ Added hb_timeUTCOffset( void ) -> long (in seconds)
% Using hb_timeUTCOffset() in TIP_TIMESTAMP() and HB_UTCOFFSET().
These functions can now be implemented on .prg level if we
add a .prg level wrapper for hb_timeUTCOffer(), but I have no
add a .prg level wrapper for hb_timeUTCOffset(), but I have no
good idea which format to use to return this value, so maybe
simple signed number of seconds.
@@ -759,7 +790,7 @@
* source/common/hbstr.c
* source/rtl/hbmd5.c
* Moved (and somewhat standardized and renamed) mem to hex C
function from hbm5/rtl to common lib.
function from hbmd5/rtl to common lib.
* bin/hb-func.sh
! Fixed double '%' chars in hbmk.cfg generation.

View File

@@ -23,6 +23,8 @@ C_SOURCES = \
axcore.c \
legacycd.c \
legacyco.c \
wce_simc.c \
wce_smsc.c \
win_dll.c \
win_misc.c \
win_osc.c \
@@ -39,6 +41,7 @@ PRG_SOURCES = \
legacy.prg \
oleauto.prg \
axfunc.prg \
wce_sim.prg \
win_os.prg \
win_reg.prg \
win_tprn.prg \

View File

@@ -0,0 +1,127 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SIM header
*
* Copyright 2009 Jose Luis Capel <jlcapel@hotmail.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/* Error codes for SIM API */
#define SIM_E_OK 0 // This is non standard...
#define SIM_E_HB_MISC ( -1 ) // This is non standard...
#define SIM_E_HB_NOTINITIALIZED ( -10 ) // This is non standard (class tsim not initialized sim)
#define SIM_E_SIMFAILURE ( -100 ) // SIM failure was detected
#define SIM_E_SIMBUSY ( -200 ) // SIM is busy
#define SIM_E_SIMWRONG ( -300 ) // Inorrect SIM was inserted
#define SIM_E_NOSIMMSGSTORAGE ( -400 ) // SIM isn't capable of storing messages
#define SIM_E_SIMTOOLKITBUSY ( -500 ) // SIM Application Toolkit is busy
#define SIM_E_SIMDOWNLOADERROR ( -600 ) // SIM data download error
#define SIM_E_SIMNOTINSERTED ( -700 ) // SIM isn't inserted into the phone
#define SIM_E_PHSIMPINREQUIRED ( -800 ) // PH-SIM PIN is required to perform this operation
#define SIM_E_PHFSIMPINREQUIRED ( -900 ) // PH-FSIM PIN is required to perform this operation
#define SIM_E_PHFSIMPUKREQUIRED ( -1000 ) // PH-FSIM PUK is required to perform this operation
#define SIM_E_SIMPINREQUIRED ( -1100 ) // SIM PIN is required to perform this operation
#define SIM_E_SIMPUKREQUIRED ( -1200 ) // SIM PUK is required to perform this operation
#define SIM_E_INCORRECTPASSWORD ( -1300 ) // Incorrect password was supplied
#define SIM_E_SIMPIN2REQUIRED ( -1400 ) // SIM PIN2 is required to perform this operation
#define SIM_E_SIMPUK2REQUIRED ( -1500 ) // SIM PUK2 is required to perform this operation
#define SIM_E_NETWKPINREQUIRED ( -1600 ) // Network Personalization PIN is required to perform this operation
#define SIM_E_NETWKPUKREQUIRED ( -1700 ) // Network Personalization PUK is required to perform this operation
#define SIM_E_SUBSETPINREQUIRED ( -1800 ) // Network Subset Personalization PIN is required to perform this operation
#define SIM_E_SUBSETPUKREQUIRED ( -1900 ) // Network Subset Personalization PUK is required to perform this operation
#define SIM_E_SVCPINREQUIRED ( -2000 ) // Service Provider Personalization PIN is required to perform this operation
#define SIM_E_SVCPUKREQUIRED ( -2100 ) // Service Provider Personalization PUK is required to perform this operation
#define SIM_E_CORPPINREQUIRED ( -2200 ) // Corporate Personalization PIN is required to perform this operation
#define SIM_E_CORPPUKREQUIRED ( -2300 ) // Corporate Personalization PUK is required to perform this operation
#define SIM_E_MEMORYFULL ( -2400 ) // Storage memory is full
#define SIM_E_INVALIDINDEX ( -2500 ) // Invalid storage index was supplied
#define SIM_E_NOTFOUND ( -2600 ) // A requested storage entry was not found
#define SIM_E_MEMORYFAILURE ( -2700 ) // Storage memory failure
#define SIM_E_SIMMSGSTORAGEFULL ( -2800 ) // Message storage on the SIM is full
#define SIM_E_EMPTYINDEX ( -2900 ) // Storage location is empty
#define SIM_E_NOTREADY ( -3100 ) // SIM isn't yet ready to perform the requested operation
#define SIM_E_SECURITYFAILURE ( -3200 ) // SIM isn't yet ready to perform the requested operation
#define SIM_E_BUFFERTOOSMALL ( -3300 ) // Buffer too small
#define SIM_E_NOTTEXTMESSAGE ( -3400 ) // Requested SMS message is not a text message
#define SIM_E_NOSIM ( -3500 ) // Device doesn't have a SIM
#define SIM_E_NETWORKERROR ( -3600 ) // There was a network error
#define SIM_E_MOBILEERROR ( -3700 ) // Mobile error
#define SIM_E_UNSUPPORTED ( -3800 ) // The command is unsupported
#define SIM_E_BADPARAM ( -3900 ) // Bad parameter
#define SIM_E_UNDETERMINED ( -4000 ) // Undetermined error
#define SIM_E_RADIONOTPRESENT ( -4100 ) // The Radio is not present
#define SIM_E_RADIOOFF ( -4200 ) // The Radio is off
/* Phone book storage locations */
#define SIM_PBSTORAGE_EMERGENCY 0x00000001 // Emergency dial list
#define SIM_PBSTORAGE_FIXEDDIALING 0x00000002 // SIM fixed dialing list
#define SIM_PBSTORAGE_LASTDIALING 0x00000004 // SIM last dialing list
#define SIM_PBSTORAGE_OWNNUMBERS 0x00000008 // SIM ownnumbers lists
#define SIM_PBSTORAGE_SIM 0x00000010 // General SIM Storage
#define SIM_NUMPBSTORAGES 5 // Number of phonebook storages
/* Phonebook Misc | Special phonebook constants */
#define SIM_PBINDEX_FIRSTAVAILABLE 0xFFFFFFFF // Use first phonebook storage entry available
/* Numbering Plan | Defines different numbering plans for SIM_ADDRTYPE_UNKNOWN,
SIM_ADDRTYPE_INTERNATIONAL, and SIM_ADDRTYPE_NATIONAL */
#define SIM_NUMPLAN_UNKNOWN 0x00000000 // Unknown
#define SIM_NUMPLAN_TELEPHONE 0x00000001 // ISDN/telephone numbering plan (E.164/E.163)
#define SIM_NUMPLAN_DATA 0x00000002 // Data numbering plan (X.121)
#define SIM_NUMPLAN_TELEX 0x00000003 // Telex numbering plan
#define SIM_NUMPLAN_NATIONAL 0x00000004 // National numbering plan
#define SIM_NUMPLAN_PRIVATE 0x00000005 // Private numbering plan
#define SIM_NUMPLAN_ERMES 0x00000006 // ERMES numbering plan (ETSI DE/PS 3 01-3)
/* Address Type | Defines different address types */
#define SIM_ADDRTYPE_UNKNOWN 0x00000000 // Unknown
#define SIM_ADDRTYPE_INTERNATIONAL 0x00000001 // International number
#define SIM_ADDRTYPE_NATIONAL 0x00000002 // National number
#define SIM_ADDRTYPE_NETWKSPECIFIC 0x00000003 // Network specific number
#define SIM_ADDRTYPE_SUBSCRIBER 0x00000004 // Subscriber number (protocol-specific)
#define SIM_ADDRTYPE_ALPHANUM 0x00000005 // Alphanumeric address
#define SIM_ADDRTYPE_ABBREV 0x00000006 // Abbreviated number

View File

@@ -0,0 +1,76 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SIM test code
*
* Copyright 2009 Jose Luis Capel <jlcapel@hotmail.com>
* www - http://www.harbour-project.org
*/
#include "sim.ch"
PROCEDURE Main()
#if defined( __PLATFORM__WINCE )
LOCAL o
LOCAL l
LOCAL nTotal, nUsed
LOCAL a
o := wce_sim():New()
l := o:lInitialize()
IF l
Alert("Api Sim initialized!!"+STR( o:nLastError))
Else
Alert("Api Sim NOT initialized!!. Error "+STR(o:nLastError))
ENDIF
/*
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, m | Alert("Phone: "+n[1]+hb_osNewLine()+"Name: "+n[2]+hb_osNewLine()+"Adr. Type: "+STR( n[3])+hb_osNewLine()+"Plan Type: "+STR( n[4])) })
*/
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, m | Alert("Phone: "+n[1]+hb_osNewLine()+"Name: "+n[2]+hb_osNewLine()+"Adr. Type: "+STR( n[3])+hb_osNewLine()+"Plan Type: "+STR( n[4]),"pos 1") })
ENDIF
IF !o:lGetSimPhoneEntry( 110, SIM_PBSTORAGE_SIM, @a )
Alert("Pos 123 error")
ELSE
Aeval(a, {| n, m | Alert("Phone: "+n[1]+hb_osNewLine()+"Name: "+n[2]+hb_osNewLine()+"Adr. Type: "+STR( n[3])+hb_osNewLine()+"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
l := o:lDeInitialize()
IF !l
Alert("Not De-Initialized SIM api. Error :"+STR(o:nLastError))
ELSE
Alert("Api Sim Deinitialized!!!")
ENDIF
o:End()
#endif
RETURN

View File

@@ -0,0 +1,221 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SIM interface code
*
* Copyright 2009 Jose Luis Capel <jlcapel@hotmail.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#if defined( __PLATFORM__WINCE )
#include "hbclass.ch"
#include "common.ch"
#include "hbsim.ch"
CREATE CLASS wce_sim
VAR lInitialized INIT .F.
VAR hSim
VAR nLastError INIT SIM_E_OK
METHOD New()
METHOD End()
METHOD lInitialize() // Must be initialized before any other method
METHOD lDeInitialize() // Must be deinitialized....
METHOD lNumberOfPhoneBookEntries( nType, nTotal , nUsed ) // nTotal, nUsed both by reference
METHOD aGetAllPhoneBookEntries( nType ) // -> array with phoneBook entries of nType storage
METHOD lGetSimPhoneEntry( nPos, nType, aEntry ) // -> aEntry by refence contains phonebook entry
METHOD lSetSimPhoneEntry( nPos, nType, cNumber, cName, nPlan, nAddrType ) // -> .T. / .F. if phonebook entry written
METHOD lDelSimPhoneEntry( nPos, nType ) // -> .T. / .F. if phonebook entry deleted
ENDCLASS
METHOD New() CLASS wce_sim
RETURN Self
METHOD lInitialize() CLASS wce_sim
LOCAL nResult := SimInitialize( @::hSim )
::lInitialized := ( nResult == SIM_E_OK )
::nLastError := nResult
RETURN ::lInitialized
METHOD lDeInitialize() CLASS wce_sim
LOCAL nResult
IF ! ::lInitialized
::nLastError := SIM_E_HB_NOTINITIALIZED
RETURN .F.
ENDIF
nResult := SimDeInitialize( ::hSim )
::lInitialized := !( nResult == SIM_E_OK )
::nLastError := nResult
RETURN nResult == SIM_E_OK
METHOD lNumberOfPhoneBookEntries( nType, /* @ */ nTotal, /* @ */ nUsed ) CLASS wce_sim
LOCAL nResult
IF ! ::lInitialized
::nLastError := SIM_E_HB_NOTINITIALIZED
RETURN .F.
ENDIF
DEFAULT nType TO SIM_PBSTORAGE_SIM
nResult := SimPhoneBookStatus( ::hSim, nType, @nTotal, @nUsed )
::nLastError := nResult
RETURN nResult == SIM_E_OK
METHOD aGetAllPhoneBookEntries( nType ) CLASS wce_sim
LOCAL nResult
LOCAL nTotal
LOCAL nUsed
LOCAL aEntry
LOCAL aEntries
LOCAL nPos
IF ! ::lInitialized
::nLastError := SIM_E_HB_NOTINITIALIZED
RETURN .F.
ENDIF
DEFAULT nType TO SIM_PBSTORAGE_SIM
DEFAULT aEntries TO {}
IF ! ::lNumberOfPhoneBookEntries( nType, @nTotal, @nUsed )
RETURN {}
ENDIF
FOR nPos := 1 TO nUsed
aEntry := {}
nResult := SimReadPhoneBookEntry( ::hSim, nType, nPos, @aEntry )
IF nResult != SIM_E_OK
::nLastError := nResult
EXIT
ELSE
AAdd( aEntries, aEntry )
ENDIF
NEXT
::nLastError := nResult
RETURN aEntries
METHOD lGetSimPhoneEntry( nPos, nType, /* @ */ aEntry ) CLASS wce_sim
LOCAL nResult
LOCAL a
IF ! ::lInitialized
::nLastError := SIM_E_HB_NOTINITIALIZED
RETURN .F.
ENDIF
DEFAULT nType TO SIM_PBSTORAGE_SIM
nResult := SimReadPhoneBookEntry(::hSim, nType, nPos, @a)
aEntry := { a }
::nLastError := nResult
RETURN nResult == SIM_E_OK
METHOD lSetSimPhoneEntry( nPos, nType, cNumber, cName, nPlan, nAddrType ) CLASS wce_sim
LOCAL nResult
IF ! ::lInitialized
::nLastError := SIM_E_HB_NOTINITIALIZED
RETURN .F.
ENDIF
DEFAULT nPos TO SIM_PBINDEX_FIRSTAVAILABLE
DEFAULT nType TO SIM_PBSTORAGE_SIM
nResult := SimWritePhoneBookEntry( ::hSim, nType, nPos, cNumber, cName, nPlan, nAddrType )
::nLastError := nResult
RETURN nResult == SIM_E_OK
METHOD lDelSimPhoneEntry( nPos, nType ) CLASS wce_sim
LOCAL nResult
IF ! ::lInitialized
::nLastError := SIM_E_HB_NOTINITIALIZED
RETURN .F.
ENDIF
DEFAULT nType TO SIM_PBSTORAGE_SIM
nResult := SimDeletePhoneBookEntry( ::hSim, nType, nPos )
::nLastError := nResult
RETURN nResult == SIM_E_OK
METHOD End() CLASS wce_sim
IF ::lInitialized
::lDeInitialize()
ENDIF
RETURN NIL
#endif

View File

@@ -0,0 +1,141 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SIM interface code (low level)
*
* Copyright 2009 Jose Luis Capel <jlcapel@hotmail.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#define HB_OS_WIN_USED
#include "hbapi.h"
#include "hbapiitm.h"
#if defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ )
#include <simmgr.h>
HB_FUNC( SIMINITIALIZE ) /* hSim by reference, lNotifications */
{
HSIM hSim = 0;
HRESULT hResult = SimInitialize( hb_parl( 2 ) ? SIM_INIT_SIMCARD_NOTIFICATIONS : 0, NULL, 0, &hSim );
hb_storptr( hResult == S_OK ? hSim : 0, 1 );
hb_retnl( hResult );
}
HB_FUNC( SIMDEINITIALIZE ) /* hSim */
{
hb_retnl( SimDeinitialize( ( HSIM ) hb_parptr( 1 ) ) );
}
HB_FUNC( SIMPHONEBOOKSTATUS ) /* hSim, nLocation, @nTotal, @nUsed */
{
DWORD dwUsed = 0, dwTotal = 0;
HRESULT hResult = SimGetPhonebookStatus( ( HSIM ) hb_parptr( 1 ), ( DWORD ) hb_parnl( 2 ) /* dwLocation */, &dwUsed, &dwTotal );
hb_stornl( hResult == S_OK ? ( long ) dwTotal : 0, 3 );
hb_stornl( hResult == S_OK ? ( long ) dwUsed : 0, 4 );
hb_retnl( hResult );
}
HB_FUNC( SIMREADPHONEBOOKENTRY ) /* hSim, nLocation, nPos, @aEntry */
{
HSIM hSim = ( HSIM ) hb_parptr( 1 );
DWORD dwIndex = ( DWORD ) hb_parnl( 3 );
SIMPHONEBOOKENTRY PhoneEntry;
PHB_ITEM pArray = hb_itemNew( NULL );
char * szAddress;
char * szText;
PhoneEntry.cbSize = sizeof( SIMPHONEBOOKENTRY );
hb_retnl( SimReadPhonebookEntry( hSim, ( DWORD ) hb_parnl( 2 ) /* dwLocation */, dwIndex, &PhoneEntry ) );
szAddress = HB_TCHAR_CONVFROM( PhoneEntry.lpszAddress );
szText = HB_TCHAR_CONVFROM( PhoneEntry.lpszText );
hb_arrayNew( pArray, 5 );
hb_arraySetC( pArray, 1, szAddress );
hb_arraySetC( pArray, 2, szText );
hb_arraySetNL( pArray, 3, PhoneEntry.dwAddressType );
hb_arraySetNL( pArray, 4, PhoneEntry.dwNumPlan );
hb_arraySetNI( pArray, 5, dwIndex );
hb_itemCopy( hb_param( 4, HB_IT_ANY ), pArray );
hb_itemRelease( pArray );
HB_TCHAR_FREE( szAddress );
HB_TCHAR_FREE( szText );
}
HB_FUNC( SIMWRITEPHONEBOOKENTRY ) /* hSim, nLocation, nPos, cNumber, cName, nPlan, nAddrType */
{
SIMPHONEBOOKENTRY PhoneEntry;
wchar_t * lpwszAddress = HB_TCHAR_CONVTO( hb_parcx( 4 ) );
wchar_t * lpwszText = HB_TCHAR_CONVTO( hb_parcx( 5 ) );
PhoneEntry.cbSize = sizeof( SIMPHONEBOOKENTRY );
PhoneEntry.dwParams = SIM_PARAM_PBE_ALL;
wcsncpy( PhoneEntry.lpszAddress, lpwszAddress, MAX_LENGTH_ADDRESS );
wcsncpy( PhoneEntry.lpszText , lpwszText , MAX_LENGTH_PHONEBOOKENTRYTEXT );
PhoneEntry.dwAddressType = ( DWORD ) hb_parnl( 7 );
PhoneEntry.dwNumPlan = ( DWORD ) hb_parnl( 6 );
hb_retnl( SimWritePhonebookEntry( ( HSIM ) hb_parptr( 1 ), ( DWORD ) hb_parnl( 2 ), ( DWORD ) hb_parnl( 3 ), &PhoneEntry ) );
HB_TCHAR_FREE( lpwszAddress );
HB_TCHAR_FREE( lpwszText );
}
HB_FUNC( SIMDELETEPHONEBOOKENTRY ) /* hSim, nLocation, nPos */
{
hb_retnl( SimDeletePhonebookEntry( ( HSIM ) hb_parptr( 1 ), ( DWORD ) hb_parnl( 2 ), ( DWORD ) hb_parnl( 3 ) ) );
}
#endif

View File

@@ -0,0 +1,107 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* SMS interface code
*
* Copyright 2009 Jose Luis Capel <jlcapel@hotmail.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#define HB_OS_WIN_USED
#include "hbapi.h"
#if defined( HB_OS_WIN_CE ) && ! defined( __MINGW32__ )
#include <sms.h>
HB_FUNC( SMSSENDMESSAGE ) /* cMessage, cNumber */
{
SMS_HANDLE smshHandle = 0;
HRESULT hr = SmsOpen( SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &smshHandle, NULL ); /* try to open an SMS Handle */
if( hr == ERROR_SUCCESS )
{
SMS_ADDRESS smsaDestination;
TEXT_PROVIDER_SPECIFIC_DATA tpsd;
SMS_MESSAGE_ID smsmidMessageID = 0;
wchar_t * sztMessage = HB_TCHAR_CONVTO( hb_parcx( 1 ) );
wchar_t * sztPhoneNumber = HB_TCHAR_CONVTO( hb_parcx( 2 ) );
BOOL bInternational = ( *sztPhoneNumber == '+' );
/* Create the destination address */
memset( &smsaDestination, 0, sizeof( smsaDestination ) );
smsaDestination.smsatAddressType = bInternational ? SMSAT_INTERNATIONAL : SMSAT_NATIONAL;
lstrcpy( smsaDestination.ptsAddress, sztPhoneNumber );
/* Set up provider specific data */
tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE;
tpsd.psMessageClass = PS_MESSAGE_CLASS0;
tpsd.psReplaceOption = PSRO_NONE;
/* Send the message, indicating success or failure */
hb_retnl( SmsSendMessage( smshHandle,
NULL,
&smsaDestination,
NULL,
( PBYTE ) sztMessage,
_tcslen( sztMessage ) * sizeof( wchar_t ),
( PBYTE ) &tpsd, 12,
SMSDE_OPTIMAL,
SMS_OPTION_DELIVERY_NONE,
&smsmidMessageID ) );
SmsClose( smshHandle );
HB_TCHAR_FREE( sztMessage );
HB_TCHAR_FREE( sztPhoneNumber );
}
else
hb_retnl( -1 );
}
#endif

View File

@@ -65,6 +65,10 @@
#include "hbapi.h"
#ifndef QS_ALLPOSTMESSAGE
#define QS_ALLPOSTMESSAGE 0x0100
#endif
HB_FUNC( WIN_RUNDETACHED )
{
LPTSTR lpCommandName = HB_ISCHAR( 1 ) ? HB_TCHAR_CONVTO( hb_parc( 1 ) ) : NULL;

View File

@@ -9,9 +9,6 @@ Build it with GD: hbmk2 uhttpdgd.hbp
[ This one needs bgd.dll. Please download it from:
http://www.libgd.org/releases/gd-latest-win32.zip ]
Add -DUSE_HB_INET to command line if you want to use Harbour's
built-in socket functions.
To see accepted parameters run: uhttpd -?
Parameters can also be defined using uhttpd.ini file.

View File

@@ -2,9 +2,6 @@
# $Id$
#
# Use -DUSE_HB_INET if you want to turn on Harbour internet socket.
# It's always on on non-Windows systems.
-mt -gui uhttpd.prg cgifunc.prg cookie.prg session.prg socket.c
-l{win}hbwin

View File

@@ -113,17 +113,12 @@
#stdout "Lib GD support disabled"
#endif
/* Force Harbour socket on non-Window systems */
#if ! defined( __PLATFORM__WINDOWS ) .AND. ! defined( USE_HB_INET )
#define USE_HB_INET
#endif
#ifdef USE_HB_INET
#define APP_INET_SUPPORT "_INET"
#stdout "Harbour socket"
#stdout "inet socket API"
#else
#define APP_INET_SUPPORT ""
#stdout "Mindaugas socket"
#stdout "custom socket API"
#endif
#ifdef FIXED_THREADS