Homework 5 - Mobile Web Services
Create an application that can both act as a mobile sensor host and discover other hosts.
Server-side
- When the application starts, a CoAP server should be started and advertised using mDNS (1 pt)
- Advertise using a fixed service name, e.g.
sensor_service
- Advertise using a fixed service name, e.g.
- The CoAP server should provide 2 resources (value updated every time the real value changes):
- The device's battery level (1 pt)
- The device's GPS location (1 pt)
- Tip: You can use the
setValue()
method ofBasicCoapResource
to update the returned value.
Client-side
- Clicking a button will initiate mDNS service discovery (1 pt)
- If discovery resolves a service with the fixed name, it should do the following (1 pt):
- Send CoAP requests to both of the above CoAP resources and display the returned values on the screen.
- Stop service discovery so it can be started again later using the button
Optional: try discovering the server of your friend's phone! It should work, as long as the devices are on the same network and the server's port is not blocked by the firewall. In eduroam/ut-public you may run into problems due to firewalls and addressing, easiest option is to use the phone's hotspot