{"action":"created","issue":{"url":"https://api.github.com/repos/traccar/traccar/issues/4091","repository_url":"https://api.github.com/repos/traccar/traccar","labels_url":"https://api.github.com/repos/traccar/traccar/issues/4091/labels{/name}","comments_url":"https://api.github.com/repos/traccar/traccar/issues/4091/comments","events_url":"https://api.github.com/repos/traccar/traccar/issues/4091/events","html_url":"https://github.com/traccar/traccar/pull/4091","id":367215332,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNzA0Nzc2","number":4091,"title":"fix watchframedecoder for TK906 (invalid lenght) device issues","user":{"login":"TheBrain8791","id":43881071,"node_id":"MDQ6VXNlcjQzODgxMDcx","avatar_url":"https://avatars0.githubusercontent.com/u/43881071?v=4","gravatar_id":"","url":"https://api.github.com/users/TheBrain8791","html_url":"https://github.com/TheBrain8791","followers_url":"https://api.github.com/users/TheBrain8791/followers","following_url":"https://api.github.com/users/TheBrain8791/following{/other_user}","gists_url":"https://api.github.com/users/TheBrain8791/gists{/gist_id}","starred_url":"https://api.github.com/users/TheBrain8791/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheBrain8791/subscriptions","organizations_url":"https://api.github.com/users/TheBrain8791/orgs","repos_url":"https://api.github.com/users/TheBrain8791/repos","events_url":"https://api.github.com/users/TheBrain8791/events{/privacy}","received_events_url":"https://api.github.com/users/TheBrain8791/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-10-05T13:37:45Z","updated_at":"2018-10-09T06:28:46Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/traccar/traccar/pulls/4091","html_url":"https://github.com/traccar/traccar/pull/4091","diff_url":"https://github.com/traccar/traccar/pull/4091.diff","patch_url":"https://github.com/traccar/traccar/pull/4091.patch"},"body":"This fixes device issues found with TK906 bike trackers, which tend to\r\ntransmit wrong a frame length for some frames very often. \r\n\r\nThe fixed Watch protocol frame decoder now not only evaluates the frame\r\nlength transmitted from the device itself but also checks the no of\r\nframe bytes till the next \"frame end marker\" (']') and uses whatever is\r\ncorrect.\r\n\r\nAdditionally the frame start detection has been improved to better sync\r\nto valid frames according to the watch protocol spec.\r\n\r\nusecase 1) ignore chars which don't belong to a frame (not between '['\r\nand ']'):\r\n```\r\n12345[SG*12345678*0004*LK,,]abcde\\n..[SG*12345678*0004*LK,,]222\r\n```\r\nin this example '12345', 'abcde\\n..' and '222' stream bytes will be\r\nignored\r\n\r\nusecase 2) partial transmitted frames\r\n```\r\n[SG*12345678[SG*12345678*0002*LK]\r\n```\r\nin this example, the leading bytes '[SG*12345678' will be ignored\r\n\r\n\r\nThe fix does not affact devices which work according to the protocol\r\nspec, but improves handling of devices like the TK906 which fail to\r\nfulfill the protcol spec and otherwise could not be used with traccar."},"comment":{"url":"https://api.github.com/repos/traccar/traccar/issues/comments/428075501","html_url":"https://github.com/traccar/traccar/pull/4091#issuecomment-428075501","issue_url":"https://api.github.com/repos/traccar/traccar/issues/4091","id":428075501,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODA3NTUwMQ==","user":{"login":"TheBrain8791","id":43881071,"node_id":"MDQ6VXNlcjQzODgxMDcx","avatar_url":"https://avatars0.githubusercontent.com/u/43881071?v=4","gravatar_id":"","url":"https://api.github.com/users/TheBrain8791","html_url":"https://github.com/TheBrain8791","followers_url":"https://api.github.com/users/TheBrain8791/followers","following_url":"https://api.github.com/users/TheBrain8791/following{/other_user}","gists_url":"https://api.github.com/users/TheBrain8791/gists{/gist_id}","starred_url":"https://api.github.com/users/TheBrain8791/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheBrain8791/subscriptions","organizations_url":"https://api.github.com/users/TheBrain8791/orgs","repos_url":"https://api.github.com/users/TheBrain8791/repos","events_url":"https://api.github.com/users/TheBrain8791/events{/privacy}","received_events_url":"https://api.github.com/users/TheBrain8791/received_events","type":"User","site_admin":false},"created_at":"2018-10-09T06:28:46Z","updated_at":"2018-10-09T06:28:46Z","author_association":"NONE","body":"I think this is maybe too simple - in any case that modification would not handler stream bytes out of frame markings. \r\nBeside that fact - the current code works great (with the exception of the tk906 which has device issues) and is tested  \"in the field\" for some time now - so I'd suggest better not to remove too much of the frame structure checking within the frame decoder.\r\n\r\nIn the worst case I'd be afraid if some devices send malformed frames which were simply sorted out till now (unknown - because just in the background), could lead to unknown reactions within the protocol decoder, which would suddenly have to handle them...\r\n\r\nMaybe it could be a solution to \"move\" some of the frame structure checking from the frame decoder to the protocol decoder, but why risk a complete redesign of the frame decoder if new additional use cases  (handle tk906 device issues) can be fixed with smaller adaptions.\r\n\r\nAnyway I'll do a test with your suggestion and will have a look if this works and what will be the consequences. I'll report back and I'll have a look for a log as I wrote yesterday and post it..."}}
{"actor":{"display_login":"TheBrain8791"}}