Skip to content
This repository has been archived by the owner on Oct 16, 2018. It is now read-only.

Sample SPoT Location Push API client code and GPB binding code generator for SPoT Push API

License

Notifications You must be signed in to change notification settings

rksg/gpb_mqtt_sample_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SPoT Push API sample client and GPB binding codes generator

MQTT client for parsing GPB message packets

The intent of this sample set of codes is to guide would-be third-party developers that intend to consume SPoT/vSPoT data via Push API over MQTT with messages packed in Google Protobuf format.

Pre-requisites to get started:

  1. A Unix compatible Operating System (Debian Wheezy, Debian Jessie, CentOS 6.6, Mac OSX 10.10, Mac OSX 10.11)
  2. Download and install a compatible JDK version 1.7 or 1.8 (OpenJDK7, Oracle JDK 1.7.0u76, OpenJDK8, etc) (http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html) [works with JDK8 as well]
  3. Download and install gradle 2.9.x (https://gradle.org/)
  4. Download and install mosquitto 1.4.x broker and client and requisite libraries (http://mosquitto.org/download/)
  5. Open firewall to ports 1883 and 8883
  6. Startup local mosquitto broker using the sample mosquitto bridge configuration file under mqtt_bridge_conf directory as a starting point (the TLS PSK connectivity is provided via MQTT bridge connection to reduce client code complexity)
  7. psk_identity in the mosquitto_bridge.conf.sample file is your venue-id (e.g. vspot, rksg-dev, etc)
  8. psk is the hexadecimal format of the MQTT Pre-shared key password you entered into your Controller (ZD or SCG) - use this site to help to convert Ascii Pre-shared key in Controller to hexadecimal version
  9. Test that you can locally subscribe to the mqtt-bridged TLS PSK connection to venue server using the mosquitto_sub utility
    1. e.g. mosquitto_sub -p 1883 -t "1.0.0/LOC/SPOT_GPB/#"
  10. You should see encoded messages streaming into your standard output terminal if the above mqtt bridge setup and topic subscription connection works

Compile Google Protobuf Binding classes or source files to begin your client development:

  1. Ensure that gradle 2.9.x is installed and configured to work with JDK7/JDK8 and that you have internet connectivity on the development machine
  2. Change directory into protobuf_bindings
  3. Issue gradle and observe that you receive no error messages in your standard output terminal
  4. Compiled binding classes / source files for C++, java and python should now be generated and available under
    1. C++ : protobuf_bindings/build/generated/cpp
    2. java : protobuf_bindings/build/generated/java
    3. python: protobuf_bindings/build/generated/python
  5. Copy the requisite technology stack GPB binding classes / source files to your Push API client project source folder (under the intended directory structure)

Compile and run sample Push API Java client:

  1. Ensure that gradle 2.9.x is installed and configured to work with JDK7 and that you have internet connectivity on the development machine
  2. Change directory into sample_clients/pushapi_sample_java_client
  3. Issue gradle and observe that you receive no error messages in your standard output terminal
  4. Compiled and executable code is available at sample_clients/pushapi_sample_java_client/build/install/pushapi_sample_java_client directory
  5. Ensure local mqtt bridged broker is setup and running (see above section "Pre-requisites to get started" - get the relevant venue server FQDN, PSK Identity and PSK to correctly bridge to the Push API MQTT publisher)
  6. Change directory to sample_clients/pushapi_sample_java_client/build/install/pushapi_sample_java_client
  7. Startup the client using bin/pushapi_sample_java_client
  8. Observe the incoming MQTT decoded GPB messages received from the Push API MQTT publisher streaming in your standard output terminal
    1. Sample data stream:
      org.fusesource.mqtt.client.Message@204f30ec
      locations {
        venue_id: "rksg-dev"
        mac: "E8802EF065CB"
        x: 0.0
        y: 0.0
        floor_number: 0
        timestamp: 1429003890
      }
      
      org.fusesource.mqtt.client.Message@e25b2fe
      locations {
        venue_id: "rksg-dev"
        mac: "FCE9982A9DB0"
        x: 1164.999
        y: 693.9553
        floor_number: 1
        timestamp: 1429003890
      }

About

Sample SPoT Location Push API client code and GPB binding code generator for SPoT Push API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published