MobileChromeApps / cordova-plugin-chrome-apps-bluetoothSocket

BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Response sends through chunked data #3

Open chrismunn192 opened 8 years ago

chrismunn192 commented 8 years ago

Hi,

I am using this library to connect to an OBD device on a car. I have managed to get this working in the ionic framework, I can send requests and retrieve responses however when I send data I then get the data back chunked (or split into separate responses). For example if i send the command...

010C1\r to the device i get a response that looks like...

ME: 010C1\r OBDII: 0C OBDII: 003 OBDII: 2

The expected output should be...

ME: 010C1\r OBDII: 0C0032

Here is a snippet of my code: (I have confirmed it is not to do with the device sending the responses as it returns them in a single response using a different node library outside or cordova.

chrome.bluetoothSocket.create(function(createInfo) {
    chrome.bluetoothSocket.connect(clientSocketId, $rootScope.btAddress, $rootScope.btTestUuid, function() {
        chrome.bluetoothSocket.onReceive.addListener(function(info) {
            console.log('onReceive: ', ab2str(info.data));
        });
    });
});

chrome.bluetoothSocket.send(createInfoGlobal.socketId, str2ab( "010C1\r" ), function(result) {
    console.log("Sending Command...: ");
});

I have tried playing around with buffer values but that hasnt solved anything.

Any help would be appreciated!

sdeemene commented 6 years ago

Hi, can i see a preview of you ionic implementations. Thanks