• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5910
  • Last Modified:

Send and receive Sms with Delphi

Hello,

My customer wants to send and receive Sms using my application.
I use Delphi 2010.

The customer wants to buy the Gsm hardware I recommend for this. The application is on network (many people use it at the same time).

1.How can I send and receive Sms? (what methods I can use, what components do you know of to help etc.)
2.What hardware is recommended? A simple mobile phone attached to a computer? A modem?

Thank you
0
starhu
Asked:
starhu
  • 8
  • 7
  • 6
  • +4
1 Solution
 
epasquierCommented:
receiving SMS in your Delphi application can also be done with AT commands. Here is an example how :
http://www.developershome.com/sms/howToReceiveSMSUsingPC.asp

But I would recommend using a piece of software that already implement sending/receiving SMS, and maybe with a larger kind of phones, even if they don't support the AT "Text mode" command upon which most solutions depend.
Not that if you want to use only AT text mode, that should not be a problem with modern GSM.

Here are a few tools you can consider :
http://www.developershome.com/sms/freeLibForSMS.asp

For Delphi integration, I would look at (in this list above)
- gnokii : http://www.gnokii.org/
- gsmlib : the link provided in developershome article is not good anymore. I found this instead for gsmlib
http://ostatic.com/gsmlib 

pro & cons for gnokii :
+ support other phones without AT Text mode
+ GPL licence
+/- Command line tool : can be viewed both as pro or con : easy prototyping, but you'll have to manage the process execution and capture of the output.
- - : source code only, and the main target is linux. But you can compile it with MinGW and create a Windows 32 console application in no time.
If you have time, and enough C knowledge and even a bit of experience with MinGW, you could alter the source code to make a dll instead. A dll would be much much easier to integrate with a Delphi application, and more reliable.
So gnokii could well be the best solution in the long run, but there is still some work to do to make it perfect (dll)

0
 
epasquierCommented:
about gnokii :
you can download the full source files, and also a compiled package for Win32

I got this :
http://gnokii.org/download/gnokii/binaries/win32/gnokii-0.6.30-release-setup.msi

and it installed me this files :
gnokii.exe
libusb0.dll
iconv.dll
intl.dll
libglib-2.0-0.dll
libgnokii.dll

So, as you can see, this software is already split in dll, and I suppose that gnokii.exe only provides the interface (command line) to call libgnokii.dll (which will need all the other dlls).
Which probably means that all you need to do is to set those dlls files with your application .exe, and call libgnokii.dll (you'll certainly find a C header for this lib in the source code files - all you'll have to do is to convert it to pascal/Delphi)
0
Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

 
tsheraman22Commented:
Here is a sample script

function SendSMS (
      AccountId : String;
      Email : String;
      Password : String;
      Recipient : String;
      Message : String) : Integer; stdcall; external 'redoxygen.dll';

procedure SendMessage (AccountID, Email, Password, Recipient, Message : String)

var
      Result : Integer;

begin
      Result := SendSMS(AccountID, Email, Password, Recipient, Message);
end;
0
 
epasquierCommented:
tsheraman22
a) You don't say what is your code doing : it uses a SMS Gatway. One in many.
b) Your code is in fact a call to a dll, which you don't give (so it's totally useless)
c) a SMS gateway such as Red Oxygen needs an account to send SMS, and of course that's not free of charge

maybe you can elaborate a bit, at least say how you used Red Oxygen successfully, why it was a good bargain for you/your organization to pay for their service, and how much ?
0
 
Geert GruwezOracle dbaCommented:
there is also drbob42's solutions
http://www.drbob42.com/SMS/
0
 
ThommyCommented:
What about using a web service for sending SMS???

Try that...

Send a SMS (short message service to mobile phone) with Delphi
http://www.delphi3000.com/articles/article_2189.asp?SK=

Do you already know this article about Delphi and SMS???

Using Short Message Services in Delphi applications
http://www.drbob42.com/examines/examin97.htm
0
 
ThommyCommented:
@Geert
Sorry, did not recognize that you have sended the same link to Dr. Bob...

0
 
aikimarkCommented:
Another solution path might include Google Voice.  However, I haven't seen any Delphi examples of this.
0
 
aikimarkCommented:
0
 
aikimarkCommented:
This might also provide a path via HTML (Post)
http://posttopic.com/topic/google-voice-add-on-development
0
 
starhuAuthor Commented:
Thank you for the answers.

I told the customer that there are Sms services (with monthly costs) but he wants a "real" Gsm phone in his office.

So I need to find a component that can communicate with a Gsm phone :-(

Epasquier: as for Gnokii, I need a C programmer to help or a software that tells me what functions are in the dll to call.

The best solution would be a native Delphi component with support.
0
 
aikimarkCommented:
What country/countries will this need to accommodate?
0
 
epasquierCommented:
the tools used :
- to see what functions are a in dll
http://www.nirsoft.net/utils/dll_export_viewer.html

Used on libgnoki.dll (in the binary Win32 package I already talked about)
it gives this list of functions, that looks good : lots of hi-level functions. Now we only have to find their signature (the parameters), to make the .Pas unit that will declare those function as external calls to the dll.
device_getfd
gn_bmp_clear
gn_bmp_null
gn_bmp_point
gn_bmp_point_clear
gn_bmp_point_set
gn_bmp_print
gn_bmp_resize
gn_bmp_sms_encode
gn_bmp_sms_read
gn_call_answer
gn_call_cancel
gn_call_check_active
gn_call_dial
gn_call_divert_call_type2str
gn_call_divert_operation2str
gn_call_divert_type2str
gn_call_get_active
gn_call_notifier
gn_calnote2ical
gn_calnote2icalstr
gn_calnote_recurrence2str
gn_calnote_type2str
gn_cfg_bluetooth_create
gn_cfg_file_read
gn_cfg_free_default
gn_cfg_generic_create
gn_cfg_get
gn_cfg_info
gn_cfg_memory_read
gn_cfg_phone_load
gn_cfg_read_default
gn_cfg_section_create
gn_cfg_variable_set
gn_char_def_alphabet
gn_char_get_encoding
gn_char_set_encoding
gn_connection_type2str
gn_country_code_get
gn_country_get
gn_country_name_get
gn_country_name_translate
gn_data_clear
gn_device_lock
gn_device_unlock
gn_elog_handler
gn_elog_write
gn_error_print
gn_file_bitmap_read
gn_file_bitmap_save
gn_file_bitmap_show
gn_file_phonebook_raw_parse
gn_file_phonebook_raw_write
gn_file_ringtone_read
gn_file_ringtone_save
gn_get_connectiontype
gn_gsm_f
gn_gsm_info
gn_gsm_initialise
gn_ical2calnote
gn_ical2todo
gn_icalstr2calnote
gn_icalstr2todo
gn_ldif2phonebook
gn_lib_addressbook_memstat
gn_lib_cfg_get
gn_lib_get_connection_name
gn_lib_get_pb_caller_group
gn_lib_get_pb_date
gn_lib_get_pb_location
gn_lib_get_pb_memtype
gn_lib_get_pb_name
gn_lib_get_pb_num_subentries
gn_lib_get_pb_number
gn_lib_get_pb_subentry
gn_lib_get_phone_imei
gn_lib_get_phone_manufacturer
gn_lib_get_phone_model
gn_lib_get_phone_product_name
gn_lib_get_phone_revision
gn_lib_get_supported_connection
gn_lib_get_supported_phone_model
gn_lib_init
gn_lib_is_connectiontype_supported
gn_lib_lasterror
gn_lib_library_free
gn_lib_phone_close
gn_lib_phone_open
gn_lib_phonebook_entry_delete
gn_lib_phonebook_entry_isempty
gn_lib_phonebook_prepare_write_entry
gn_lib_phonebook_read_entry
gn_lib_phonebook_write_entry
gn_lib_phoneprofile_free
gn_lib_phoneprofile_load
gn_lib_phoneprofile_load_from_external
gn_lib_phoneprofile_load_from_file
gn_lib_search_one_connected_phone
gn_lib_set_pb_caller_group
gn_lib_set_pb_date
gn_lib_set_pb_location
gn_lib_set_pb_memtype
gn_lib_set_pb_name
gn_lib_set_pb_number
gn_lib_set_pb_subentry
gn_lib_version
gn_line_get
gn_log_debug
gn_log_debug_mask
gn_log_rlpdebug
gn_log_rlpdebug_mask
gn_log_xdebug
gn_log_xdebug_mask
gn_memory_type2str
gn_memory_type_print
gn_mms_alloc
gn_mms_convert
gn_mms_delete
gn_mms_detect_format
gn_mms_free
gn_mms_get
gn_model_get
gn_network2country
gn_network_code_find
gn_network_code_get
gn_network_get
gn_network_name_get
gn_note_get
gn_number_sanitize
gn_phone_model_get
gn_phonebook2ldif
gn_phonebook2vcard
gn_phonebook2vcardstr
gn_phonebook_entry_sanitize
gn_phonebook_entry_type2str
gn_phonebook_group_type2str
gn_phonebook_number_type2str
gn_power_source2str
gn_profile_callalert_type2str
gn_profile_keyvol_type2str
gn_profile_message_type2str
gn_profile_vibration_type2str
gn_profile_volume_type2str
gn_profile_warning_type2str
gn_ringtone_get_tone
gn_ringtone_pack
gn_ringtone_set_duration
gn_ringtone_unpack
gn_security_code_type2str
gn_sm_functions
gn_sm_loop
gn_sms2mbox
gn_sms_default_deliver
gn_sms_default_submit
gn_sms_delete
gn_sms_delete_no_validate
gn_sms_get
gn_sms_get_folder_changes
gn_sms_get_no_validate
gn_sms_message_format2str
gn_sms_message_status2str
gn_sms_message_type2str
gn_sms_save
gn_sms_send
gn_sms_udh_add
gn_sms_udh_type2str
gn_sms_vp_time2str
gn_str2memory_type
gn_subentrytype2string
gn_timestamp_get
gn_timestamp_isvalid
gn_timestamp_set
gn_todo2ical
gn_todo2icalstr
gn_todo_priority2str
gn_vcard2phonebook
gn_vcardstr2phonebook
gn_wap_authentication2str
gn_wap_bearer2str
gn_wap_call_speed2str
gn_wap_call_type2str
gn_wap_gprs2str
gn_wap_login2str
gn_wap_push_encode
gn_wap_push_init
gn_wap_session2str

Open in new window

0
 
epasquierCommented:
then, I downloaded the full source code here :
http://www.gnokii.org/download/gnokii/0.6.x/gnokii-0.6.29.tar.gz

in this package there is a file, include\gnockii.h
gnokii.h

it has all we need, as with this we know what are the types used by the library (we might have to dig in referenced .h headers) and what are the parameters of all the dll exported functions.
But that still require some conversion work. For this, we can count on Dr Bob to help us
http://www.drbob42.com/delphi/headconv.htm

Unfortunately, for the moment HeadConv fails to convert the Gnokii.h file. Probably some inclusion problems, directory config or whatever. I'll try again
0
 
epasquierCommented:
Ok, that is a very complex dll, it would require maybe 2 or 3 days of work to convert it successfully to Delphi, let alone testing it. I just can't do it myself, I hope you understand.
so, I would recommend first that you use the gnokii command line executable, read its documentation, and prototype your solution with it. That way you would be able to test if the solution is even possible with your hardware (the phone) and gnokii code.
Maybe then you don't have to integrate the dll but can launch from Delphi gnokii with the good parameters to make it do what you want.
Only then, if you like that first step but want more control, and if you feel up to the task, then you can start converting the gnokii.h and call the dll directly.
If you ever achieve that, give your .PAS back to gnokii developers, I'm sure a lot of people would love it. And if you can, post it somewhere visible (here, in Torry's Delphi page ...) for all the Delphi community
0
 
aikimarkCommented:
@epasquier

Which is the more current C++ header converter, DrBob or JEDI?
0
 
epasquierCommented:
I believe it's JDarth (said to be based on Dr Bob's HeadConv v4.20)
http://sourceforge.net/projects/jdarth/

The problem is that v4.2 did not manage header files inclusion, so you have to put them manually in one file. And then you'll have probably too much to convert because all the inner stuff comes as well.
One would have to know very well how all that is supposed to work to make a good .PAS interface.
Then maybe build components above the dll. That's a shitload of work.

I've been thinking, maybe it's not necessary to convert all the header, to send/receive SMS there is probably only a handful of functions and record types to use.
The idea would be then to prototype the send/receive with the command line, then see in the command line tool how the lib is called for doing just that.
But at some point, starhu will have to put his hands in the mud, we can't do it all for him, not in one question, not only in Delphi Zone (people having experience with HeadConv beyond simple headers might prove useful)
0
 
starhuAuthor Commented:
"What country/countries will this need to accommodate?"  Hungary. But I don't think this matters in this case.
0
 
starhuAuthor Commented:
What about looking from the mobile vendor side?
I mean to find a mobile phone manufacturer as Nokia that has a dll interface to it phones?
And what about an Android phone? Can't I give it a command to send an Sms? After all it uses Wifi.

What do you think?
0
 
aikimarkCommented:
@starhu

I'm intrigued by the concept of going through a smart phone to facilitate text messaging.

If you upgrade to XE2, you might be able to create your application in one IDE.

I think it would most likely use some polling or change notification event in the smart phone app to cause it to get the salient SMS data from a Datasnap server.  Your PC could push data into a ToSend table and the smartphone app could push data to a Received table.
0
 
starhuAuthor Commented:
My real problem is that I need to create a bid for this customer.

This is quite a complex software the sms sending and receiving is only a part of it -> but this is the only part I don't know how to make it.

Therefore I am looking a fairly easy solution. If there is no other way - I mean to buy a Delphi Sms component - I would like to know how much is to get a "Delphi ready" solution.

So if you are sure that you can do it - either a component, or a dll that works - I would like to get a price and I will "build" it in the price of the whole software.

If the customer orders it (I hope he will) then you will get the sum of money if the sms component works.

What do you think? (maybe the answers should be sent in private message? I don't know the rules).

Thanx
0
 
epasquierCommented:
I don't know the rules either concerning your offer, but since ExpertsExchange have a features available for experts to put a "Hire Me" button in ones profile, that means IMO that it is well allowed, if not very common.
So, you can start by clicking on this button, it should allow you to send me an email, from which we can talk business in private
0
 
starhuAuthor Commented:
I will try to look around of different approaches: Android, Gsm modem, Mobile phone connection
0
 
starhuAuthor Commented:
Unfortunately the answers didn't help me. Because I couldn't find any component or an easy and fast solution  I contacted an Android programmer in my country who can develop such an application fairly cheap.

Thank you
0
 
starhuAuthor Commented:
As I stated in my previous message I needed to find an external solution.
0

Featured Post

Put Machine Learning to Work--Protect Your Clients

Machine learning means Smarter Cybersecurity™ Solutions.
As technology continues to advance, managing and analyzing massive data sets just can’t be accomplished by humans alone. It requires huge amounts of memory and storage, as well as high-speed processing of the cloud.

  • 8
  • 7
  • 6
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now