How to implement REST style commands to handle WiFi connection in Linino OS?

At default state, Arduino Yun is a WiFi hot spot. Phone can connect to it. We would like to send REST style commands from Phone App to Arduino Yun to do the following jobs:

  1. Scan the WiFi nodes nearby and report back to phone App
  2. Connect to a specific WiFi node by WiFi node name and password from phone App
  3. Report connection state (available or connected) back to phone App

I would like to implement all the above commands in Linux side instead of Atmel side because I need to save memory space on Atmel side to do other jobs.

My questions are:

  1. Where are files to process REST API commands?
  2. How to scan WiFi? How to connect to a specifi WiFi node?
  3. How to add new REST API commands to scan WiFi and connect a specifi WiFi node?

Can they be done? Please point me a direction.

Thank you very much,

Nick

nickyang:
...

  1. Scan the WiFi nodes nearby and report back to phone App
  2. Connect to a specific WiFi node by WiFi node name and password from phone App
  3. Report connection state (available or connected) back to phone App
    ...

The phone App (iOS/Android) should be able to do all three jobs without Yun's help!

The phone App (iOS/Android) should be able to do all three jobs without Yun's help!

Really?

I thought after phone App directly connects to Yun (as a WiFi hot spot), phone App needs to send a command to Yun board so

  1. Yun can scan the WiFi nodes nearby and report back to phone App
  2. Yun can connect to a specific WiFi node by WiFi node name and password from phone App

If phone App can do by itself without Yun's help, it will be great. Could you please tell me a little more on how to do?

Thanks.