Closed louis030195 closed 4 years ago
Yes you have to implement it in js. Do you have an example of such packet ? It seems very weird to split on 0x12 if it's not a text protocol (what happens if you have 0x12 as a int value ?)
On Fri, Nov 1, 2019, 09:12 Louis Beaumont notifications@github.com wrote:
It is not so clear how to do it, for example i have a packet format:
[ID_PACKET(2 bytes)][PARAM1][SEPARATOR(for example ";" or 0x12 ...)][PARAM2][same separator]PARAM3][same separator] ...
is it like that ?
{ "title": "split", "type": "array", "items": [ { "enum": ["split"] }, { "type": "object", "properties": { "type": {"$ref": "dataType"}, "separator":{"$ref": "definitions#/definitions/dataTypeArgsCount"} }, "required": ["type", "separator"], "additionalProperties": false } ] }
Also I should implement something in JS with it ? Then I guess I have to use addType() ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ProtoDef-io/node-protodef/issues/99?email_source=notifications&email_token=AAR437ROTNEV3BD5RNJAYLTQRPQFNA5CNFSM4JHXQ522YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HWBCLZQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437SZRBLJ43LJOG5HURDQRPQFNANCNFSM4JHXQ52Q .
lets forget 0x12, just for ";" or "," ... something that could be used like that
https://gist.github.com/louis030195/3398dbf7ea91ea9daa4fe38d2ce6cb51
What happens in that case when the hex code for ";" is part of one of these int32 ?
On Fri, Nov 1, 2019, 15:01 Louis Beaumont notifications@github.com wrote:
lets forget 0x12, just for ";" or "," ... something that could be used like that
https://gist.github.com/louis030195/3398dbf7ea91ea9daa4fe38d2ce6cb51
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ProtoDef-io/node-protodef/issues/99?email_source=notifications&email_token=AAR437RO2CL5KWONCCDRRATQRQZCFA5CNFSM4JHXQ522YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC276GA#issuecomment-548798232, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437X5GPYJ367AVO5T7TLQRQZCFANCNFSM4JHXQ52Q .
Not possible ? This kind of packet:
GCK|1As0,0,110|0|0|0|0~0,0,1,0,0,0|50,50|10000,10000|0|120|6,0,0,0,6|3,0,0,0,3|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|1,0,0,0,1|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|
What is not possible ? If you have the number 124 then you will split on this. (124 is the char representation of '|')
These packets in your example are strings packets, not binary packets. So just parse a big string with protodef (is the length of your string available somewhere ?) then use js split method
On Fri, Nov 1, 2019, 16:26 Louis Beaumont notifications@github.com wrote:
Not possible ? This kind of packet:
GCK|1As0,0,110|0|0|0|0~0,0,1,0,0,0|50,50|10000,10000|0|120|6,0,0,0,6|3,0,0,0,3|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|1,0,0,0,1|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|0,0,0,0,0|
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ProtoDef-io/node-protodef/issues/99?email_source=notifications&email_token=AAR437WN27VVSHBWTSVSBOLQRRDCXA5CNFSM4JHXQ522YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEC3H2OA#issuecomment-548830520, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAR437T72JKWZIJUQDLUM4TQRRDCXANCNFSM4JHXQ52Q .
Solved. See examples
It is not so clear how to do it, for example i have a packet format:
[ID_PACKET(2 bytes)][PARAM1][SEPARATOR(for example ";" or 0x12 ...)][PARAM2][same separator]PARAM3][same separator] ...
or like you would do in most languages:
is it like that ?
Also I should implement something in JS with it ? Then I guess I have to use addType() ?