Separate library that holds helper functions for the main OMF code.
osisoft-omf.h@1:1c31b413ba0c, 2018-02-02 (annotated)
- Committer:
- danielelopez
- Date:
- Fri Feb 02 17:54:05 2018 +0000
- Revision:
- 1:1c31b413ba0c
- Parent:
- 0:6156b29d3c91
- Child:
- 8:e5fe40b77f8f
Updated to add additional constants and function for not reusing sockets
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
danielelopez | 0:6156b29d3c91 | 1 | //Copyright 2017 OSIsoft, LLC |
danielelopez | 0:6156b29d3c91 | 2 | // |
danielelopez | 0:6156b29d3c91 | 3 | //Licensed under the Apache License, Version 2.0 (the "License"); |
danielelopez | 0:6156b29d3c91 | 4 | //you may not use this file except in compliance with the License. |
danielelopez | 0:6156b29d3c91 | 5 | //You may obtain a copy of the License at |
danielelopez | 0:6156b29d3c91 | 6 | // |
danielelopez | 0:6156b29d3c91 | 7 | //<http://www.apache.org/licenses/LICENSE-2.0> |
danielelopez | 0:6156b29d3c91 | 8 | // |
danielelopez | 0:6156b29d3c91 | 9 | //Unless required by applicable law or agreed to in writing, software |
danielelopez | 0:6156b29d3c91 | 10 | //distributed under the License is distributed on an "AS IS" BASIS, |
danielelopez | 0:6156b29d3c91 | 11 | //WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
danielelopez | 0:6156b29d3c91 | 12 | //See the License for the specific language governing permissions and |
danielelopez | 0:6156b29d3c91 | 13 | //limitations under the License. |
danielelopez | 0:6156b29d3c91 | 14 | |
danielelopez | 0:6156b29d3c91 | 15 | #ifndef OSISOFT_OMF_H |
danielelopez | 0:6156b29d3c91 | 16 | #define OSISOFT_OMF_H |
danielelopez | 0:6156b29d3c91 | 17 | |
danielelopez | 0:6156b29d3c91 | 18 | #include "mbed.h" |
danielelopez | 0:6156b29d3c91 | 19 | #include "https_request.h" |
danielelopez | 0:6156b29d3c91 | 20 | |
danielelopez | 0:6156b29d3c91 | 21 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 22 | // Helper function that casts floats into strings |
danielelopez | 0:6156b29d3c91 | 23 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 24 | |
danielelopez | 0:6156b29d3c91 | 25 | string OMFLib_float_to_string(float f); |
danielelopez | 0:6156b29d3c91 | 26 | |
danielelopez | 0:6156b29d3c91 | 27 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 28 | // Helper function that sends an actual web request |
danielelopez | 0:6156b29d3c91 | 29 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 30 | |
danielelopez | 0:6156b29d3c91 | 31 | void OMFLib_sendMessageToEndpoint(TLSSocket* socket, const char* action, const char* message_type, const char* body); |
danielelopez | 0:6156b29d3c91 | 32 | |
danielelopez | 0:6156b29d3c91 | 33 | // ************************************************************************ |
danielelopez | 1:1c31b413ba0c | 34 | // Helper function that sends an actual web request; does not reuse sockets |
danielelopez | 1:1c31b413ba0c | 35 | // ************************************************************************ |
danielelopez | 1:1c31b413ba0c | 36 | |
danielelopez | 1:1c31b413ba0c | 37 | void OMFLib_sendMessageToEndpoint_NoSocketReuse(NetworkInterface* network, const char* action, const char* message_type, const char* body); |
danielelopez | 1:1c31b413ba0c | 38 | |
danielelopez | 1:1c31b413ba0c | 39 | // ************************************************************************ |
danielelopez | 1:1c31b413ba0c | 40 | // Helper function: prints out an HTTP response |
danielelopez | 1:1c31b413ba0c | 41 | // ************************************************************************ |
danielelopez | 1:1c31b413ba0c | 42 | |
danielelopez | 1:1c31b413ba0c | 43 | void OMFLib_dump_response(HttpResponse* res); |
danielelopez | 1:1c31b413ba0c | 44 | |
danielelopez | 1:1c31b413ba0c | 45 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 46 | // Gets the current time in the appropriate OMF format |
danielelopez | 0:6156b29d3c91 | 47 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 48 | |
danielelopez | 0:6156b29d3c91 | 49 | string OMFLib_getCurrentTimeString(); |
danielelopez | 0:6156b29d3c91 | 50 | |
danielelopez | 0:6156b29d3c91 | 51 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 52 | // Sets the clock via NTP via the nwtwork |
danielelopez | 0:6156b29d3c91 | 53 | // ************************************************************************ |
danielelopez | 0:6156b29d3c91 | 54 | |
danielelopez | 0:6156b29d3c91 | 55 | void OMFLib_syncClockViaNTP(NetworkInterface* network); |
danielelopez | 0:6156b29d3c91 | 56 | |
danielelopez | 0:6156b29d3c91 | 57 | #endif |