{"action":"created","comment":{"url":"https://api.github.com/repos/cvra/master-firmware/pulls/comments/26317624","id":26317624,"diff_hunk":"@@ -108,3 +121,62 @@ void rpc_server_init(void)\n                       rpc_server_thread,\n                       NULL);\n }\n+\n+\n+size_t rpc_transmit(uint8_t *input_buffer, size_t input_buffer_size,\n+                    uint8_t *output_buffer, size_t output_buffer_size,\n+                    ip_addr_t *addr, uint16_t port)\n+{\n+    struct netconn *conn;\n+    int err;\n+\n+    cmp_ctx_t ctx; /* For cmp_mem_access. */\n+    cmp_mem_access_t mem;\n+    struct netbuf *buf;\n+\n+    u16_t len;\n+    char *data;\n+\n+\n+    conn = netconn_new(NETCONN_TCP);\n+\n+    if (conn == NULL) {\n+        return -1;\n+    }\n+\n+    err = netconn_connect(conn, addr, port);\n+\n+    if (err != ERR_OK) {\n+        goto fail;\n+    }\n+\n+    serial_datagram_send((void *)input_buffer, input_buffer_size,\n+                         netconn_serial_datagram_tx_adapter, (void *)conn);\n+\n+    cmp_mem_access_init(&ctx, &mem, output_buffer, output_buffer_size);\n+\n+    while (1) {\n+        err = netconn_recv(conn, &buf);\n+\n+        /* If connection was closed by server, abort */\n+        if (err != ERR_OK) {\n+            break;\n+        }\n+\n+        do {\n+            netbuf_data(buf, (void **)&data, &len);\n+\n+            /* Append data to buffer. */\n+            ctx.write(&ctx, data, len);","path":"src/rpc_server.c","position":70,"original_position":70,"commit_id":"ab1334f3f2027e30bca5c488da1e2939322529ce","original_commit_id":"ab1334f3f2027e30bca5c488da1e2939322529ce","user":{"login":"Stapelzeiger","id":1719607,"avatar_url":"https://avatars.githubusercontent.com/u/1719607?v=3","gravatar_id":"","url":"https://api.github.com/users/Stapelzeiger","html_url":"https://github.com/Stapelzeiger","followers_url":"https://api.github.com/users/Stapelzeiger/followers","following_url":"https://api.github.com/users/Stapelzeiger/following{/other_user}","gists_url":"https://api.github.com/users/Stapelzeiger/gists{/gist_id}","starred_url":"https://api.github.com/users/Stapelzeiger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stapelzeiger/subscriptions","organizations_url":"https://api.github.com/users/Stapelzeiger/orgs","repos_url":"https://api.github.com/users/Stapelzeiger/repos","events_url":"https://api.github.com/users/Stapelzeiger/events{/privacy}","received_events_url":"https://api.github.com/users/Stapelzeiger/received_events","type":"User","site_admin":false},"body":"return an error if write fails (buffer too small)","created_at":"2015-03-12T16:21:38Z","updated_at":"2015-03-12T16:21:38Z","html_url":"https://github.com/cvra/master-firmware/pull/5#discussion_r26317624","pull_request_url":"https://api.github.com/repos/cvra/master-firmware/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/cvra/master-firmware/pulls/comments/26317624"},"html":{"href":"https://github.com/cvra/master-firmware/pull/5#discussion_r26317624"},"pull_request":{"href":"https://api.github.com/repos/cvra/master-firmware/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/cvra/master-firmware/pulls/5","id":30988140,"html_url":"https://github.com/cvra/master-firmware/pull/5","diff_url":"https://github.com/cvra/master-firmware/pull/5.diff","patch_url":"https://github.com/cvra/master-firmware/pull/5.patch","issue_url":"https://api.github.com/repos/cvra/master-firmware/issues/5","number":5,"state":"open","locked":false,"title":"RPC client","user":{"login":"antoinealb","id":2419961,"avatar_url":"https://avatars.githubusercontent.com/u/2419961?v=3","gravatar_id":"","url":"https://api.github.com/users/antoinealb","html_url":"https://github.com/antoinealb","followers_url":"https://api.github.com/users/antoinealb/followers","following_url":"https://api.github.com/users/antoinealb/following{/other_user}","gists_url":"https://api.github.com/users/antoinealb/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinealb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinealb/subscriptions","organizations_url":"https://api.github.com/users/antoinealb/orgs","repos_url":"https://api.github.com/users/antoinealb/repos","events_url":"https://api.github.com/users/antoinealb/events{/privacy}","received_events_url":"https://api.github.com/users/antoinealb/received_events","type":"User","site_admin":false},"body":"Here is an implementation for a SimpleRPC client, tested on hardware.\r\n\r\nReview anyone ? @stapelzeiger","created_at":"2015-03-11T21:40:31Z","updated_at":"2015-03-12T16:21:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f5cbaf4199b898590bd08934f6eb45b8e412061f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cvra/master-firmware/pulls/5/commits","review_comments_url":"https://api.github.com/repos/cvra/master-firmware/pulls/5/comments","review_comment_url":"https://api.github.com/repos/cvra/master-firmware/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cvra/master-firmware/issues/5/comments","statuses_url":"https://api.github.com/repos/cvra/master-firmware/statuses/ab1334f3f2027e30bca5c488da1e2939322529ce","head":{"label":"cvra:feature-rpc-client","ref":"feature-rpc-client","sha":"ab1334f3f2027e30bca5c488da1e2939322529ce","user":{"login":"cvra","id":5530328,"avatar_url":"https://avatars.githubusercontent.com/u/5530328?v=3","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"repo":{"id":29030786,"name":"master-firmware","full_name":"cvra/master-firmware","owner":{"login":"cvra","id":5530328,"avatar_url":"https://avatars.githubusercontent.com/u/5530328?v=3","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvra/master-firmware","description":"Firmware running on the master board (STM32F407)","fork":false,"url":"https://api.github.com/repos/cvra/master-firmware","forks_url":"https://api.github.com/repos/cvra/master-firmware/forks","keys_url":"https://api.github.com/repos/cvra/master-firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvra/master-firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvra/master-firmware/teams","hooks_url":"https://api.github.com/repos/cvra/master-firmware/hooks","issue_events_url":"https://api.github.com/repos/cvra/master-firmware/issues/events{/number}","events_url":"https://api.github.com/repos/cvra/master-firmware/events","assignees_url":"https://api.github.com/repos/cvra/master-firmware/assignees{/user}","branches_url":"https://api.github.com/repos/cvra/master-firmware/branches{/branch}","tags_url":"https://api.github.com/repos/cvra/master-firmware/tags","blobs_url":"https://api.github.com/repos/cvra/master-firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvra/master-firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvra/master-firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvra/master-firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvra/master-firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/cvra/master-firmware/languages","stargazers_url":"https://api.github.com/repos/cvra/master-firmware/stargazers","contributors_url":"https://api.github.com/repos/cvra/master-firmware/contributors","subscribers_url":"https://api.github.com/repos/cvra/master-firmware/subscribers","subscription_url":"https://api.github.com/repos/cvra/master-firmware/subscription","commits_url":"https://api.github.com/repos/cvra/master-firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvra/master-firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvra/master-firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvra/master-firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvra/master-firmware/contents/{+path}","compare_url":"https://api.github.com/repos/cvra/master-firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvra/master-firmware/merges","archive_url":"https://api.github.com/repos/cvra/master-firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvra/master-firmware/downloads","issues_url":"https://api.github.com/repos/cvra/master-firmware/issues{/number}","pulls_url":"https://api.github.com/repos/cvra/master-firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/cvra/master-firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/cvra/master-firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvra/master-firmware/labels{/name}","releases_url":"https://api.github.com/repos/cvra/master-firmware/releases{/id}","created_at":"2015-01-09T19:05:10Z","updated_at":"2015-03-11T21:38:56Z","pushed_at":"2015-03-11T21:39:09Z","git_url":"git://github.com/cvra/master-firmware.git","ssh_url":"git@github.com:cvra/master-firmware.git","clone_url":"https://github.com/cvra/master-firmware.git","svn_url":"https://github.com/cvra/master-firmware","homepage":null,"size":513,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"cvra:master","ref":"master","sha":"945ed74dd60032395ac3420be2e7096c47901600","user":{"login":"cvra","id":5530328,"avatar_url":"https://avatars.githubusercontent.com/u/5530328?v=3","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"repo":{"id":29030786,"name":"master-firmware","full_name":"cvra/master-firmware","owner":{"login":"cvra","id":5530328,"avatar_url":"https://avatars.githubusercontent.com/u/5530328?v=3","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvra/master-firmware","description":"Firmware running on the master board (STM32F407)","fork":false,"url":"https://api.github.com/repos/cvra/master-firmware","forks_url":"https://api.github.com/repos/cvra/master-firmware/forks","keys_url":"https://api.github.com/repos/cvra/master-firmware/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvra/master-firmware/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvra/master-firmware/teams","hooks_url":"https://api.github.com/repos/cvra/master-firmware/hooks","issue_events_url":"https://api.github.com/repos/cvra/master-firmware/issues/events{/number}","events_url":"https://api.github.com/repos/cvra/master-firmware/events","assignees_url":"https://api.github.com/repos/cvra/master-firmware/assignees{/user}","branches_url":"https://api.github.com/repos/cvra/master-firmware/branches{/branch}","tags_url":"https://api.github.com/repos/cvra/master-firmware/tags","blobs_url":"https://api.github.com/repos/cvra/master-firmware/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvra/master-firmware/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvra/master-firmware/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvra/master-firmware/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvra/master-firmware/statuses/{sha}","languages_url":"https://api.github.com/repos/cvra/master-firmware/languages","stargazers_url":"https://api.github.com/repos/cvra/master-firmware/stargazers","contributors_url":"https://api.github.com/repos/cvra/master-firmware/contributors","subscribers_url":"https://api.github.com/repos/cvra/master-firmware/subscribers","subscription_url":"https://api.github.com/repos/cvra/master-firmware/subscription","commits_url":"https://api.github.com/repos/cvra/master-firmware/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvra/master-firmware/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvra/master-firmware/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvra/master-firmware/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvra/master-firmware/contents/{+path}","compare_url":"https://api.github.com/repos/cvra/master-firmware/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvra/master-firmware/merges","archive_url":"https://api.github.com/repos/cvra/master-firmware/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvra/master-firmware/downloads","issues_url":"https://api.github.com/repos/cvra/master-firmware/issues{/number}","pulls_url":"https://api.github.com/repos/cvra/master-firmware/pulls{/number}","milestones_url":"https://api.github.com/repos/cvra/master-firmware/milestones{/number}","notifications_url":"https://api.github.com/repos/cvra/master-firmware/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvra/master-firmware/labels{/name}","releases_url":"https://api.github.com/repos/cvra/master-firmware/releases{/id}","created_at":"2015-01-09T19:05:10Z","updated_at":"2015-03-11T21:38:56Z","pushed_at":"2015-03-11T21:39:09Z","git_url":"git://github.com/cvra/master-firmware.git","ssh_url":"git@github.com:cvra/master-firmware.git","clone_url":"https://github.com/cvra/master-firmware.git","svn_url":"https://github.com/cvra/master-firmware","homepage":null,"size":513,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cvra/master-firmware/pulls/5"},"html":{"href":"https://github.com/cvra/master-firmware/pull/5"},"issue":{"href":"https://api.github.com/repos/cvra/master-firmware/issues/5"},"comments":{"href":"https://api.github.com/repos/cvra/master-firmware/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/cvra/master-firmware/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/cvra/master-firmware/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cvra/master-firmware/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/cvra/master-firmware/statuses/ab1334f3f2027e30bca5c488da1e2939322529ce"}}}}