This is what I use myself however it is a windows based program. It is possible that you are trying to build something else with your code where this would not be effective but it is an excellent free too for anyone to have!
http://www.nirsoft.net/utils/wireless_n ... tcher.htmlFor android I use a program called FING.
http://www.nirsoft.net/utils/wireless_n ... tcher.htmlAs for basic currently the MACID shows as your AP connection however when in station mode you must get it from a network scanning tool ... may just be possible for basic I really am not totally familiar with the specifics of all of this.
As far as what you could do with code Hrmmm I wonder if you couldn't just create a page with an iframe of your routers device listing and grab the data from the Iframe some how? Or you could use wget to get the device listing from your router and return the page via wprint aka html ... I am sure there is likely more ways to do this and I am interested to see anyone elses ideas as well ;)