Comments (5)
I found solution to date and program problems. For some reason one needs to split commands into chunks of 21 bytes (not counting CR). Sending first 21 bytes we don't receive response, now send the rest and you'll get correct response!
|set date 14 11 10 22> //nothing returned
| 33 > 14 11 10 22 40
|read date>14 11 10 22 40
The same deal with set program. Easy enough to split chunks in the code!
from circulate.
Oh, this is essentially the same as the response chunking. They're also split and you needed to wait for the terminating newline.
from circulate.
Although, I don't remember hitting this when testing out myself. Were you suffixing you're commands with a \r
or a \n
. I think it's required to do the former as you can see here
https://github.com/neilpa/circulate/blob/master/Library/AnovaDevice.m#L137
That may be the source of your issue.
from circulate.
I end it with CR (0x0d) (it's Android, so it's Java). I am playing with my code right now - verifying the length of chunk.
It seems the same is with your code. I tested with [self sendCommand:@"set date 14 11 10 19 40"];
from circulate.
OK. Here is perfectly working code (well it works for set date, set program easily grows to 65 charcters, so I have to loop by chunks):
String commandText = mCommandValue.getText().toString();
int chunk = 20;
if (commandText.length() < chunk + 1){
byte[] bytecommand = new byte[commandText.length() + 1];
System.arraycopy(commandText.getBytes(Charset.forName("US-ASCII")), 0,
bytecommand, 0, commandText.length());
bytecommand[commandText.length()] = 0x0d;
mBluetoothLeService.writeCharacteristic(mAnovaCharacteristic, bytecommand);
} else {
byte[] bytecommand = new byte[chunk+1];
System.arraycopy(commandText.getBytes(Charset.forName("US-ASCII")), 0,
bytecommand, 0, chunk);
bytecommand[chunk] = 0x0d;
byte[] bytecommand2 = new byte[commandText.length() - chunk + 1];
System.arraycopy(commandText.getBytes(Charset.forName("US-ASCII")), chunk,
bytecommand2, 0, commandText.length() - chunk);
bytecommand2[commandText.length() - chunk] = 0x0d;
mBluetoothLeService.writeCharacteristic(mAnovaCharacteristic, bytecommand);
mBluetoothLeService.writeCharacteristic(mAnovaCharacteristic, bytecommand2);
from circulate.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from circulate.