{"action":"created","issue":{"url":"https://api.github.com/repos/mavlink/mavlink/issues/156","labels_url":"https://api.github.com/repos/mavlink/mavlink/issues/156/labels{/name}","comments_url":"https://api.github.com/repos/mavlink/mavlink/issues/156/comments","events_url":"https://api.github.com/repos/mavlink/mavlink/issues/156/events","html_url":"https://github.com/mavlink/mavlink/issues/156","id":24536577,"number":156,"title":"Remove channels from MAVLink","user":{"login":"Susurrus","id":206363,"avatar_url":"https://avatars.githubusercontent.com/u/206363?v=3","gravatar_id":"","url":"https://api.github.com/users/Susurrus","html_url":"https://github.com/Susurrus","followers_url":"https://api.github.com/users/Susurrus/followers","following_url":"https://api.github.com/users/Susurrus/following{/other_user}","gists_url":"https://api.github.com/users/Susurrus/gists{/gist_id}","starred_url":"https://api.github.com/users/Susurrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Susurrus/subscriptions","organizations_url":"https://api.github.com/users/Susurrus/orgs","repos_url":"https://api.github.com/users/Susurrus/repos","events_url":"https://api.github.com/users/Susurrus/events{/privacy}","received_events_url":"https://api.github.com/users/Susurrus/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-12-19T04:35:47Z","updated_at":"2015-12-14T04:06:04Z","closed_at":"2015-12-14T04:06:04Z","body":"Alright, hear me out. Currently MAVLink works by assuming some number of backend channels, 4 for embedded systems and 10 for full PCs. This is used to statically allocate all state that needs to be stored while parsing a MAVLink stream. Unfortunately, this generally wastes space and also results in odd constructs like the return value of `mavlink_get_channel_status()`.\r\n\r\nI think it would be a much saner system to remove statically allocated systems and move towards passing around `mavlink_status_t` structs for parsing.\r\n\r\nBenefits:\r\n  * Saves space in 99% of cases\r\n  * `mavlink_parse_char()` now makes sense, as the `status` argument is now just a persistent state variable, and not a partial copy of the backend state variable.\r\n  * `mavlink_channel_t` can be removed, as it was also incomplete.\r\n\r\nCons:\r\n   * Backwards-incompatible change\r\n   * Slightly more code for the user\r\n\r\nChanges:\r\n  * remove `mavlink_get_channel_status()`, `mavlink_reset_channel_status()`\r\n  * Replace all instances of `mavlink_channel_t` with `mavlink_status_t`\r\n  * Add a `mavlink_message_t` field into `mavlink_status_t`, so that ALL parsing state is stored in the `mavlink_status_t`. In `mavlink_parse_char()` this can then be copied into the output `mavlink_message_t` argument.\r\n  * Refactor convenience functions so they still work, but minus the backend channels that MAVLink had been providing."},"comment":{"url":"https://api.github.com/repos/mavlink/mavlink/issues/comments/164337396","html_url":"https://github.com/mavlink/mavlink/issues/156#issuecomment-164337396","issue_url":"https://api.github.com/repos/mavlink/mavlink/issues/156","id":164337396,"user":{"login":"Susurrus","id":206363,"avatar_url":"https://avatars.githubusercontent.com/u/206363?v=3","gravatar_id":"","url":"https://api.github.com/users/Susurrus","html_url":"https://github.com/Susurrus","followers_url":"https://api.github.com/users/Susurrus/followers","following_url":"https://api.github.com/users/Susurrus/following{/other_user}","gists_url":"https://api.github.com/users/Susurrus/gists{/gist_id}","starred_url":"https://api.github.com/users/Susurrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Susurrus/subscriptions","organizations_url":"https://api.github.com/users/Susurrus/orgs","repos_url":"https://api.github.com/users/Susurrus/repos","events_url":"https://api.github.com/users/Susurrus/events{/privacy}","received_events_url":"https://api.github.com/users/Susurrus/received_events","type":"User","site_admin":false},"created_at":"2015-12-14T04:06:04Z","updated_at":"2015-12-14T04:06:04Z","body":"I don't see any interest in this."}}