{"id":21710241,"url":"https://github.com/rhthomas/frdm-web-server","last_synced_at":"2025-03-20T17:50:30.422Z","repository":{"id":81147455,"uuid":"110341944","full_name":"rhthomas/frdm-web-server","owner":"rhthomas","description":"COMP3215 Lab 2 – Build a simple web server on the KW41Z which is accessed over USB.","archived":false,"fork":false,"pushed_at":"2017-11-26T21:10:33.000Z","size":1509,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T16:32:01.205Z","etag":null,"topics":["arm","arm-cortex-m0","keil","nxp","rtos","web-server"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rhthomas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-11T12:00:12.000Z","updated_at":"2017-12-11T18:12:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"32c91bfe-65ce-4004-8cef-174b3c6ef300","html_url":"https://github.com/rhthomas/frdm-web-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2Ffrdm-web-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2Ffrdm-web-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2Ffrdm-web-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rhthomas%2Ffrdm-web-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rhthomas","download_url":"https://codeload.github.com/rhthomas/frdm-web-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244666423,"owners_count":20490286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arm","arm-cortex-m0","keil","nxp","rtos","web-server"],"created_at":"2024-11-25T23:14:18.996Z","updated_at":"2025-03-20T17:50:30.414Z","avatar_url":"https://github.com/rhthomas.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KW41Z USB web server\n\n## mbed Library\n\nA PPP example application and library can be found [here](https://os.mbed.com/users/nixnax/code/PPP-Blinky/).\n\n### HTML\nThe web page to be loaded by the KW41z is shown below. Pressing the *LED ON* button sends a POST request with `button=1`. Conversely with *LED OFF* the it sets `button=0`.\n```html\n\u003chtml\u003e\n    \u003chead\u003e\u003ctitle\u003eA simple Web Server\u003c/title\u003e\u003c/head\u003e\n    \u003cbody\u003e\n        \u003ch1\u003eCOMP3215\u003c/h1\u003e\n        \u003cform action=\"\" method=\"post\"\u003e\n            \u003cbutton name=\"button\" value='1'\u003eLED ON\u003c/button\u003e\n            \u003cbutton name=\"button\" value='0'\u003eLED OFF\u003c/button\u003e\n        \u003c/form\u003e\n    \u003c/body\u003e\n\u003c/html\u003e\n```\n![Web Page](webpage.png)\n\n### Extracting the button value\n\nIn lines 893-894 in the `httpResponse()` function, the value of `button` is extracted using `strstr()`.\n\n```c\n...\nhttpGetLedOff = strstr(dataStart,\"button=0\");\nhttpGetLedOn  = strstr(dataStart,\"button=1\");\n...\n```\n\nAt the bottom of the response handler the LED state is then handled (lines 943-953).\n\n```c\n...\nif(httpGetLedOn) {\n    // put something here to send RF to turn on LED\n    led1 = 0;\n    memcpy(n+dataStart,body,sizeof(body));\n    n = n + sizeof(body)-1; // one less than size\n} else if(httpGetLedOff) {\n    // put something here to send RF to turn off LED\n    led1 = 1;\n    memcpy(n+dataStart,body,sizeof(body));\n    n = n + sizeof(body)-1; // one less than size\n}\n...\n```\n\nAfter setting the state of the LED, the webpage is then reserved to the host.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhthomas%2Ffrdm-web-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhthomas%2Ffrdm-web-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhthomas%2Ffrdm-web-server/lists"}