473,386 Members | 1,773 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,386 software developers and data experts.

Receiving data using Bluetooth Dongle (BLED 112)

Hello Everyone,

I am doing a project where i need to develop a C# windows application. I need to receive data in my laptop (windows 7) using BLED 112 Dongle from NRF 8001 which is Bluetooth Low Power. Actually NRF 8001 is connected to a sensor and it is streaming the sensor's data. I need to receive those data using Dongle and save those data.

I tried doing this by using the library provided by 32feet.net but using this i could only discover the device but wasn't able to connect my Dongle to NRF 8001. So i couldn't proceed further and i am stuck since couple of weeks already :(

I already tried searching in the internet but didn't find much help however i recently i got a API for my Dongle in this link https://github.com/ahouben/BleDriver.NET
but still as i am new in this programming it didn't help me much. I am not sure how i could use it in a right way.

Any help or supporting example is highly appreciated.

Thanks in advance :)
May 30 '13 #1
4 16801
Oralloy
988 Expert 512MB
milan12,

Welcome to bytes.com!

You gave us a very nice problem statement, but you neglected to post the code that you are having difficulty with.

Also, when you post code, be sure to surround it with CODE tags. Here is the BB CODE reference page.

Regards,
Oralloy
May 31 '13 #2
Hello Oralloy,

My apology for not posting the code, here is the current version of the code i am working on

Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.IO;
  10.  
  11. using InTheHand.Net;
  12. using InTheHand.Net.Bluetooth;
  13. using InTheHand.Net.Sockets;
  14.  
  15. namespace WindowsFormsApplication1
  16. {
  17.     public partial class Form1 : Form
  18.     {     
  19.  
  20.         private BluetoothClient bluetoothClient;        
  21.  
  22.         public Form1()
  23.         {
  24.             InitializeComponent();
  25.         }
  26.  
  27.         private void Search_Click(object sender, EventArgs e)
  28.         {
  29.  
  30.             BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable;
  31.             BluetoothRadio myRadio = BluetoothRadio.PrimaryRadio;
  32.             label1.Text = "  " + myRadio.LocalAddress.ToString();
  33.  
  34.             bluetoothClient = new BluetoothClient();
  35.             Cursor.Current = Cursors.WaitCursor;
  36.  
  37.             BluetoothDeviceInfo[] bluetoothDeviceInfo = { };
  38.             bluetoothDeviceInfo = bluetoothClient.DiscoverDevices(10); //list max 10 devices
  39.  
  40.             comboBox1.DataSource = bluetoothDeviceInfo;
  41.             comboBox1.DisplayMember = "DeviceName";
  42.             comboBox1.ValueMember = "DeviceAddress";
  43.             comboBox1.Focus();
  44.             Cursor.Current = Cursors.Default;
  45.         }
  46.  
  47.         private void Pair_Click(object sender, EventArgs e)
  48.         {
  49.             if (comboBox1.SelectedValue != null)
  50.             {
  51.                 try
  52.                 {
  53.                     BluetoothSecurity.PairRequest((BluetoothAddress)comboBox1.SelectedValue, null); //pair request with no pass key
  54.  
  55.  
  56.                 }
  57.                 catch (Exception ex)
  58.                 {
  59.                     MessageBox.Show(ex.Message);
  60.  
  61.  
  62.                 }
  63.             }
  64.         }
  65.  
  66.  
  67.         private void Exit_Click(object sender, EventArgs e)
  68.         {
  69.             this.Close();
  70.         }
  71.  
  72.  
  73.     }
  74. }
I am working with the library 32feet.net but today i discover that 32feet.net doesn't support BLE (Bluetooth low Energy) devices here but now there is something i really don't understand. As the developer of 32feet.net said that their library doesn't support BLE devices so here is something i would like to know,

1. Why is my code which is using their library being able to discover the NRF 8001 (BLE device) if the library itself doesn't support BLE devices?
2. I am using two Dongles BCM 20702 (its Dual Mode) and BLED 112 (Single mode) both of them supports BLE. So now i want to know is it my code which is searching the surrounding BLE devices or its the dongles characteristics which is allowing it to search BLE devices?

Please do answer me if you know something about it.

I also found the C# API for BLED 112 Dongle here but i have no idea how i could use it for my project. I couldn't find any sample programs using that API :(

I am really stuck and haven't got much help, so i hope you can suggest me something. I really need some help in here.

Thanks in advance
May 31 '13 #3
Oralloy
988 Expert 512MB
Hello Milan12,

Thanks for posting your code up.

First off, I notice that you do not close the BluetoothClient when you exit (close) the dialogue. That might cause problems if you use the dialogue multiple times to search, I'm not sure.

Also, is there a reason for the NULL PIN in the paring request? This may be giving you problems, I'm unsure.

As to why discovery works, but not data transfer - it is quite likely that BLE wants to have backwards compatible discovery, so that multi-capability devices will work properly with old systems. Backwards compatibility and all that.

As for your second question - you have to install a driver for each dongle. That driver presents a well-defined interface to the operating system, which then presents a well defined interface (DLLs) to you. If we didn't have standards for interfaces, I dear say that we would be still writing low-level I/O packages for hard disks.

BY THE WAY, from reading Wikipedia, Windows 7 does not support BLE in the built-in stack, that capability comes in in Windows 8. I did not verify by going to microsoft's web site, though. You may have to install a third party stack in addition to the drivers, whether you want to or not.

I like Alexander Houben's C# package that you found on github. Have you tried compiling it and invoking the basic New/Open/Close sequence, yet, just to see what happens? Since this supports BLE, it may be the way for you to go. You will have to go through carefully to make sure it does what you expect it to, however.

I also liked the example outlined in this question. I don't know if there is anything useful for you there, or not.

Good Luck!

Hopefully some of that helps you get going. I'll keep looking for a bit, while you work on implementing Houben's package from github.

Cheers,
Oralloy
Jun 1 '13 #4
Hello Oralloy,

Thank you for your reply.

Closing the BluetoothClient didn't solved the problem and the reason behind using NULL PIN is that there is not security key required to connect.

As it was mentioned in 32feet.net that their library didn't supported BLE devices. This is true i finally received the BLED 112 Dongle (it's a single mode so it can only connect with BLE devices) and i tried to use the same code to discover the Bluetooth devices but then the code didn't worked at all for this Dongle. Also one surprising thing i saw is that when i installed the driver for BLED 112 then i saw this


why doesn't the BLED 112 Dongle act as a normal Bluetooth device? after all it's also a Bluetooth device?

I also tried using the API from Alexander Houben's but i couldn't succeed but then i found one example here i complied it in C# it run's like a charm. I checked the code but couldn't understand much from it.

By the help of this code i was also able to receive some data's in my Laptop but i am not sure if it is a good data as my transmitter (NRF8001) is only transmitting 20 byte's of data at a time and I am receiving 25 byte's in my laptop :( How is this possible?

Also Windows 7 doesn't support BLE in the biult in stack does this mean that i will need windows 8 to do the project?

Looking forward to hear from you.

Thanks in advance.
Jun 3 '13 #5

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

Similar topics

10
by: Jim H | last post by:
I have a UDP socket that sends out a request on a multicast socket and waits for a response. This client is not listening on a multicast IP but the local IP. The server (UNIX) responds to the...
1
by: hamid_2020 | last post by:
I wrote a class to connect to a server using tcpclient. I need to connect to the server and the connection must be open.Then i need to send request to the server again and again.But the problem is...
2
by: pauland80 | last post by:
Hello, My soft passively listen to a device sending +- 300 bytes of data each second. After several hours of work, the soft abruptly stops receiving data without any error, (while the device...
5
by: jaco.versfeld | last post by:
Hi There, I have a basic TCP client and TCP server in C++. The TCP client connects to the server, and after a setup phase starts to transmit a file to the TCP server using multiple packets...
0
by: george585 | last post by:
Hello! I am new to network programming, and understand just basics. Using some sample code, and having read documentation, I managed to create a simple app in C# and VB.NET. The application is...
10
by: John Salerno | last post by:
I wrote some pretty basic socket programming again, but I'm still confused about what's happening with the buffer_size variable. Here are the server and client programs: -------------- from...
1
by: PreethiParkavi | last post by:
Hi All, I am .Net Guy and interested in Mobile application Development. I Want to send SMS to mobile thorough my PC using Bluetooth technology.But,I don't know where to start from.How to achieve...
1
by: lakshmiRam | last post by:
hi i have a bluetooth dongle and a program to serach all the devices using bluetooth, but the problem is findFirstDevice() function always returns null so it fails in searching but, i know that...
1
by: hemanth727 | last post by:
Hi all, In grave trouble. I have to develop an console app which takes the data from the bluetooth dongle and stores it in a text.. now prob is .. i donno how to receive data from bluetooth ( USB...
1
Airslash
by: Airslash | last post by:
Hello, The problem is that my server is not receiving data. The code below are the various classes I designed around sockets. It will be big... I have run the code with the debugger, and I see...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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.