alfred: Add support for passing location information over alfred.
PATCH v2 1/1 alfred: Add support for passing location information over alfred.
It can be useful to know where mesh nodes are located. Add an Alfred server which can get the current location from gpsd, or a static location from the command line. Add a client which can display this information distributed by nodes in JSON format.
---
Since v1:
Remove CHANGELOG entry
Makefile uses pkg-config, thanks to Sven
Add man page.
Makefile | 24 ++- README | 52 ++++- gpsd/Makefile | 98 +++++++++ gpsd/alfred-gpsd.c | 529 +++++++++++++++++++++++++++++++++++++++++++++++++ gpsd/alfred-gpsd.h | 102 ++++++++++ gpsd/man/alfred-gpsd.8 | 92 +++++++++ 6 files changed, 890 insertions(+), 7 deletions(-) create mode 100644 gpsd/Makefile create mode 100644 gpsd/alfred-gpsd.c create mode 100644 gpsd/alfred-gpsd.h create mode 100644 gpsd/man/alfred-gpsd.8
Makefile +20 -4
@@ -64,9 +64,15 @@ ifneq ($(CONFIG_ALFRED_VIS),n) VIS_INSTALL=vis-install endif +ifneq ($(CONFIG_ALFRED_GPSD),n) + GPSD_ALL=gpsd-all + GPSD_CLEAN=gpsd-clean + GPSD_INSTALL=gpsd-install +endif + # default target -all: $(BINARY_NAME) $(VIS_ALL) +all: $(BINARY_NAME) $(VIS_ALL) $(GPSD_ALL) # standard build rules .SUFFIXES: .o .c
@@ -76,10 +82,10 @@ all: $(BINARY_NAME) $(VIS_ALL) $(BINARY_NAME): $(OBJ) $(LINK.o) $^ $(LDLIBS) -o $@ -clean: $(VIS_CLEAN) +clean: $(VIS_CLEAN) $(GPSD_CLEAN) $(RM) $(BINARY_NAME) $(OBJ) $(DEP) -install: $(BINARY_NAME) $(VIS_INSTALL) +install: $(BINARY_NAME) $(VIS_INSTALL) $(GPSD_INSTALL) $(MKDIR) $(DESTDIR)$(SBINDIR) $(MKDIR) $(DESTDIR)$(MANDIR)/man8 $(INSTALL) -m 0755 $(BINARY_NAME) $(DESTDIR)$(SBINDIR)
@@ -94,8 +100,18 @@ vis-all: vis-clean: $(MAKE) -C vis clean +gpsd-install: + $(MAKE) -C gpsd install + +gpsd-all: + $(MAKE) -C gpsd all + +gpsd-clean: + $(MAKE) -C gpsd clean + # load dependencies DEP = $(OBJ:.o=.d) -include $(DEP) -.PHONY: all clean install vis-install vis-all vis-clean +.PHONY: all clean install vis-install vis-all vis-clean \ + gpsd-install gpsd-all gpsd-clean
README +49 -3
77 lines not on this page · raw message
gpsd/Makefile new file +98 -0
98 lines not on this page · raw message
gpsd/alfred-gpsd.c new file +529 -0
529 lines not on this page · raw message
gpsd/alfred-gpsd.h new file +102 -0
102 lines not on this page · raw message
gpsd/man/alfred-gpsd.8 new file +92 -0
92 lines not on this page · raw message
Signature · 1 line
1.8.4.rc3
[B.A.T.M.A.N.] a question regarding ALFRED
I am currently developing a mesh router solution for several clients. I have been using batman-adv in this project for almost a year (using OpenWRT), and it has all worked fantastically. Thanks so much guys.
I now have a requirement for GPS logging functionality, along with passing other data between nodes. I have already written a simple layer3 protocol for this purpose, but this was before ALFRED. ALFRED provides almost all the functionality I need apart from the fact that I really need to embed the alfred code within my own application. I could use it as is via a sys call, but it would be so much better to include the code. What are your feelings regarding splitting the alfred code into a library with can be included in other user applications, and an alfred client program that uses this library? I'm quite prepared to give quite a bit of my own time to doing this if you like the idea.
best regards
Steve Thornton
Re: [B.A.T.M.A.N.] a question regarding ALFRED
On Wed, Oct 09, 2013 at 05:34:00PM +0100, Stephen Thornton wrote:
Hi Stephen
Please could you fix your mail client to keep lines short than around 70 characters.
Quoted 2 lines
I am currently developing a mesh router solution for several clients. I have been using batman-adv in this project for almost a year (using OpenWRT), and it has all worked fantastically. Thanks so much guys.
I now have a requirement for GPS logging functionality, along with passing other data between nodes. I have already written a simple layer3 protocol for this purpose, but this was before ALFRED. ALFRED provides almost all the functionality I need apart from the fact that I really need to embed the alfred code within my own application. I could use it as is via a sys call, but it would be so much better to include the code. What are your feelings regarding splitting the alfred code into a library with can be included in other user applications, and an alfred client program that uses this library? I'm quite prepared to give quite a bit of my own time to doing this if you like the idea.
Are you interested in using alfred, or vis built on top of alfred? Would you want a library for accessing alfred, or for accessing vis?
You could pull some of the boilerplate code out of vis and my alfred-gpsd server/client into a library. e.g. alfred_open_sock(), _publish_data(), _request_data(), _receive_answer_packet(), _get_data(). What will cause problems is the globals structure. It is a mixture of generic and application specific members. That will require quite a bit of refactoring.
I'm just not sure it is worth the effort. It took me less than a mythical man day to get a proof of concept gpsd code working, and another day to sort out output formatting issues and the odd bug, etc. Creating a new client/server embedded in some other application is not particularly difficult, re-using the existing code.
Andrew
Re: [B.A.T.M.A.N.] a question regarding ALFRED
In reply to Stephen ThorntonHello Stephen,
Quoted 1 line · Stephen Thornton
I am currently developing a mesh router solution for several clients. I have been using batman-adv in this project for almost a year (using OpenWRT), and it has all worked fantastically. Thanks so much guys.
thank you :)
Quoted 1 line
I now have a requirement for GPS logging functionality, along with passing other data between nodes. I have already written a simple layer3 protocol for this purpose, but this was before ALFRED. ALFRED provides almost all the functionality I need apart from the fact that I really need to embed the alfred code within my own application. I could use it as is via a sys call, but it would be so much better to include the code. What are your feelings regarding splitting the alfred code into a library with can be included in other user applications, and an alfred client program that uses this library? I'm quite prepared to give quite a bit of my own time to doing this if you like the idea.
Well, the alfred binary does quite a few things and relies on being a process on it's own. I don't think it's easy to integrate that functionality in a library, and it is not intended.
What we'd like to encourage however is to interface directly with alfred by talking to it through the unix socket - have a look at vis (already implemented) or the gpsd support andrew recently proposed. You could do the same for your application - talk to alfred directly. That should also be the best solution in regard of long term maintainance, license issues (alfred is GPL after all), ...
If you feel that alfred really needs to be binary-integrated in your application, I'd like to know why. :)
Cheers,
Simon
Simon Wunderlich
AppliedQuoted 6 lines · Andrew Lunn
It can be useful to know where mesh nodes are located. Add an Alfred server which can get the current location from gpsd, or a static location from the command line. Add a client which can display this information distributed by nodes in JSON format.
Signed-off-by Andrew Lunn <[email protected]>
Applied in revision 2b901d6.
Thanks,
Simon