bluetooth - Unable to establish connection using Windows 7 and C# -


intro

i getting follow error: system.argumentexception unhandled

hresult=-2147024809

message=the iasyncresult object not returned corresponding asynchronous method on class.

parameter name: asyncresult

source=system

paramname=asyncresult

stacktrace:

at system.net.sockets.socket.endconnect(iasyncresult asyncresult)    @ inthehand.net.bluetooth.msft.socketbluetoothclient.endconnect(iasyncresult asyncresult)    @ inthehand.net.sockets.bluetoothclient.endconnect(iasyncresult asyncresult)    @ myapp_1.frmmt.connectmethod(iasyncresult balanceasyncresult) in c:\xxx\source\workspaces\mt\mt_1\mtx_1\mty_1\form1.cs:line 194    @ system.net.lazyasyncresult.complete(intptr usertoken)    @ system.net.contextawareresult.completecallback(object state)    @ system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)    @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx)    @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state)    @ system.net.contextawareresult.complete(intptr usertoken)    @ system.net.lazyasyncresult.protectedinvokecallback(object result, intptr usertoken)    @ system.net.sockets.socket.connectcallback()    @ system.net.sockets.socket.registeredwaitcallback(object state, boolean timedout)    @ system.threading._threadpoolwaitortimercallback.performwaitortimercallback(object state, boolean timedout) 

connection:

 bluetoothclient myclient = new bluetoothclient();  char[] pinchar = new char[] { 'm', 'y', 'p', 'i', 'n' }; string pinstring = new string(pinchar); comments.appendtext("device address: " + device.deviceaddress + newline); ispaired = bluetoothsecurity.pairrequest(device.deviceaddress, pinstring); comments.appendtext("ispaired?: " + ispaired.tostring() + newline);  // true! comments.appendtext("isauthenticated?: " + device.authenticated + newline);  // true! if (ispaired) {      if (device.authenticated)      {         //asyncconnection method         btclient.beginconnect(device.deviceaddress, bluetoothservice.serialport, new asynccallback(connectmethod), device);         comments.appendtext("balance connected? : " + btclient.connected + newline); // false!      } }             else             {                 // pairing failed                 comments.appendtext("balance pairing failed :( (" + pinstring + ")" + newline);  // never here!             } 

*** fyi - have tried connecting via endpoint using mac address , guid.

asynch method:

private void connectmethod(iasyncresult myasyncresult) {     messagebox.show(myasyncresult.tostring());  // show off method      if (myasyncresult.iscompleted)  // true!     {         //  error thrown         myclient.endconnect(balanceasyncresult);  // error here on line 194         // stream mystream = myclient.getstream();  // fails same error         messagebox.show("connected? : " + myclient.connected);  // never here or if myclient.connected false!      } } 

possible related info:

manufacturer says:

bluetooth version: 1.2

protocols: l2cap, sdp, rfcomm

bluetooth profile: generic access, service discovery, serial port profile (spp)

role of bt option: client or server peripherals

any appreciated!


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -