Quantcast
Channel: 32feet.NET
Viewing all 469 articles
Browse latest View live

New Post: After Windows 8.1 upgrade, Msft.WindowsBluetoothListener.Start() fails at serverSocket.Bind(serverEP)

$
0
0
I am running 105180 that I've rebuilt to use .NET 4 Client Profile. This works fine on Windows 8.0 and 7.0.

Does anyone have a clue why WindowsBluetoothListener.Start() fails on Windows 8.1?

Below are a stack trace and the value of serverEP variable.

Thanks in advance for your guidance.
Gyle

This is the stack trace:

System.Net.Sockets.SocketException was unhandled
HResult=-2147467259
Message=An invalid argument was supplied
Source=System
ErrorCode=10022
NativeErrorCode=10022
StackTrace:
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at InTheHand.Net.Bluetooth.Msft.WindowsBluetoothListener.Start(Int32 backlog)
   at InTheHand.Net.Bluetooth.Msft.WindowsBluetoothListener.Start()
   at InTheHand.Net.Sockets.BluetoothListener.Start()
   at MagicKeyService.Connector.Bluetooth.BluetoothAcceptThread.Run()
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
InnerException:

This is the value of the serverEP:
  • serverEP {000000000000:2cb7d2f7582311e19ef31cc1deb5b4db} InTheHand.Net.BluetoothEndPoint
  • base {000000000000:2cb7d2f7582311e19ef31cc1deb5b4db} System.Net.EndPoint {InTheHand.Net.BluetoothEndPoint}
  • Address {000000000000} InTheHand.Net.BluetoothAddress
    AddressFamily   0x00000020  System.Net.Sockets.AddressFamily
    HasPort false   bool
  • m_id {000000000000} InTheHand.Net.BluetoothAddress
    m_port  0xffffffff  int
  • m_service {2cb7d2f7-5823-11e1-9ef3-1cc1deb5b4db} System.Guid
    Port    0xffffffff  int
  • Service {2cb7d2f7-5823-11e1-9ef3-1cc1deb5b4db} System.Guid
  • Static members
    _addrFamily 0x00000020  System.Net.Sockets.AddressFamily
    _isBlueZ    false   bool
    defaultPort 0xffffffff  int
    MaxPort 0x0000ffff  int
    MaxScn  0x0000001e  int
    MinPort 0x00000001  int
    MinScn  0x00000001  int

New Post: After Windows 8.1 upgrade, Msft.WindowsBluetoothListener.Start() fails at serverSocket.Bind(serverEP)

$
0
0
Wierd. We're just passing through the error reported by Winsock there.

Do other Bluetooth operations work? Connect, Device Discovery etc?

Is it a built-in Bluetooth radio? Can you try a different radio (i.e. USB attached)?

Created Unassigned: 3.7 Binaries [35031]

$
0
0
Unable to list properties or methods for the DLL in the NET folder. The DLL in the NETCF folder works.

New Post: Piconet using 32Feet

$
0
0
Hi all.

Been in development for 20 years but very, very new to the world of bluetooth so please forgive me if this is a stupid question...

Can I use 32feet to connect to more than one device at a time. Boss has asked to look at piconets & scatternets. All devices will be windows mobile.

Any pointers/constructive comments welcome.

Thanks

New Post: How to simulate break up connection

$
0
0
Hi. I' m writing testing software and I need to implement something that simulate break up connection (remove dongle? :P). How to do that?

New Post: How to simulate break up connection

New Post: How to simulate break up connection

$
0
0
I walk out of my office, down the hallway until the device is out of range. :-) A few brick walls soon break the connection.

New Post: How to simulate break up connection

$
0
0
Can I do sth like this using only software? Break suddenly connection? Maybe for example disable dongle programmatically?

New Post: CSR Harmony stack

$
0
0
Any info on the CSR Harmony stack, is there experimental support or another SDK?

I accidentally bought a Sitecom CN-524 which uses the CSR stack which is a bummer, I can't find anything on the web.

There is a wiki which suggests there is an SDK, just not publicly available.
https://wiki.csr.com/wiki/Main_Page#Microsoft_Windows

New Post: CSR Harmony stack

New Post: CSR Harmony stack

$
0
0
I tried that, but unfortunately it doesn't seem to work. When the CSR drivers are not installed it does ring the new hardware sound, but it just doesn't show up in the device manager. 'Add a device' also doesn't show any bluetooth devices.

It is a Sitecom CN-524 (BT 4.0). I guess I'll just sell it and get another one. Can you suggest a specific BT 4.0 dongle that will work?

New Post: CSR Harmony stack

New Post: CSR Harmony stack

$
0
0
Out of interest find how the dongle appears in Device Manager. On its properties dialog what is its Compatible Ids
(e.g. USB\Class_E0&SubClass_01&Prot_01
USB\Class_E0&SubClass_01
USB\Class_E0 )
and Hardware Ids
(e.g. USB\VID_0A12&PID_0001&REV_7558
USB\VID_0A12&PID_0001 )

New Post: CSR Harmony stack

$
0
0
USB\DevClass_00&SubClass_00&Prot_00
USB\DevClass_00&SubClass_00
USB\DevClass_00
USB\COMPOSITE

and

USB\VID_0A12&PID_100B&REV_8891
USB\VID_0A12&PID_100B

This is with its driver deinstalled which causes it to be listed as USB Composite Device

Created Unassigned: Cannot disconnect from the device [35088]

$
0
0
Hi there,

I have this problem which kept me going almost for a week now.
We have a product in our company which has a bluetooth module used in it then we can communicate with it. for the main software our developers used stacks and implemented a protocol to talk to the device.
However what I am trying to do is fairly simple.
I am trying implement some sort of tester for the tester firmware written for the device on the pc side which is trying to
1. Discover our devices. (say, they get tested in 30s and more numbers) (easy step)
2. Connect to each one. send a bit or two and receive confirmation from the device. Raw data will suit us as this is a very simple step and I can chose what to receive in the hardware side. (haven't done this yet)
3. Disconnect from the module and try the other. and the other.

However I can't simply disconnect from the device. I have BlueSoley installed on my computer and while I am monitoring the connection when I it from my software, it shows that it's connected but it seems there is a problem to that connection and I can't even disconnect the device using Bluesoley software.

I chose to do the most simple thing in my code which is:

```
public async Task ConnectAsync(BluetoothClient Client, BluetoothEndPoint endPoint)
{
//attemp to connect to the Bluetooth client
await Task.Run(() =>
{
try
{
Client.Connect(endPoint);//,progressIndicator
}
catch (Exception)
{
StatusManager("Connect Attemp failed to " + endPoint.Address.ToString());

}
});

}
```
for connecting. and for the disconnecting part:
```
public async Task TestDevices()
{
var cli = new BluetoothClient();
_discoverdDevicesList.Clear();
var _onlyCsaDevice = await DiscoverCsaDevicesAsync(cli);
StatusManager("Discovery Successfull");
foreach (var device in _onlyCsaDevice)
{
_discoverdDevicesList.Add(device);
var addr = BluetoothAddress.Parse(device.DeviceAddress.ToString());
var serviceClass = BluetoothService.SerialPort;
var ep = new BluetoothEndPoint(addr, serviceClass);
try
{
if (!device.Connected)
{
StatusManager("Connection attemp to " + addr.ToString());
await ConnectAsync(cli, ep);
//device.SetServiceState(BluetoothService.SerialPort, true, true);
}
else
{
StatusManager("Disconnection attemp to " + addr.ToString());
await CloseAsync(cli);
if (device.Connected)
{
StatusManager("~Disconnect unsuccessful");
}
else
{
StatusManager("~Disconnect successful");
}
}
}
catch (Exception ex)
{
StatusManager("*Connect attempt exception happened with the message" + ex.ToString());

//throw;
}
}
```
In this chunk of code I use "CloseAsync( )" method which it's body says:

```
public async Task CloseAsync(BluetoothClient Client)
{
await Task.Run(() =>
{
try
{
Client.Close();
Client.Dispose();
//Client.Client.Disconnect(true);
//Client.Client.Dispose();
//Client.Client.Close();

}
catch (Exception ex)
{
StatusManager("Disconnect Attempt failed with the message " + ex.ToString());
}
});
}
```
I used anything that I could to disconnect from my module then I can go to next device and the next. But it seems impossible to disconnect.

Since I am pretty new to bluetooth coding, i am not sure if I need to implement a serial port or a stack or something to do this. When on bluesoley software I attempt to connect to our device it mentions it as "Connect to Bluetooth serial port (22)" which kinda tells me it uses a virtual serial port to make the connection. and I might need to do the same.

Would appreciate your guides and feedback on this.

I can upload the errors I receive trying to Disconnect the device in my try/catch if necessary.

New Post: The thread xyz has exited with code 259 (0x103)

$
0
0
Hi,

I have problems with bluetooth connection. It is endless connection and after several seconds it is always hangs up on ReadAsync with information:

The thread 0x19c has exited with code 259 (0x103).
The program '[5612] TaskHost.exe' has exited with code 0 (0x0).

After this - connection is still valid with device (I see connection diode on device), but there is no chance to:
1) Connect again to device (connection is still present)
2) Receive any data from socket/connection

It is allways hanging here:
returnedBuffer =
                    await
                        socket.InputStream.ReadAsync(buffer.AsBuffer(), (uint)buffer.Length,
                            InputStreamOptions.Partial);
Code is from your sample:

private async void ReadThread(object host)
    {
        reading = true;

        var socket = new StreamSocket();
        socket.Control.KeepAlive = true;
        socket.Control.NoDelay = false;
        //socket.Control.QualityOfService = SocketQualityOfService.LowLatency;

        IAsyncAction a = StreamSocketExtensions.ConnectAsync(socket, (HostName)host, RfcommServiceId.SerialPort);
        await a;

        var buffer = new byte[2048];

        while (reading)
        {
            IBuffer returnedBuffer = null;
            try
            {
                returnedBuffer =
                    await
                        socket.InputStream.ReadAsync(buffer.AsBuffer(), (uint)buffer.Length,
                            InputStreamOptions.Partial);
                if (returnedBuffer != null)
                {

                    string s = PrintByteArray(returnedBuffer.ToArray(), (int)returnedBuffer.Length);

                    if (!string.IsNullOrEmpty(s))
                    {


                        Dispatcher.BeginInvoke(new Action<string>(InsertMessage), s);


                    }
                }
            }
            catch
            {

            }

        }

        socket.Dispose();
    }
Regards
Mateusz

New Post: CSR Harmony stack

New Comment on "BluetoothWin32Authentication"

$
0
0
Installing BlueSoleil (10.0.47 in specific) on Windows 7 causes the program to throw and exception when it hits the following line. BluetoothWin32Authentication _win32Auth = new BluetoothWin32Authentication(HandleWin32Auth); the exception is: (0x80004005) “The operation completed successfully” Since I am using this line only because BlueSoleil doesn't respond to PairRequest( ) with a pin integrated in the second parameter, this is a big issue for me atm. I would really appreciate it if somebody could give me a hint on this. Mehrad

Created Unassigned: BluetoothListener problem with unknown GUID [35112]

$
0
0
Hi,

I'm hoping someone out there can help me.
I have a windows mobile 6 application that connects to a device via Bluetooth.
Everything is working fine. I can send commands to it and receive data.
That said I am using a service Guid for the BluetoothListener of:
BluetoothService.RFCommProtocol mainly because it works. The problem is the Bluetooth device I'm working with is a sealed unit with no programmable interface and thus I can't set the Guid on it.
I know this is a constant that Alan says will result is a random channel number, but it works.
I tried using a created Guid and the device received and sent nothing.

My problem is that the device comes with a key-fob which can be used to send a command to it.
I'm then expected on the mobile to receive that data it then sends.
The previous version of the application uses CFSerial.dll and thus used a Comm Port for its Bluetooth connection and this was able receive the data triggered by the key-fob. I suspect this has something to do with the Comm Port method being bound to a specific channel or service of some kind, but I'm guessing wildly.
On the application the user is given the choice whether to use the mobile or the keyfob to trigger the data. If they choose the mobile I'm fine, I have it working, but if they choose the keyfob I create a bluetoothlistener (using the Guid above) but it never gets any data.

Does anyone know if I can use Bluetooth SDP to get the channel number and then do something with that to listen for data?

Any help or pointers in the right direction would be very very helpful.

Commented Unassigned: BluetoothListener problem with unknown GUID [35112]

$
0
0
Hi,

I'm hoping someone out there can help me.
I have a windows mobile 6 application that connects to a device via Bluetooth.
Everything is working fine. I can send commands to it and receive data.
That said I am using a service Guid for the BluetoothListener of:
BluetoothService.RFCommProtocol mainly because it works. The problem is the Bluetooth device I'm working with is a sealed unit with no programmable interface and thus I can't set the Guid on it.
I know this is a constant that Alan says will result is a random channel number, but it works.
I tried using a created Guid and the device received and sent nothing.

My problem is that the device comes with a key-fob which can be used to send a command to it.
I'm then expected on the mobile to receive that data it then sends.
The previous version of the application uses CFSerial.dll and thus used a Comm Port for its Bluetooth connection and this was able receive the data triggered by the key-fob. I suspect this has something to do with the Comm Port method being bound to a specific channel or service of some kind, but I'm guessing wildly.
On the application the user is given the choice whether to use the mobile or the keyfob to trigger the data. If they choose the mobile I'm fine, I have it working, but if they choose the keyfob I create a bluetoothlistener (using the Guid above) but it never gets any data.

Does anyone know if I can use Bluetooth SDP to get the channel number and then do something with that to listen for data?

Any help or pointers in the right direction would be very very helpful.
Comments: ** Comment from web user: kgoodman **

Continuing the problem above I've implemented a class method that opens a connection to my device, where it then goes into a loop waiting for data from it (ReadMessagesToEnd).
This is the function:

```
public bool fobConnect()
{
connNo++;
misc.debuggery("ConnNo:" + connNo.ToString());
bool rtn = false;
rep = null;
//cli.close();
Byte port = Convert.ToByte(_port);
rep = new BluetoothEndPoint(_addr, BluetoothService.Empty, port);
try
{
cli = new BluetoothClient();
misc.debuggery("connect attempt");
try
{
cli.Connect(rep);
}
catch (Exception e)
{
misc.debuggery("connect exception:" + e.Message);
}
misc.debuggery("sckt type:" + cli.Client.SocketType.ToString());
var peer = cli.GetStream();
ReadMessagesToEnd(peer);
rtn = true;
}
catch (Exception e)
{
misc.debuggery("msg="+e.Message);
rtn = false;
}
return rtn;
}
```

I connect with it first time ok and it gets data.
Then second time I call the above function it gets caught in the first "catch" and gives me:
"connection exception: A connect request was made on an already connected socket"
Also in the same call to this function the second "catch" also tells me:
"msg=The operation is not allowed on non-connected sockets" !!!???!!

How is this possible?
How can it be both already connected but still not allow the operation because it is "non-connected"
"cli" is a class variable and I've tried commenting out the "cli.close()" line to make sure it is closed before I re-connect but it still doesn't work.

Anybody out there with any ideas?

Viewing all 469 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>