Psychopoulet / split-frames

Split Buffer frames from streams
ISC License
5 stars 3 forks source link

LRC #15

Closed juancarloslin closed 6 years ago

juancarloslin commented 6 years ago

We have a need to split-frames but also check LRC So STX........ETX LRC LRC calculated without STX. Will be nice to allow checkLRC option in the start with / end with so take the ETX followed byte to validate LRC, then emmit data.

Psychopoulet commented 6 years ago

the point is, I cannot add a specific comportment on it because it will no longer be generic. I work personaly with a lot of protocols, and each one works with its own way... for your purpose, you need to check LRC, with ETX and without STX (Concert protocol, or something like this ?), but what about protocols with STX, or without ETX, or LRC before ETX (or after STX) ? and what about protocols which use MSB for double checking ? I think it may be more valuable to inherit this package to create a specific parser for a specific comportment...

I was thinking about that (to add one or more bit after the and, for example, which can be parsed by inheritence), but I don't have enougth time at this moment for that... there is so much protocols ! so packages to create ! ^^

juancarloslin commented 6 years ago

Hi,

Thanks for your replay, I was thinking about a Generic LRC, as ANY, so then user can check on his own code. ANY means any value, but, a byte., can be represented as 0x00

If LRC is calculated at the end of ETX as our case should be

Start with STX End with ETX, ANY

so return STX,.......,ETX,LRC

if LRC calculated at the start of STX and include ETX then

Start with ANY, STX End with ETX

so return LRC,STX,.......,ETX

if LRC is 2 bytes, calculated at the start of STX and include ETX then

Start with ANY, ANY, STX End with ETX

so return LRC1, LRC2,STX,.......,ETX

this may works.

The ANY switch will be very powerfull for procesing frames.

Juan Carlos Lin Unisoft SA +595-993-288330

De: "Sébastien Vidal" notifications@github.com Para: "Psychopoulet/split-frames" split-frames@noreply.github.com CC: "Juan Carlos Lin" lin@unisoft.com.py, "Author" author@noreply.github.com Enviados: Domingo, 26 de Agosto 2018 16:44:20 Asunto: Re: [Psychopoulet/split-frames] LRC (#15)

the point is, I cannot add a specific comportment on it because it will no longer be generic. I work personaly with a lot of protocols, and each one works with its own way... for your purpose, you need to check LRC, with ETX and without STX (Concert protocol, or something like this ?), but what about protocols with STX, or without ETX, or LRC before ETX (or after STX) ? and what about protocols which use MSB for double checking ? I think it may be more valuable to inherit this package to create a specific parser for a specific comportment...

I was thinking about that (to add one or more bit after the and, for example, which can be parsed by inheritence), but I don't have enougth time at this moment for that... there is so much protocols ! so packages to create ! ^^

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-416070758 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AgMTmkDOuWkHR6z9RUm0x-svIUAHEBiFks5uUwikgaJpZM4WMOHT | mute the thread ] .

Psychopoulet commented 6 years ago

as I said, you have so many protocols ! there is no way to know how to compute it in a generic way.

for example :

STX < computed> ETX LRC STX < computed ETX > LRC < STX computed ETX > LRC < STX computed > ETX LRC

with Last Significant Byte & Most Significant Byte : STX < computed > ETX LSB MSB STX < computed > ETX MSB LSB STX < computed > LSB MSB ETX STX < computed LSB MSB > ETX

etc... etc... etc...

I can extract some specific bytes (STX +x, ETX +x, ETX -x, etc...), but to know what it means and how to compute it, you have to inheritate it

juancarloslin commented 6 years ago

Yes,

the idias is allow to extract the byte, then inside the code that consume the split-fram, check if is valid.

so the ANY siwtch will indicate that that byte sould be come withe the chunck frame. so if

startwith STX endwith ETX ANY

will come with STX....EXT + 1 byte with any value.

if startwith ANY ANY STX edwtih ETX

will come with 2 bytes with any value + STX...ETX

then the consumer of split-frame can check is the package is valid or no.

or you can call it LRC, just indicating LRC is no validated at split-frame level.

Juan Carlos Lin Unisoft SA +595-993-288330

De: "Sébastien Vidal" notifications@github.com Para: "Psychopoulet" split-frames@noreply.github.com CC: "Juan Carlos Lin" lin@unisoft.com.py, "Author" author@noreply.github.com Enviados: Martes, 28 de Agosto 2018 15:20:43 Asunto: Re: [Psychopoulet/split-frames] LRC (#15)

as I said, you have so many protocols ! there is no way to know how to compute it in a generic way.

for example :

STX < computed> ETX LRC STX < computed ETX > LRC < STX computed ETX > LRC < STX computed > ETX LRC

with Last Significant Byte & Most Significant Byte : STX < computed > ETX LSB MSB STX < computed > ETX MSB LSB STX < computed > LSB MSB ETX STX < computed LSB MSB > ETX

etc... etc... etc...

I can extract some specific bytes (STX +x, ETX +x, ETX -x, etc...), but to know what it means and how to compute it, you have to inheritate it

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-416708956 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AgMTmuNVVag0OPvcVidJG8jguxdO9j31ks5uVZgLgaJpZM4WMOHT | mute the thread ] .

Psychopoulet commented 6 years ago

Yep. as soon as it's possible, I'll do that (just had a baby ^^). Probably next week.

juancarloslin commented 6 years ago

Very nice,

Congratulations, I have 3 yet... Try to sleep as much as you can....

Juan Carlos Lin Unisoft SA +595-993-288330

De: "Sébastien Vidal" notifications@github.com Para: "Psychopoulet" split-frames@noreply.github.com CC: "Juan Carlos Lin" lin@unisoft.com.py, "Author" author@noreply.github.com Enviados: Viernes, 31 de Agosto 2018 10:11:33 Asunto: Re: [Psychopoulet/split-frames] LRC (#15)

Yep. as soon as it's possible, I'll do that (just had a baby ^^). Probably next week.

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-417676613 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AgMTmrZfHJ-Ux0Is7wdAaCIObIFLjI5Gks5uWUQVgaJpZM4WMOHT | mute the thread ] .

Psychopoulet commented 6 years ago

it's my second one, so... we all sleep all free time ^^

Psychopoulet commented 6 years ago

I started to rewrite it. it's a new main version with logic change : it will give you the splited frame as it is, with all its bits (STX ETX ) and it will no remove escaped bits.

If you want parse escaped bits, remove start/end bits or compute control bits (LRC, LSB, MSB, etc...), you will have to pipe it and compute it yourself in your class.

Psychopoulet commented 6 years ago

done.

juancarloslin commented 6 years ago

very nice I will teat and feedback

Sent from my Samsung Galaxy smartphone. -------- Original message --------From: Sébastien Vidal notifications@github.com Date: 05/09/2018 13:28 (GMT-04:00) To: Psychopoulet/split-frames split-frames@noreply.github.com Cc: Juan Carlos YJ Lin lin@unisoft.com.py, Author author@noreply.github.com Subject: Re: [Psychopoulet/split-frames] LRC (#15) done.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/Psychopoulet/split-frames","title":"Psychopoulet/split-frames","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/Psychopoulet/split-frames"}},"updates":{"snippets":[{"icon":"PERSON","message":"@Psychopoulet in #15: done."}],"action":{"name":"View Issue","url":"https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-418813787"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-418813787", "url": "https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-418813787", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [Psychopoulet/split-frames] LRC (#15)", "sections": [ { "text": "", "activityTitle": "Sébastien Vidal", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@Psychopoulet", "facts": [

] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"Psychopoulet/split-frames\",\n\"issueId\": 15,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}" } ] }, { "targets": [ { "os": "default", "uri": "https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-418813787" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 372302291\n}" } ], "themeColor": "26292E" } ]

juancarloslin commented 6 years ago

Good idea,

I also checked, the example code need to be fix

function computeLRC ( frame ) {

should be

function _ computeLRC ( frame ) {

Juan Carlos Lin Unisoft SA +595-993-288330

De: "Sébastien Vidal" notifications@github.com Para: "Psychopoulet" split-frames@noreply.github.com CC: "Juan Carlos Lin" lin@unisoft.com.py, "Author" author@noreply.github.com Enviados: Martes, 4 de Septiembre 2018 21:38:16 Asunto: Re: [Psychopoulet/split-frames] LRC (#15)

I started to rewrite it. it's a new main version with logic change : it will give you the splited frame as it is, with all its bits (STX ETX ) and it will no remove escaped bits.

If you want parse escaped bits, remove start/end bits or compute control bits (LRC, LSB, MSB, etc...), you will have to pipe it and compute it yourself in your class.

* advantage: it will be more coherent, only split frame without computing, and you will be able to compute it as you want. 
* disadvantage: you will have to extract escaped bits and remove start/end bits by yourself 

— You are receiving this because you authored the thread. Reply to this email directly, [ https://github.com/Psychopoulet/split-frames/issues/15#issuecomment-418571010 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AgMTmpBhewwS65xM9gwzqjkJ21Y_f11Cks5uXysIgaJpZM4WMOHT | mute the thread ] .