Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Key-Value pair to Serial port  RSS feed

 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am wondering how can i (honestly what format) i can send value to serial port.

Let's say i have following key-value pairs
['id'] => 10
['name'] => 200
['lSend'] => 0 // means Off
['pSend'] =>1 // means On
['lStartHour'] =>12
['lStartMins'] =>23
['lStopHour'] =>12
['lStopMins'] => 35 ......

I know i have to convert those values to byte but if i merge all those values and i will have very long 1 and 0eos
how come PIC card will understand which value for which key?

Also, i have read portion of this code which means Java program will receive 1 and 0eos how can i know which data which key's because i have to write those values into DB.

Regards
 
Paul Clapham
Sheriff
Posts: 22471
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The serial port doesn't need to understand the data in any way. Its only job is to transmit the data to whatever is connected to the other side.

So the only entity which needs to understand the data is the software listening at the other side of the serial port. If it already has specs on what format you should use, then you should use that format. Otherwise you and the writer of that software should get together and agree on the format. There's plenty of choice.
 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:There's plenty of choice.


Can you give me some hint/choice please.
 
Paul Clapham
Sheriff
Posts: 22471
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSON. Java serialization. XML. There are more... why don't you discuss it with the person working on the receiving program?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!