Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for writer/reader pipe file and description of service and characteristic #92

Closed
AlessandroFerri opened this issue Jan 28, 2015 · 2 comments
Labels

Comments

@AlessandroFerri
Copy link

Hi Sandeep Mistry,
I tried the example /bleno/examples/battery-service and /bleno/test.js. In the first instance, from iOs BLE, I get the description of the service as "Service Battery" and of the characteristic as "Battery Level", while in the second example the description of the service and of the characteristics appear always as "Unknown". I have tried in many ways to change the description "unknow", but did not succeed. Please can you help me?
Also I need to use the data for a WriteOnlyCharacteristic from another program in C code. I have thought of a writer/reader pipe socket file and I modified /beno/test.js in this manner.

var options = { flags: 'w', encoding: 'hex', mode: 0666 };
var wstream = fs.createWriteStream('/tmp/msgfifo', options);

WriteOnlyCharacteristicXXX.prototype.onWriteRequest = function(data, offset, withoutResponse, callback) {
console.log('WriteOnlyCharacteristicXXX write request: XXX' + data.toString('hex') + ' ' + offset + ' ' + withoutResponse);

wstream.write('XXX'+data.toString('hex'));

callback(this.RESULT_SUCCESS);
};

This works, but if the file /tmp/msgfifo is created first by test.js, rather than from the program in C code, the C program goes in loop.
is the right path for you? Can you give me some advice?

@sandeepmistry
Copy link
Collaborator

@AlessandroFerri

Where is unknown being shown? What is the second example?

Please keep one question/issue per Github issue and specific to bleno - there are better places to ask general node.js + C questions like the one you are asking about files/streams.

@sandeepmistry
Copy link
Collaborator

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants