How to connect android device via bluetooth with matlab 'Instrument Control'-Toolbox? -


i want connect android device on bluetooth matlab exchanging data between matlab , own android app. can't connect via 'instrument control'-toolbox android devices. why?


scan , connect android device first scaned available devices , tried connect (with "connect"-button) android.


i searched , says:

so read technical spez. devices , can't find support needed spp bluetooth profile.

  • samsung galaxy young 2 (sm-g 130hn):
    bluetooth®-profile: hsp, opp, sap, a2dp, pbap, hfp, avrcp, di, hid, hogp, pan, map
    tech spez. galaxy young
  • samsung galaxy s advance:
    bluetooth profiles: gap, ssp, sdap, hsp, hfp, a2dp, sap, opp, pbat, map, avrcp, hid
    tech spez. galaxy s
  • htc 1 m7:
    common profiles: hsp [headset], hfp [hands-free], a2dp [stereo audio], avrcp [media control], hid [peripherals]
    tech spez. htc 1 m7

but in android documentation says:

  • the common type of bluetooth socket rfcomm, type supported android apis. rfcomm connection-oriented, streaming transport on bluetooth. known serial port profile (spp).
    support spp profile in android

so think android support spp, not used devices?
there no way connect 1 of these phones via bluetooth matlab?
android devices working?

solution

here 'activate bluetooth spp in android' says:

  • on android phone need run application initiates service on spp.

you need listen incoming connection requests, therefor should use function:

listenusingrfcommwithservicerecord(string, uuid) 

here can find examples:


code example

final thread connect = new thread(new runnable() {             @override             public void run() {                 bluetoothserversocket serversocket;                  bluetoothadapter bluetoothadapter = bluetoothadapter.getdefaultadapter();                 uuid sppuuid = uuid.fromstring("00001101-0000-1000-8000-00805f9b34fb");                          bluetoothsocket bluetoothsocket = null;                          try {                             serversocket = bluetoothadapter.listenusingrfcommwithservicerecord("your app name", sppuuid);                            bluetoothsocket = serversocket.accept(); // blocking call, until connection established.                            log.i("tag", "serversocket accept");                          } catch (ioexception e) {                             log.e("tag", "ioexception");                         }                          // if connection accepted                         if (bluetoothsocket != null) {                             // work manage connection (in separate thread)                             manageconnectedsocket(bluetoothsocket);                         }              }         }); connect.start(); 

my fault think can connect matlab , android without own app, android 'bluetooth' connection part in settings.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -