Thursday, June 25, 2009

How to send SMS using SMSLib over bluetooth link on windows platform

Hello readers,
purpose of this blog is to explain 'How to send SMS using SMSLib '.

Assumption:
1. You have java1.5 or letter installed on your Computer
2. You are on WinXP
3. Your java installtion directory JAVA_HOME = c:\java\jdk1.5
4. You have no separate jre installed on your pc ( you are yousing jre that is loacated at
JAVA_HOME\jre)
5. You hava any java supported mobile phone ( I have tested on Nokia 7210, N97, N72)

Here We will connect PC with any java supported mobile via "Standard Serial Over blue tooth link". So you need BlueTooth Devise ( Blue tooth radio) .

STEP 1. Download SMSLib binary distribution from here
STEP 1. Download SMSLib src from here
STEP 2. Download RXTX from here.

STEP 3. Download CommonsNet from here.
STEP4. Download javacomm20-win32 from here.
STEP5. Download slf4j-1.5.6 from here.
STEP6. Download log4j-1.2.8.jar from here

STEP7. Unzip all the files in suitable location

STEP8. Copy following files to JAVA_HOME\jre\lib\ext
1. commons-net-2.0.jar from CommonsNet\commons-net-2.0.jar
2. comm.jar from javacomm20-win32\commapi\comm.jar
3. javax.comm.properties from javacomm20-win32\commapi\javax.comm.properties
4.RXTXcomm.jar from rxtx-2.1-7-bins-r2\RXTXcomm.jar
5. All the jar from slf4j-1.5.6\*.jar
6. smslib-3.4.1.jar from smslib-v3.4.1-bin\dist\lib\smslib-3.4.1.jar

STEP9. Copy following files to JAVA_HOME\jre\bin
1.win32com.dll from javacomm20-win32\commapi\win32com.dll
2. rxtxSerial.dll from rxtx-2.1-7-bins-r2\Windows\i368-mingw32\rxtxSerial.dll
3. rxtxParallel.dll from rxtx-2.1-7-bins-r2\Windows\i368-mingw32\rxtxParallel.dll

STEP10. Copy following files to C:\Program Files\WINDOWS\system32
1.win32com.dll from javacomm20-win32\commapi\win32com.dll
2. rxtxSerial.dll from rxtx-2.1-7-bins-r2\Windows\i368-mingw32\rxtxSerial.dll
3. rxtxParallel.dll from rxtx-2.1-7-bins-r2\Windows\i368-mingw32\rxtxParallel.dll

STEP11. If you are using any java IDE (i.e netbeans) then create new project,
add source packages smslib-v3.4.1-src\src\java.
You need to have all the file of STEP 8 in your class path.( to compile the project) and build project. Set misc.CommTest as main class of the project

STEP12.
Connect Bluetooth devise to your computer's USB port. If PC promps you for driver installation
then install the driver. If your PC can not find any suitable driver the get the
driver from someware for Standard Serial Link Over BuleTooth

STEP 13. Once the driver is installed start bluetooth of mobile phone
STEP14

Open control panel/BueToothDevice
click add
check 'select passkey for me'
click next
system will display pass key
accept connection from mobile phone using that pass key( allow connections without prompt)

STEP15.
Open control panel/Phone and modem
You should see one modem attached to port like 'COM5' in modem list.

STEP16.
Run misc.CommTest and wait for programm to complete.
When programm completes , Note-down for which values of boude rate and comm port
programm printed text like

Getting Info :
(some text)(model name of us phone) i.e (Some text)Nokia7210 Suppernova.
You have to note values for the com port attached to your modem in modem list ( comtrol panel /phone and modem)

STEP17
Open examples.modem.SendMessage.java file in your IDE
Modefy following line
SerialModemGateway gateway = new SerialModemGateway("modem.com1", "COM1", 57600, "Nokia", "6310i");
according to your environment.
1. First arg = here first argument of the SerialModemGateway() constructor can be any String
2. 2nd Arg = com port ( port attached to your modem in modem list ( comtrol panel /phone and modem))
3. 3rd arg = oude rate for which commtest got info( refer to step16)
4. 4rth arg = manufacturer of your mobile phone i.e Nokia , SAMSUNG
5. 5th arg = Model name of your mobile phone ( refer to step16)


Modify following line
msg = new OutboundMessage("+306948494037", "Hello from SMSLib!");
here replace +306948494037 with +<> i.e +919275901456

add following line someware aftwre instantiation of SerialModemGateway
gateway.setSMSCNumber("+919825068000")
This smsc number can be found from you mobile's 'Message'/'Message Settings' depending on your mobile phone software

STEP18. Run examples.modem.SendMessage

Best of luck
















10 comments:

  1. hi this is nisha
    thank u so much for your valuable post
    It was really fantastic...
    thanku once again.

    ReplyDelete
  2. Hi Bhavik ,
    Many thanks for this post.
    its help me great today.
    best of luck.
    keep it up.


    Regards
    Halim

    ReplyDelete
  3. hi thankyou very much...
    higly useful post.It helped me a lot....:)

    ReplyDelete
  4. Hi Bhavik
    I am trying to implement same
    but i am using nokia E5 mobile phone.
    When i run CommTest the program will not respond
    pls advice me
    you can mail me on sushank4u@gmail.com
    thanks in advance.

    ReplyDelete
  5. SMSLib: A Java API library for sending and receiving SMS via a GSM modem or othe
    r supported gateways.
    This software is distributed under the terms of the Apache v2.0 License.
    Web Site: http://smslib.org
    Version: 3.5.3
    SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class pat
    h, preempting StackOverflowError.
    SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more det
    ails.
    Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.apache.log4j.Logger.getLogger(Logger.java:40)
    at org.smslib.helper.Logger.(Logger.java:49)
    at org.smslib.helper.Logger.(Logger.java:29)
    at org.smslib.Service.listSystemInformation(Service.java:113)
    at org.smslib.Service.initializeService(Service.java:103)
    at org.smslib.Service.(Service.java:95)
    at org.smslib.Service.(Service.java:90)
    at SendMessage.doIt(SendMessage.java:33)
    at SendMessage.main(SendMessage.java:78)
    Caused by: java.lang.IllegalStateException: Detected both log4j-over-slf4j.jar A
    ND slf4j-log4j12.jar on the class path, preempting StackOverflowError. See also
    http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
    at org.apache.log4j.Log4jLoggerFactory.(Log4jLoggerFactory.java:
    51)
    ... 9 more

    Im getting this error. Help me as i need this for my project..
    you can mail me on 2k6sriram@gmail.com

    Thank yo .

    ReplyDelete
    Replies
    1. Hi,
      I am also facing same error, u got the solution? If yes Please help me.
      Shekhar

      Delete
  6. Casino queen - Casino King Japan
    The latest 퍼스트 카지노 casino king Japan. クイーンカジノ the latest 10cric login slot machine games casino king king king jones slots online with casino king jones slots. The  Rating: 4.1 · ‎2 votes

    ReplyDelete
  7. Casino-A-Story-of-The-Art - FilmfileEurope
    The 넷마블 도메인 gaming mib 사이트 company Casumo, which 승무패 사이트 will be founded by a team of 이 스포츠 directors 넷 텔러 and directors, has announced a

    ReplyDelete
  8. Hotel & Casino, Dubai, UAE - Air Jordan23
    Guests can try the outdoor pool. If you're get retro jordans looking for a pool in the jordan 23 retro Online centre, the Hotel หารายได้เสริม & Casino, Dubai, UAE has a wide Order jordan 15 retro now range of outdoor swimming pools.Hotel class: retro jordans store Adults onlyRooms: 2616 sq ft

    ReplyDelete