Home Software Online METAR Tool GlassPack
GlassPack Developers
As an open system, GlassPack is always looking for people to create a wonderful ecosystem of products that extend and shape GlassPack. A GlassPack Server and Simulator is available for developers to use while developing their code. Please contact Todd Osborne before you start developing your code to be setup with a development Server, the Simulator, and to make sure you are not working on things that will overlap or conflict with others. If you want to build your own GlassPack hardware, we have now published detailed instructions on how to do it. Our current software development needs are listed here.
Development Basics
  • GlassPack Core (hardware) implements a Wi-Fi access point. Devices that wish to display data published must first connect to GlassPack Core over Wi-Fi and be assigned an IP address in the 192.168.152.x range. The SSID of the GlassPack wireless network is simply "GlassPack". There is no encrption or password required to connect to GlassPack.
  • GlassPack Core (hardware) has an Ethernet port that can be connected to another network or router to allow Internet access through GlassPack; it will act as a Wi-Fi router. The IP address assigned to GlassPack's Ethernet adapter will be done using DHCP and will be dependent on the network it connects to.
  • GlassPack has a web-based Admin Control Panel that allows upgrades and simple administration. This is accessed using the URL http://192.168.152.1/Admin.
  • As a security measure, and to permit installation of software updates, the Admin Control Panel allows access ONLY if the Ethernet port is connected to a network that has Internet access.
  • GlassPack Server is software that runs on the Raspberry Pi and is what all client devices (publishers and receivers) will communicate with. It is written in C# and runs under Mono on GlassPack Core, and as a console application on Windows during development and testing. When running on Windows, it will bind to all local IP addresses, including the loopback address of 127.0.0.1. It listens only on port 80, so you must make sure that no other software on your system is using this port when attempting to run the server.
  • In developer terms, GlassPack has a construct known as a DataPoint. A DataPoint is a single unit of data, such as a value returned from a sensor, or a value created by calculation or conversion of other DataPoints. For instance, Humidity is a DataPoint that is represented by a number in the range of 1 to 100. In addition to holding a single value, DataPoints have an age, the number of seconds (and milliseconds) since the last time their value was refreshed. This can be used to determine how stale the data is, or if it should be trusted. DataPoints have a name that describe what they represent, a unique 3 (or more) letter identifier that is used throughout GlassPack.
  • Multiple similar DataPoints can be added by appending a sequential number to their name. For instance, a new external pitch sensor could be made available by using the key 'PTC2'. It will be assigned the same name as the built-in pitch DataPoint identified by PTC, but will be assigned the number 2. This is especially important for sensors, such as thermocouples, where it is common to have many of them. If the name is not provided when added to the system (see below), the name will be copied from similar DataPoints. In this example, PTC2 would be assigned the same name as PTC, which is "Pitch".
  • A list of all supported DataPoints GlassPack knows about can be retrieved by issuing a GET request like this: http://192.168.152.1/Get?ALL&Age=T&Name=T. If only physical sensor data is desired, as opposed to synthetic data, the following request can be issued: http://192.168.152.1/Get?PHY&Age=T&Name=T. The URL parameter 'Age=T' instructs GlassPack to return the age of each DataPoint (T just means 'True'). The parameter 'Name=T' instructs it to also return the friendly name. The format of returned data is JSON. To render a page that has all DataPoints displayed in text format, use http://192.168.152.1/all. A web request without any parameters will generate the default instrumentation page.
  • To get the value of a single DataPoint, you issue a HTTP GET request using the unique ID, or key, of the DataPoint. To get just the inside humidity for example, this would work: http://192.168.152.1/Get?IHM. The returned JSON data will be as follows: {"Key":"IHM","Value":"55"} which shows the humidity to be 55%. Additional information about the humidity can be retrieved by adding a request for the Age and Name to the URL, as follows: http://192.168.152.1/Get?IHMP&Age=T&Name=T. This requested will return JSON such as: {"Key":"IHMP","Value":"35","Age":"2.126","Name":"Inside Humidity","Units"}. This shows the inside humidity at 55% and the value was last updated 2.126 seconds ago.
  • To get the value of multiple DataPoints, you issue a HTTP GET request using multiple unique IDs, or keys, of the DataPoints separated by an &. To get both the inside and outside humidity for example, this would work: http://192.168.152.1/Get?IHM&OHM. The returned JSON data will be as follows: [{"Key":"IHMP","Value":"55"},{"Key":"OHMP","Value":"65"}] which is an array of values that show the inside humidity to be 55% and outside humidity of 65%.
  • If you are going to make multiple requests for the same DataPoints, it is more efficient to request a data key to use in place of DataPoint identifiers. To create a data key, using the URL http://192.168.152.1/GetDataKey?IHM&OHM where all of the DataPoints needed are specified in the request, in the format described above. The return value from this call will be a unique number that can be used in future requests for the same data. For instance, if this call returns '1', future requests for the same data (inside and outside humidity), can be shortened to just http://192.168.152.1/Get?1. If the call to GetDataKey return any value other than an integer, it will be a string that describes the error that was generated. Data request keys are only valid while GlassPack is running. As soon as the server is restarted, the keys are no longer valid.
  • If a device is authorized to publish data, it can do so using a nearly identical method. Instead of 'Get' being specified on the URL, 'Set' is used instead, like this: http://192.168.152.1/Set?IHM=35. This will return a plain text result of 'OK' if the value was saved. Any string other than 'OK' describes the error that was generated.
  • Multiple DataPoints can be set with a single HTTP request as follows: http://192.168.152.1/Set?IHM=35&OHM=45. This will set both the inside and outside humidity values and return a plain text result of 'OK' if the values were saved. Any string other than 'OK' describes the error that was generated.
  • New DataPoints can be added using the 'Set' syntax above. The first time a 'Set' command is received that does not name a DataPoint that already exists, it will be created and added to the system. The first time you add a new DataPoint to the system, you should make sure to include a clear, but concise, name for your DataPoint. DataPoints added via HTTP are only kept until GlassPack is restarted, they are not preserved. The display name of the DataPoint can be set via HTTP by appending a * to the value, followed by the name. For instance, to create a new DataPoint with the name of the 'MyDataPointName' the following could be used: http://192.168.152.1/Set?MYDP=MyValue*MyDataPointName. The display name can only be set when the DataPoint is first created, so the above URL syntax would only be used once. Future calls to update the value should omit the name since it will be ignored.