create an Bluetooth Device to trigger smartphone SMS button

Topics: Bluetooth - Other
Feb 7, 2012 at 2:24 AM

Hi, 

I am very new to Bluetooth, and i wish to learn more about it. Currently i had a project that need to trigger smartphone SMS button, by using Bluetooth technology. My smartphone OS is using WINDOW MOBILE 6 PROFESSIONAL , VB.net.

my project scenario:
1. user required to pair the Smartphone (window mobile 6 professional) and Car Bluetooth Device.

( This car Bluetooth Device is just operate like Bluetooth headset, once people click the bluetooth device, it will auto trigger samrtphone button. For Bluetooth Headset, the function is trigger the Smartphone ON/OFF CALL button, but for my project, i need to trigger "SMS button" that i already program in my design apps)

 

2. Once the accident happened, the sensor in the car will trigger the car Bluetooth Device.

 

What i did:
1. I searched for "how operation of Bluetooth headset works", "How Bluetooth headset trigger the phone button", "how Bluetooth technology trigger a button", and etc.. but due to commercial issue i think, i searched nothing for this.

2. So i try to change my project concept, once the smartphone receive a file, it will trigger the SMS button, but after think of it, its is very impractical.

3. Finally i saw 32feet.Net, and i hope 32feet.Net can support my design apps.


My Question:

1. 32feet.Net can create the function i want like above?

2. 32feet.Net can support in window mobile 6 professional, by using VB.NET?

3. Should i program the Car Bluetooth Device too, and how to program it?

4. Can provide me some related article about this? 

Kindly advice my above question, and provide me some direction to continue, i just worried i am lost. I will work hard for it.

Thanks a lot. 

Coordinator
Feb 9, 2012 at 9:27 AM

A Bluetooth Headset / CarKit device doesn't have the capability of doing this itself. However you could create a custom device fitted to the car which uses a custom protocol of your own creation. You would then need to create an application for the Smartphone which can search for and connect to this device using your custom service and on receipt of a specific formatted message could then perform some action on the phone. You have complete control over the protocol - look at the BluetoothChat sample for a simple example.

There are APIs for Smartphone which allow you to create and send an SMS message programmatically. 32feet.NET will provide an API you can use on the Smartphone side to handle the Bluetooth comms. For the car you would probably implement a custom low power device but you could simulate this with another Smartphone/PDA or a spare PC.

Regards,

Peter

Feb 10, 2012 at 2:58 PM

Hi peterfoot, thanks for your reply and idea provide.


I think the BluetoothChat sample can help me a lot, and I wish to apply this to my project, but unluckily  the sample provide come with this error.

The source control provider associated with this solution could not be found. The projects will be treated as not under source control. Do you want permanently remove the source control binding from the projects?  (YES? NO? CANCEL)

The installer version for 32feet.Net that I downloaded is 32feet.NET 3.3 and the source code I download is from 32feet-95673 zip file.

Kindly advice how to solve this error. Thanks a lot 

Developer
Feb 11, 2012 at 1:07 PM

Just click: Yes

Feb 12, 2012 at 1:31 AM

hi alanjmcf, after i click yes and then i run the code, i get this error:
Platform Not Supported Exception was unhandled  (no supported Bluetooth protocol stack found)
at line Dim btClient As New BluetoothClient.

the sample i used is : InTheHand.Net.Personal->Samples->BluetoothChat->Pocket PC, i am using window 7 32 bits, accer. 

i need any Bluetooth hardware to support this? or i need to buy any Bluetooth dongle? or need any Bluetooth client installation?  
The sample sample is in pocket pc, i wish to change the platform to window mobile 6 professional, there is a problem? 


last time i used this reference for my emulator http://www.codeproject.com/Articles/35183/Bluetooth-for-Microsoft-Device-Emulator. it is work, but after i knowing 32feet.net, i realize yours sample is more compatible with my project, so i wish to learn from you all.   

kindly advice, i am really need this sample. Thanks a lot.

Developer
Feb 13, 2012 at 6:38 PM

So if you've no Bluetooth hardware in -- or attached -- to your PC then you can't run a Bluetooth program there.  You need to use the SdpBrowserDevice sample for instance and compile it on your PC and then run it on your smartphone.  You can either connect your smartphone with ActiveSync and do Debug from within VS, or copy it to the smartphone somehow and run it directly there...

Feb 24, 2012 at 1:08 AM
Edited Feb 24, 2012 at 1:23 AM

hi alanjmcf and peterfoot:

thanks provide me those useful information. i can run the sample (BluetoothChat) without any error. But after i add the sample (BluetoothChat) in my current project, it show me below error: 

"Threating" is ambiguous, imported from other namespaces or types 'GeoFramework,System'.


The error is at this line



Private Sub Form1_Load(ByVal sender As System.Object, _ ByVal e As System.EventArgs) _Handles MyBase.Load 

  Dim t1 As System.Threading.Thread        

  t1 = New Threading.Thread(AddressOf receiveLoop)       

  t1.Start()

 btClient = New BluetoothClient

        Dim bdi As BluetoothDeviceInfo() = btClient.DiscoverDevices()
        cboDevices.DataSource = bdi       

cboDevices.DisplayMember = "DeviceName"

    End Sub


and then i try to search the solution for this at http://msdn.microsoft.com/en-us/library/aa479312.aspx , it provide me below solution:

 


 

 

Issue 22: Ambiguous references and naming conflicts

The .NET Framework 2.0 adds a host of new namespaces and classes. Several of these are likely to cause clashes with ASP.NET 1.x applications. For example, the new personalization features introduce classes with the names of Profile, Membership, and MembershipUser. The Profile name, in particular, is fairly commonly used by developers who want to keep track of user information. Therefore if you have a Profile class in your application, and you try to use any of the new personalization features, you may encounter compiler warnings about ambiguous class references.

How to fix

Planning ahead for naming conflicts can be rather difficult. You will want to take a quick look through the new ASP.NET classes. If you see any names that might conflict with what you have in your application, you might consider using explicit naming. For example, use System.Web.Security.Membership instead of importing/using System.Web.Security and then using the Membership class.

 


so, i try to search for the classes that your company provide, but i search no way. Kindly advice, how can i solve for the error
 "Threating" is ambiguous, imported from other namespaces or types 'GeoFramework,System'.

thanks a lot. your helps will be very appreciated. 
this project is very important to me. please advice. 

Developer
Feb 26, 2012 at 4:25 PM

Can you use the Chat2 sample instead of the old BluetoothChat samples.  (To the fix the problem in the old sample just change that line to: "t1 = New System.Threading.Thread").


Feb 27, 2012 at 11:32 AM
Edited Feb 27, 2012 at 11:33 AM

hi, it is work.. thanks a lot.

i just want to edit add with a function, that is when when txtMessagesArchive.text = "1" then messagebox will appear:

Private Sub txtMessagesArchive_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtMessagesArchive.TextChanged
        If txtMessagesArchive.Text = "1" Then

            SessageBox.Show("ok")
        End If

but when i received "1" in the "txtMessagesArchive.Text", it did not show me "ok".

for the same i create a simple application with the same concept, textbox1 as the component:

 

 

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If TextBox1.Text = "1" Then
            MessageBox.Show ("ok")
        End If
    End Sub

this simple application is work.

kindly advice what is my codding mistake? 

thanks

Developer
Feb 27, 2012 at 3:19 PM

You are running this in Visual Studio.  If so before you enter the 1 in the text box, open that file, click on the line with the "If" and hit F9 to add a Breakpoint. Then type the text, the prograsm should stop at that line.  Then hover the mouse over the txtMessagesArchive.Text and it hsould display the value (or look in the "Locals Window" expand Me->txtMessagesArchive->Text (to find the window do Debug->Windows->Locals").

Hope that will help you find what is happening.

Mar 12, 2012 at 2:38 AM

hi alanjmcf & peterfoot

thanks, my Bluetooth chat application is work now. thanks for all the information.

may i ask, where i can download a serial port communication for window mobile compact framework? 32.feet got provide this sample? now my FYP supervisor which me change to project concept to read a data by using Bluetooth, by serial port concept. 

i try to search the sample and tutorial in internet, but it not have any sample that can apply in window mobile compact framework, mostly of them only for desktop using. i hope to make my gui like this http://tiktakx.wordpress.com/2010/11/21/serial-port-interfacing-with-vb-net-2010/ , but unfortunaly the platform not suport for window CE. 

kindly advice
thanks in advance.  

Developer
Mar 18, 2012 at 5:16 PM

I am not a fan of Serial Ports, they make things so much less understandable and robust.  I recommend for Bluetooth programming that one uses a network api, e.g. Sockets in Windows (desktop/CE), and the respective APIs on the other platforms.  Serial Ports are not used on the platforms created more recently including Android and iOS.

The problems: How does know what COM port is for connecting to which remote device? If one is connecting to multiple remote devices then there needs to be at least one COM port for each remote device? If the connection is lost to the remote device then there's no indication that has occured, the program will keep sending data and that will just be discarded. When one sends data over the COM port is that reliable, or will it discard data e.g. at connection loss

If you create a Bluetooth virtual COM port manually then you can try using it in your program by using the .NET SerialPort class.  To create a COM port in 32feet.NET see http://32feet.codeplex.com/wikipage?title=Bluetooth%20Serial%20Ports&referringTitle=Documentation