-
Notifications
You must be signed in to change notification settings - Fork 89
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
Fix: binary data representation when sending data through HTTP & MQTT #690 #725
Fix: binary data representation when sending data through HTTP & MQTT #690 #725
Conversation
Hi @mapedraza and @fgalan , I have performed the UTs on my local environment and all the test cases are getting passed.
The above UT (CI / Unit Tests (14.x)) is not failed due to this PR. Please let me know your opinion. Thanks! |
.reply(204); | ||
}); | ||
it('should send its value to the Context Broker', function (done) { | ||
mqttClient.publish('/1234/MQTT_2/attrs/humidity', '0x4D', null, function (error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mqttClient.publish('/1234/MQTT_2/attrs/humidity', '0x4D', null, function (error) { | |
mqttClient.publish('/1234/MQTT_2/attrs/humidity', '0x4D', null, function (error) { |
This case is not totally correct. You are not sending binary data through MQTT here. When sending '0x4D', you are sending a string of ascii chars. In that case, the binary representation (in Hex) is made of 4 bytes:
Hex representation
0x30,0x78,0x34,0x44
Binary representation
00110000 01111000 00110100 01000100
So, the expected value persisted in that case should be:
"value": "30783444"
So, the initial part (0x), should not be removed
In order to don't lead to confusion, I suggest to change the test string without including the initial part 0x
.
Additionally, the part of the code that removes 0x
should be removed
Overpassed by #736 |
Hi @mapedraza and @fgalan,
This PR originates from #696
Issue: #690