Bluetooth Console

Another alternative for developers to test and debug applications without using the emulator is to use the Bluetooth console. In facts it connects the PC directly to the Python environment on the phone. All is needed is to switch the Bluetooth on the phone and to have on the phone a HyperTerminal opened and listening to the COM port. Make sure you have the bluetooth settings of the PC's bluetooth software correctly set:

  • right click on bluetooth icon -> choose open bluetooth settings to open them.
  • choose Options tab, make sure "Turn discovery on" is selected
  • choose COM ports tab, make sure an COM port as "incoming" direction available, if not click add and created an incoming COM port 

Let us have a look at the steps needed to run the “Hello World!” script via Bluetooth Console:

  1. Open a HyperTerminal on the PC listening to the port assigned to the Bluetooth serial service:
    1. go to Accessories -> Communications -> HyperTerminal
    2. give a name and choose an icon, press ok, then choose in the "connect" field the COM port of your "incoming port", press ok  
    3. make the HyperTerminal active by clicking the "call" button.
  2. Select the Python icon and click on it from the phone
  3. Start the Bluetooth Console on the phone: Options->Bluetooth console (see Figure 3)
  4. After the device discovery, connect to the PC
  5. On both the phone’s an HyperTerminal’s screen a message will appear (see Figure 4)
  6. Type on the HyperTerminal the following code as shown in Figure 5:
    import appuifw 
    appuifw.note(u”Hello World!”,’info’)
  7. On the phone’s screen will pop up the Hello World message as shown in the Figure 6.

Note: Click on the Figures to enlarge them!!!

Figure 3 :Running Bluetooth console
Figure 4: Connection between the PC and the phone
Figure 5: Typing code on the HyperTerminal
Figure 6: Hello World pop-up on the phone

It is possible to use the Bluetooth console to retrieve information from the phone. It follows an example that shows how to get the information about the GSM location of the phone:

  1. Follow the steps from 1 to 5 of the previous example
  2. Type on the HyperTerminal the following code as shown in Figure 7:
    import location  
    location.gsm_location()

     3.   On the screen of the HyperTerminal the Mobile Country Code, Mobile      Network Code, Location Area Code and Cell ID appear.

 

 


Figure7: Location information

Department of Electronic Systems | Aalborg University | Niels Jernes Vej 12 | DK-9220 Aalborg | Denmark
Phone: (+45) 9635 8695 | Fax (+45) 9815 1583 | E-mail ies(at)ies.aau.dk
Copyright © 2006 Department of Electronic Systems

Last update:09-10-2006