SMS in my opinion

SMS in my opinion

Postby dutch » Fri Jul 17, 2009 12:04 pm

Dear Otto&Jose,

- Jose source code is working perfect for PDA Application.
- Skype call is very good job but need internet connection and high cost.
- For my case, I need SMS Server for serving all client pc. The weak point to use PDA phone is battery and wifi.
- I think mCore ActiveX Component with GSM USB modem is best choice for me. Because it has no problem with battery (it use file server power via USB) and
without need wifi or internet connection. Just GSM USB modem (AirCard) and it quite simple and low cost (GSM Provider Promotion).

This is our test and idea.

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: SMS in my opinion

Postby Otto » Fri Jul 17, 2009 4:48 pm

Hello Dutch,
this is exactly what I think, too.
Would you be so kind to share how to use mCore ActiveX component with FIVEWIN?

Thanks in advance
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6334
Joined: Fri Oct 07, 2005 7:07 pm

Re: SMS in my opinion

Postby dutch » Sun Jul 19, 2009 3:36 am

Dear Otto,

This is sample code to use with mCore 1.8. I can test with NOKIA mobile easily and I going to buy GSM modem to test it.
Code: Select all  Expand view  RUN
#define __NO_FROMCODE__
#define __NO_TSBAR__
#define __NO_TSTSAY__
#define __NO_TSLINES__
#define __NO_TSRADIO__

#include "fivewin.ch"
#include 'Ads.ch'


#define ADS_ABORT    .T.
#define ADS_CONTINUE .F.

static oWnd, oFont

external AdsKeyCount, AdsGetRelKeyPos, AdsSetRelKeyPos

REQUEST DBFCDX, DBFFPT

static oTimer, cRDD, cFOPath, objSMS

*----------------------*
FUNCTION main()
local oGet[2]
local cText := space(160)
local cPhone:= space(15)
local lAlert:= .F.
local oIni, cPort, cBaudRate, cParity, cDataBits, cStopBits, nRDDType

SET EPOCH TO 1940
SET DATE FORMAT TO 'DD/MM/YY'
SET DATE BRITISH

SET(_SET_DELETED,.T.)

SetHandleCount(200)  

if !file(".\SMS.INI")
    PortSetup()
end

INI oIni FILE ".\SMS.INI"
GET cRDD            SECTION "RDD" ENTRY "RDDTYPE"   OF oIni DEFAULT "LOCAL"
GET cFoPath     SECTION "RDD" ENTRY "RDDPATH"   OF oIni DEFAULT ".\"
GET cPort       SECTION "
SMS" ENTRY "PORT"      OF oIni DEFAULT "COM5"
GET cBaudRate   SECTION "
SMS" ENTRY "BAUDRATE"  OF oIni DEFAULT "19200 "
GET cParity     SECTION "
SMS" ENTRY "PARITY"        OF oIni DEFAULT "N"
GET cDataBits   SECTION "
SMS" ENTRY "DATABITS"  OF oIni DEFAULT "8"
GET cStopBits   SECTION "
SMS" ENTRY "STOPBITSP"     OF oIni DEFAULT "1"
ENDINI

do case
   case cRDD = 'LOCAL'
        nRDDType := 1
   case cRDD = 'REMOTE'
        nRDDType := 2
   case cRDD = 'INTERNET'
        nRDDType := 4
   otherwise
        nRDDType := 7
end        

if right(cFoPath,1) <> '' .and. !empty(cFoPath)
   cFoPath := cFoPath+''  
end  

/*
REQUEST ADS

   RddRegister( "
ADS", 1 )
   Rddsetdefault( "
ADS" )
   AdsSetDeleted(.T.)
   AdsSetServerType( nRDDType )  // 1,2,4,7
   AdsSetFileType( ADS_CDX )   // 2
   AdsRightsCheck(.F.)

   REQUEST ADSKeyCount, ADSKeyNo, OrdKeyCount, OrdKeyNo, ADSKEYCOUNT, ADSGETRELKEYPOS, ADSSETRELKEYPOS

   SET OPTIMIZE ON
*/

objSMS := CreateObject("
mCore.SMS")
objSMS:Port     := rtrim(cPort)
objSMS:BaudRate:= val(cBaudRate)
objSMS:Parity  := rtrim(cParity)
objSMS:DataBits:= val(cDataBits)
objSMS:StopBits:= rtrim(cStopBits)


DEFINE FONT oFont NAME "
Tahoma"  SIZE 0, -12

DEFINE WINDOW oWnd TITLE 'SMS program' PIXEL ;
         MENU BuildMenu()

    oWnd:oFont := oFont

   @  15, 10 SAY 'Mobile# ' SIZE 80,18 PIXEL OF oWnd TRANSPARENT COLOR CLR_WHITE
   @  40, 10 SAY 'Message ' SIZE 80,18 PIXEL OF oWnd TRANSPARENT COLOR CLR_WHITE
   @ 175, 10 SAY 'Alert' SIZE 80, 18 PIXEL OF oWnd TRANSPARENT COLOR CLR_WHITE
 
   @  13, 80 GET oGet[1] VAR cPhone SIZE 200, 20 PIXEL OF oWnd
   @  38, 80 GET oGet[2] VAR cText  SIZE 200,120 PIXEL OF oWnd TEXT
   @ 172, 80 CHECKBOX lAlert PROMPT '' SIZE 20,20 PIXEL OF oWnd


   @ 200, 40 BUTTON 'Send SMS '+cPort SIZE 120, 30 OF oWnd PIXEL ACTION (SendSms(cPort,cPhone,cText,lAlert))
   @ 200,190 BUTTON 'Exit' SIZE 120, 30 OF oWnd PIXEL ACTION (oWnd:End())


ACTIVATE WINDOW oWnd ON INIT (oGet[1]:SetFocus())
objSMS:DisConnect()
objSMS = NIL

return nil

*-----------------*
Function BuildMenu
local oMenu

MENU oMenu 2007
    MENUITEM 'Set Up'       ACTION PortSetup()
    MENUITEM 'Exit'         ACTION oWnd:End()
ENDMENU 

return oMenu


*---------------------------------------------*
Function SendSms( cPort, cPhone, cText, lAlert )
LOCAL objLicense, objInbox, n

if subs(cPhone,1,1) ='0'
   cPhone := "
+66"+right(rtrim(cPhone),len(rtrim(cPhone))-1)
elseif subs(cPhone,1,1) <> '+'
   cPhone := "
+"+right(rtrim(cPhone),len(rtrim(cPhone))-1)
end
/*
objSMS := CreateObject("
mCore.SMS")
objSMS:Port            := cPort
objSMS:BaudRate        := 38400
objSMS:Parity          := "
N"
objSMS:DataBits        := 8
objSMS:StopBits        := "
1"
*/
* This code to Send SMS
objSMS:LongMessage     := 0 // Send as Single Truncated Message when exceeded 160 chars in both types *objSMS:LongMessage    := 1 // Send as multiple Messages But show as Individual un-formated messages with out Page Nos. to Receipient (160 + Remainig of Each Message)
*objSMS:LongMessage    := 2 // Send as multiple Messages But show as Formated messages with Page Nos. to Receipient (148 + Remaining Len of Each Message) *objSMS:LongMessage    := 3 // Send as multiple messages but show as single to Receipient (Entire Length or 152 + Remaining))
* This is heart of the main functionality
objSMS:SendSMS(rtrim(cPhone), rtrim(cText), lAlert)
IF objSMS:IsError(.F.)
   MsgInfo("
Error " + CStr(objSMS:ErrorCode) + ;
           "
: " + objSMS:ErrorDescription)
ENDIF


* This code to Receive the SMS
/*
objInbox := objSMS:Inbox()
objInbox:Concatenate := .T.
objSMS:MessageMemory := "
SM"
objInbox:Refresh()
If objInbox:HasMessages
   MsgInfo("
Total "+ LTRIM(STR(objInbox:Count))+ " messages are there in inbox!")
     For n = 1 TO objInbox:Count
          ?ObjInbox:Message(n):TimeStampRFC + CHR(13)+CHR(10) + "
From: " + ;
           ObjInbox:Message(n):Phone + CHR(13)+CHR(10) + ObjInbox:Message(n):Text
     Next
EndIf

objSMS:DisConnect()
objSMS = NIL
*/
RETURN nil

*------------------*
Procedure PortSetup
local oDlg, oGet, oCbx, oSay, oBtn, oFont, oIni
local cRddType, cIpAdd, cPort, cBaudRate, cParity, cDataBits, cStopBits, nLoop, lSave, n
local aRddType := {'LOCAL   ', 'REMOTE  ', 'INTERNET'}
local aPort, aBaudRate, aParity, aDataBits, aStopBits

aPort := {}
for n := 1 to 32
     aadd( aPort, "
COM"+ltrim(str(n,2)) )
next

aBaudRate := {'1200  ','2400  ','4800  ','9600  ','19200 ','38400 ','57600 ','115200','230400','460800'}
aParity  := {'N','E'}
aDataBits := {'7','8'}
aStopBits := {'1','2'}
                         
cRddType := 'LOCAL   '
cIpAdd  := '.'+space(48)
lSave       := .F.

INI oIni FILE "
.\SMS.INI"
GET cRddType    SECTION "
RDD" ENTRY "RDDTYPE"   OF oIni DEFAULT cRddType
GET cIpAdd      SECTION "
RDD" ENTRY "RDDPATH"   OF oIni DEFAULT cIpAdd
GET cPort       SECTION "
SMS" ENTRY "PORT"          OF oIni DEFAULT "COM3"
GET cBaudRate   SECTION "
SMS" ENTRY "BAUDRATE"  OF oIni DEFAULT "19200 "
GET cParity     SECTION "
SMS" ENTRY "PARITY"        OF oIni DEFAULT "N"
GET cDataBits   SECTION "
SMS" ENTRY "DATABITS"  OF oIni DEFAULT "8"
GET cStopBits   SECTION "
SMS" ENTRY "STOPBITS"  OF oIni DEFAULT "1"

DEFINE FONT oFont NAME "
Tahoma" SIZE 0, -12

DEFINE DIALOG oDlg FROM 0, 0 TO 250, 400 TITLE 'Server Setup' PIXEL FONT oFont

    oDlg:lHelpIcon := .F.

    @  10, 10 SAY oSay PROMPT 'Server Type' SIZE 50,12 OF oDlg PIXEL
    @  24, 10 SAY oSay PROMPT 'Address' SIZE 50,12 OF oDlg PIXEL
    @  38, 10 SAY oSay PROMPT 'Port' SIZE 50,12 OF oDlg PIXEL
    @  52, 10 SAY oSay PROMPT 'BaudRate' SIZE 50,12 OF oDlg PIXEL
    @  66, 10 SAY oSay PROMPT 'Parity' SIZE 50,12 OF oDlg PIXEL
    @  80, 10 SAY oSay PROMPT 'DataBits' SIZE 50,12 OF oDlg PIXEL
    @  94, 10 SAY oSay PROMPT 'StopBits' SIZE 50,12 OF oDlg PIXEL
   
    @   7, 50 COMBOBOX oCbx VAR cRddType ITEMS aRddType OF oDlg PIXEL
    @  21, 50 GET oGet      VAR cIpAdd   OF oDlg PIXEL SIZE 130,12 ;
                 VALID !empty(cIpAdd) ;
             ACTION (cIpAdd := cGetDir('Select Folder'), oGet:Refresh(), oBtn:SetFocus())
             
    @  35, 50 COMBOBOX oCbx VAR cPort       ITEMS aPort OF oDlg PIXEL // SIZE 130,12
    @  49, 50 COMBOBOX oCbx VAR cBaudRate   ITEMS aBaudRate OF oDlg PIXEL // SIZE 130,12    
    @  63, 50 COMBOBOX oCbx VAR cParity     ITEMS aParity OF oDlg PIXEL // SIZE 130,12
    @  77, 50 COMBOBOX oCbx VAR cDataBits   ITEMS aDataBits OF oDlg PIXEL // SIZE 130,12    
    @  91, 50 COMBOBOX oCbx VAR cStopBits   ITEMS aStopBits OF oDlg PIXEL // SIZE 130,12    
                 
    @  110, 80 BUTTON oBtn PROMPT 'OK' OF oDlg SIZE 50,15 PIXEL ;
                 WHEN   (!empty(cRddType).and.;
                            !empty(cIpAdd)  .and.;
                            !empty(cPort)    .and.;
                            !empty(cParity)  .and.;
                            !empty(cDataBits)    .and.;
                            !empty(cStopBits)    .and.;
                            !empty(cBaudRate)) ;
                 ACTION (lSave := .T., oDlg:End())

ACTIVATE DIALOG oDlg CENTERED

oFont:End()

if lSave
    SET SECTION "
RDD" ENTRY "RDDTYPE"   TO rtrim(cRddType)  OF oIni
    SET SECTION "
RDD" ENTRY "RDDPATH"   TO rtrim(cIpAdd)        OF oIni
    SET SECTION "
SMS" ENTRY "PORT"      TO rtrim(cPort)         OF oIni
    SET SECTION "
SMS" ENTRY "BAUDRATE"  TO rtrim(cBaudRate) OF oIni
    SET SECTION "
SMS" ENTRY "PARITY"    TO cParity              OF oIni
    SET SECTION "
SMS" ENTRY "DATABITS"  TO cDataBits            OF oIni
    SET SECTION "
SMS" ENTRY "STOPBITS"  TO cStopBits            OF oIni
end
ENDINI

return

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: SMS in my opinion

Postby Otto » Sun Jul 19, 2009 8:02 am

Hello Dutch,

thank you for sharing the code.
This is really what I would need to substitute my old VB6 program.

Do you have a link where to buy mCore ?

I see you are now using ADS.
Maybe you find some time to comment about the advantages running ADS and the problems you faced updating to ADS.



Thanks in advance
Otto

PS:
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6334
Joined: Fri Oct 07, 2005 7:07 pm

Re: SMS in my opinion

Postby dutch » Sun Jul 19, 2009 1:20 pm

Dear Otto,

http://www.logixmobile.com
Otto wrote:Do you have a link where to buy mCore ?

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 2 guests