Advertise using Bluetooth - Rudi Grobler
Tuesday, October 02, 2007 4:44 PM rudi

Advertise using Bluetooth

How do you choose which restaurant do you want to eat at in a mall with 100+ restaurants?

Competition in the food industry is very competitive and these businesses are looking at different methods of getting the edge! Some companies have started using Bluetooth as an advertisement medium. The concept is very simple; you walk past a restaurant and your phones Bluetooth is turned on. The restaurant has a system which can detect Bluetooth devices in close proximity and then transmit an advertisement to this device. Now you can get notified of specials that this restaurant is having for the day!

Using InTheHand, this might not be such a difficult system to implement!

Include the correct namespaces

using InTheHand.Net;
using InTheHand.Net.Bluetooth;
using InTheHand.Windows.Forms;

Detect the primary Bluetooth radio

BluetoothRadio br = BluetoothRadio.PrimaryRadio;
br.Mode = RadioMode.Discoverable;

Find a device close by

SelectBluetoothDeviceDialog sbdd = new SelectBluetoothDeviceDialog();
sbdd.ShowAuthenticated = true;
sbdd.ShowRemembered = true;
sbdd.ShowUnknown = true;
if (sbdd.ShowDialog() == DialogResult.OK)
{
   // MORE CODE NEEDED HERE
}

This function creates a dialog box from which you can select the desired Bluetooth device to send the specials too. A fully automated system would need to bypass this step and automatically detect new devices.

Finally we need to send the specials.jpg using OBEX File Push

System.Uri uri = new Uri("obex://" + sbdd.SelectedDevice.DeviceAddress.ToString() + "/" + System.IO.Path.GetFileName(@"C:\specials.jpg"));
ObexWebRequest request = new ObexWebRequest(uri);
request.ReadFile(@"C:\specials.jpg");

ObexWebResponse response = (ObexWebResponse)request.GetResponse();
response.Close();

This code is very basic and still needs some adjustments...

Also have a look at my previous article on using Bluetooth OBEX Listener

kick it on DotNetKicks.com Filed under:

Comments

# Advertise using Bluetooth

Tuesday, October 02, 2007 5:00 PM by DotNetKicks.com

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# re: Advertise using Bluetooth

Tuesday, October 02, 2007 5:45 PM by Andy Brudtkuhl

This sounds very cool. I would very much like to see more, especially the auto discovery.

# re: Advertise using Bluetooth

Tuesday, October 02, 2007 8:05 PM by rudi

Tnx, I will do a post on the auto discovery...

# re: Advertise using Bluetooth

Tuesday, October 02, 2007 10:27 PM by codingsanity

I may just be an old curmudgeon, but if my phone starts going haywire because it's been BLuetoothed by a restaurant, I'd NEVER EVER eat there.

Spam by another name...

# re: Advertise using Bluetooth

Wednesday, October 03, 2007 6:38 AM by rudi

true, but in menly there are huge boards that warn you to turn off you bluetooth if you don't want the adverts?

# re: Advertise using Bluetooth

Wednesday, October 03, 2007 6:40 AM by rudi

And remeber, the advert can also be a text messsage or a animated gif

# re: Advertise using Bluetooth

Wednesday, October 03, 2007 8:50 AM by rudi

The following code can be used to enumerate the available bluetooth devices

BluetoothClient bc = new InTheHand.Net.Sockets.BluetoothClient();

BluetoothDeviceInfo[] array = bc.DiscoverDevices();

foreach (BluetoothDeviceInfo bti in array)

{

   //bti.DeviceAddress

}

# re: Advertise using Bluetooth

Thursday, October 04, 2007 10:19 AM by Zlatan

Nice one Rudi, please keep this up, I would like to explore using it in respective OBA RAP/SharePoint solution offerings and also include it in one of my future community presentations.

# re: Advertise using Bluetooth

Thursday, October 04, 2007 10:27 AM by rudi

Thank you for the nice comments...

If I look at my blogs stats I can see that bluetooth is a very popular topic...

I am going to convert the 2 combined articles into 1 comprehensive codeproject article...

Will post the link!

Would be very interesting to see it being used in a OBA RAP/Sharepoint solution!!!