zephyr/samples/net/nats_clients/subscriber
Anas Nashif d622b09bc0 samples: tests: remove obsolete KERNEL_TYPE and kernel variables
Remove those from Makefiles and testcase.ini, we now support unified kernel
only and sanitycheck script now knows how to deal with this.

Change-Id: I853ebcadfa7b56a4de5737d95f2ba096babb2e13
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-11-04 15:47:25 -04:00
..
src samples/net: Add network-related functions to NATS Subscriber 2016-08-01 14:31:27 -05:00
Kbuild samples/net: Add a NATS subscriber application 2016-07-28 15:40:46 +00:00
Makefile samples: tests: remove obsolete KERNEL_TYPE and kernel variables 2016-11-04 15:47:25 -04:00
README samples/net: Update README file w.r.t compiler warnings 2016-08-11 17:43:16 +00:00
prj_galileo.conf samples/net: Add a NATS subscriber application 2016-07-28 15:40:46 +00:00
testcase.ini samples/net: Add network-related functions to NATS Subscriber 2016-08-01 14:31:27 -05:00

README

NATS subscriber

This sample code demonstrates how to write a NATS subscriber sample
application.

See: http://nats.io/documentation/internals/nats-protocol/ for more
information about the NATS protocol.


Requirements
------------

* Ethernet LAN for testing purposes.

* Galileo Gen 2 Development Board.

* USB-UART cable: CH340, FTDI 6-pin or equivalent for debugging.

* NATS server, subscriber and publisher applications. See:

    http://nats.io/documentation/tutorials/gnatsd-install/
    http://nats.io/documentation/clients/nats-clients/
    https://github.com/nats-io/nats

Building instructions
---------------------

* Read src/main.c, change the IP addresses according to the LAN
  environment.

* On a terminal window, type:

    make pristine && make

* To load the binary into the Galileo Dev Board, follow the steps
  indicated here:

    https://www.zephyrproject.org/doc/board/galileo.html


Usage
-----

* Follow nats.io documentation to setup the server and client
  applications.

* Start the NATS server: open a terminal window and type:

    gnatsd -D

  The terminal window must display something like this:

    [2045] 2016/07/27 17:40:20.928840 [INF] Starting nats-server version 0.8.2
    [2045] 2016/07/27 17:40:20.928913 [DBG] Go build version go1.5.4
    [2045] 2016/07/27 17:40:20.928922 [INF] Listening for client connections on 0.0.0.0:4222
    [2045] 2016/07/27 17:40:20.929035 [DBG] Server id is X6QdoKdcVHDeWQcVIpJcb5
    [2045] 2016/07/27 17:40:20.929048 [INF] Server is ready

* Connect the USB-UART cable to the Galileo. Open a terminal and run:

  screen /dev/ttyUSB0 115200

* Connect Galileo to the LAN, Turn on the board.

* On the screen terminal window, the following text will appear:

    WARNING: no console will be available to OS
    error: no suitable video mode found.
    --------------------------------
    --------------------------------

* Run the NATS publisher client. Open a terminal window and type:

    nats-pub sensors DOOR89:CLOSED

  The terminal window will display:

    Published [sensors] : 'DOOR89:CLOSED'

* On the screen terminal window, the following message will appear:

    --------------------------------
    Subject: [7] sensors
    Sid: [2] z1
    Reply-to: not found
    Payload: [13] DOOR89:CLOSED
    --------------------------------


Final remarks
-------------

Full NATS support is not yet achieved. However, current publisher
and subscriber routines are enough to write basic NATS applications.


Compiler Warnings
-----------------

The network layer used in this sample code will be replaced once the
new IP stack is ready. So, "netz" is tagged as "deprecated" and the
following warnings will be displayed by the compiler:

warning: 'netz_tx' is deprecated [-Wdeprecated-declarations]