473,387 Members | 3,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

C# - Bluetooth

Hey everyone,

Have a tough problem here I'm trying to solve but to no avail. Basically a program I'm doing on a handheld requires a connection to a printer via bluetooth. When everything is set up, it's all fine, everything works. However, when the handheld is switched off and switched back on, it loses the connection to the printer and so the only way to resolve this as I've found is to disable and then re-enable bluetooth. Obviously, customers do not want to be doing this.

I have the printer being recognised by the bluetooth manager and the bluetooth printer option has the printer running on a port.

So my question is, is there anyway to write something into my program to check for this?
Feb 1 '08 #1
4 24869
kenobewan
4,871 Expert 4TB
Something like a try catch block might be easier. HTH.
Feb 1 '08 #2
Hey everyone,

The good news is that I found a solution to this problem.

It requires using the Microsoft Embedded Source Tools found here and the InTheHand.Net library found here.

This prompts the header: 'using Microsoft.WindowsMobile.SharedSource.Bluetooth;' which unfortunately disallows 'using InTheHand.Net.Bluetooth;' but it allows the use of BluetoothRadio without the need for that bthutil.dll if you're using WinCE. The BluetoothRadio is all I needed to get this program working. The Microsoft.WindowsMobile library does not support the Ports and Sockets feature that InTheHand.Net does so I am using a combination of both.
Feb 11 '08 #3
The InTheHand library is actually found here.

The InTheHand.Net.Personal.dll is needed.
Feb 12 '08 #4
Block
1
The InTheHand library is actually found here.

The InTheHand.Net.Personal.dll is needed.

Hi, I had try with the Microsoft mobile library in a Pocket PC with Windows CE 5.0 and I get the same error that you get with the InTheHand Library, here is my code:

using Microsoft.WindowsMobile.SharedSource.Bluetooth;
-----------------------------
private BluetoothRadio PrimaryBTRadio = new BluetoothRadio();

private void button1_Click(object sender, EventArgs e)
{

PrimaryBTRadio.BluetoothRadioMode = BluetoothRadioMode.On;
PrimaryBTRadio.BluetoothRadioMode = BluetoothRadioMode.Discoverable;

}

private void button3_Click(object sender, EventArgs e)
{

switch (PrimaryBTRadio.BluetoothRadioMode)
{

case BluetoothRadioMode.Off:

this.textBox1.Text = "Off";
break;

case BluetoothRadioMode.On:

this.textBox1.Text = "On";
break;

case BluetoothRadioMode.Discoverable:

this.textBox1.Text = "Discoverable";
break;

}

}

private void button2_Click(object sender, EventArgs e)
{

PrimaryBTRadio.BluetoothRadioMode = BluetoothRadioMode.Off;

}

I hope that you can help with this problem: Can't find PInvoke DLL 'bthutil.dll'.
Mar 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Thomas_Germany | last post by:
I would like to develop a smart device bluetooth application for pocket PC 2003. As I know, Pocket PC 2003 includes the microsoft bluetooth stack. My intention is to use the SDK from mircrosoft and...
3
by: Tor Erik Sønvisen | last post by:
Hi I'm making a server-side solution in Python and need to be able to communicate through bluetooth. Is there any bluetooth-packages out there for python? regards tores
0
by: Mulham | last post by:
hi everybody... im a c# developer , but im very new in bluetooth programming ! my questions are : 1. i searched on msnd and found many c# functions for bluetooth, but i dont know wiether these...
1
by: cmartin64x | last post by:
Hi, I am trying to make this simple code work but I have no success doing so: BLUETOOTH_DEVICE_SEARCH_PARAMS btsp = { sizeof(btsp) }; BLUETOOTH_DEVICE_INFO btdi = { sizeof(btdi) }; ...
1
by: henrycortezwu | last post by:
Hi All, I'm trying to connect to a virtual port (COM19, OUTGOING, "Bluetooth Serial Port") using VS2005 System.IO.Ports. When I ran the ff code below here's what happens. 1) VS2005 Compiles w/o...
4
by: Boki | last post by:
Hi All, I am going to use some Bluetotoh API, should I include some special DLL or just call it directly? Best regards, Boki.
2
by: colin | last post by:
Hi, Im having a tiresome amount of trouble with using a bluetooth serial link. The receiving end is a bluetooth-rs232 module conected to my embeded system. The PC has a little usb bluetooth...
6
by: jabslim | last post by:
excuse me, im a newbie programmer and i need a code on how to to be able to send files from a mobile phone to a pc through bluetooth in vb.net can anyone post a code here on how to detect a...
1
by: gringgos | last post by:
hi, friends... Currently i am doing a project based on bluetooth and Visual Basic 6.0. But i am unable to find any solution regarding bluetooth. But my supervisor gave her idea about do a code...
1
by: Z.K. | last post by:
I know this is probably not the correct newsgroup, but I can't find anywhere else that is appropriate to post it in. I need to figure out how to write a bluetooth program to access a bluetooth...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.