{"action":"created","issue":{"url":"https://api.github.com/repos/gioblu/PJON/issues/94","repository_url":"https://api.github.com/repos/gioblu/PJON","labels_url":"https://api.github.com/repos/gioblu/PJON/issues/94/labels{/name}","comments_url":"https://api.github.com/repos/gioblu/PJON/issues/94/comments","events_url":"https://api.github.com/repos/gioblu/PJON/issues/94/events","html_url":"https://github.com/gioblu/PJON/issues/94","id":178565573,"number":94,"title":"Dynamic Addressing","user":{"login":"Darksecond","id":291582,"avatar_url":"https://avatars.githubusercontent.com/u/291582?v=3","gravatar_id":"","url":"https://api.github.com/users/Darksecond","html_url":"https://github.com/Darksecond","followers_url":"https://api.github.com/users/Darksecond/followers","following_url":"https://api.github.com/users/Darksecond/following{/other_user}","gists_url":"https://api.github.com/users/Darksecond/gists{/gist_id}","starred_url":"https://api.github.com/users/Darksecond/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Darksecond/subscriptions","organizations_url":"https://api.github.com/users/Darksecond/orgs","repos_url":"https://api.github.com/users/Darksecond/repos","events_url":"https://api.github.com/users/Darksecond/events{/privacy}","received_events_url":"https://api.github.com/users/Darksecond/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gioblu/PJON/labels/enhancement","name":"enhancement","color":"c7def8"},{"url":"https://api.github.com/repos/gioblu/PJON/labels/question","name":"question","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-22T09:48:11Z","updated_at":"2016-09-29T00:57:04Z","closed_at":null,"body":"I was wondering if there is a way to dynamically assign addresses with PJON, instead of statically assigning them."},"comment":{"url":"https://api.github.com/repos/gioblu/PJON/issues/comments/250343297","html_url":"https://github.com/gioblu/PJON/issues/94#issuecomment-250343297","issue_url":"https://api.github.com/repos/gioblu/PJON/issues/94","id":250343297,"user":{"login":"gioblu","id":764497,"avatar_url":"https://avatars.githubusercontent.com/u/764497?v=3","gravatar_id":"","url":"https://api.github.com/users/gioblu","html_url":"https://github.com/gioblu","followers_url":"https://api.github.com/users/gioblu/followers","following_url":"https://api.github.com/users/gioblu/following{/other_user}","gists_url":"https://api.github.com/users/gioblu/gists{/gist_id}","starred_url":"https://api.github.com/users/gioblu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gioblu/subscriptions","organizations_url":"https://api.github.com/users/gioblu/orgs","repos_url":"https://api.github.com/users/gioblu/repos","events_url":"https://api.github.com/users/gioblu/events{/privacy}","received_events_url":"https://api.github.com/users/gioblu/received_events","type":"User","site_admin":false},"created_at":"2016-09-29T00:57:04Z","updated_at":"2016-09-29T00:57:04Z","body":"Ciao @Matheus-Garbelini How is the C porting going?\r\nSpeaking about this issue, we are working on a master-slave with multi-master fallback in absence of master. Using a new class `PJONMaster` that inherits `PJON` and adds the master functionality. On the other side in `PJON` has been added the slave functionality necessary for the exchange:\r\n\r\n```cpp\r\n#define ID_REQUEST  200\r\n#define ID_CONFIRM  201\r\n#define ID_NEGATE   202\r\n```\r\n`rid` = random generated 4 bytes unique identifier\r\n\r\n1. Slave with `NOT_ASSIGNED` id asks for a new device id sending `ID_REQUEST` and its rid, master receiving this packet will reserve an id for the rid.\r\n2. Master answers with a `BROADCAST` containing `ID_REQUEST`, rid and the new device id reserved\r\n3. Slave with new device id asks for confirmation sending `ID_CONFIRM`, rid and device id\r\n4. Master ends broadcasting, checks for rid collision, if detected sends `ID_NEGATE` forcing the slave to generate a new rid and restart the process. if not the procedure is finished.\r\n\r\nIn the multimaster case:\r\n1. Device extract a random number and tries to contact that device\r\n2. If device answers, it adds one to the id and tries again\r\n3. If any answer is obtain from a certain id that is taken, the device stays for a random time in reception (to be able to answer to other devices potentially interested in that id) \r\n4. The device tries to contact itself to probe potential collision, if any answer is received the device is considered taken."}}
{"actor":{"display_login":"gioblu"}}