nsp specific components for the NSP version of the impact endpoint
Dependents: mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet mbed_nsp_endpoint_nxp
MBEDEndpoint.h@5:94d000e6fa70, 2014-03-28 (annotated)
- Committer:
- ansond
- Date:
- Fri Mar 28 17:53:14 2014 +0000
- Revision:
- 5:94d000e6fa70
- Parent:
- 4:7f7fe167d9c0
- Child:
- 6:edf306673e54
updates
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:e1c4378df3fe | 1 | /* Copyright C2013 Doug Anson, MIT License |
ansond | 0:e1c4378df3fe | 2 | * |
ansond | 0:e1c4378df3fe | 3 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
ansond | 0:e1c4378df3fe | 4 | * and associated documentation files the "Software", to deal in the Software without restriction, |
ansond | 0:e1c4378df3fe | 5 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
ansond | 0:e1c4378df3fe | 6 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
ansond | 0:e1c4378df3fe | 7 | * furnished to do so, subject to the following conditions: |
ansond | 0:e1c4378df3fe | 8 | * |
ansond | 0:e1c4378df3fe | 9 | * The above copyright notice and this permission notice shall be included in all copies or |
ansond | 0:e1c4378df3fe | 10 | * substantial portions of the Software. |
ansond | 0:e1c4378df3fe | 11 | * |
ansond | 0:e1c4378df3fe | 12 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
ansond | 0:e1c4378df3fe | 13 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
ansond | 0:e1c4378df3fe | 14 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
ansond | 0:e1c4378df3fe | 15 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
ansond | 0:e1c4378df3fe | 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
ansond | 0:e1c4378df3fe | 17 | */ |
ansond | 0:e1c4378df3fe | 18 | |
ansond | 0:e1c4378df3fe | 19 | #ifndef _MBED_ENDPOINT_H_ |
ansond | 0:e1c4378df3fe | 20 | #define _MBED_ENDPOINT_H_ |
ansond | 0:e1c4378df3fe | 21 | |
ansond | 0:e1c4378df3fe | 22 | // MBED Ethernet Interface |
ansond | 0:e1c4378df3fe | 23 | #include "EthernetInterface.h" |
ansond | 0:e1c4378df3fe | 24 | |
ansond | 5:94d000e6fa70 | 25 | // BaseClass support |
ansond | 5:94d000e6fa70 | 26 | #include "BaseClass.h" |
ansond | 0:e1c4378df3fe | 27 | |
ansond | 0:e1c4378df3fe | 28 | // NSP Transport support |
ansond | 0:e1c4378df3fe | 29 | #include "NSPTransport.h" |
ansond | 0:e1c4378df3fe | 30 | |
ansond | 0:e1c4378df3fe | 31 | // HTTP Transport support |
ansond | 0:e1c4378df3fe | 32 | #include "HTTPTransport.h" |
ansond | 0:e1c4378df3fe | 33 | |
ansond | 4:7f7fe167d9c0 | 34 | // Personality Support |
ansond | 4:7f7fe167d9c0 | 35 | #include "Personality.h" |
ansond | 0:e1c4378df3fe | 36 | |
ansond | 0:e1c4378df3fe | 37 | // Preferences Support |
ansond | 0:e1c4378df3fe | 38 | #include "Preferences.h" |
ansond | 0:e1c4378df3fe | 39 | |
ansond | 5:94d000e6fa70 | 40 | class MBEDEndpoint : public BaseClass { |
ansond | 0:e1c4378df3fe | 41 | private: |
ansond | 4:7f7fe167d9c0 | 42 | EthernetInterface *m_ethernet; // ethernet interface |
ansond | 4:7f7fe167d9c0 | 43 | Transport *m_transports[NUM_TRANSPORTS]; // our transport |
ansond | 4:7f7fe167d9c0 | 44 | Personality *m_personalities[NUM_PERSONALITY_INSTANCES]; // our personalities (at least 1 instance) |
ansond | 4:7f7fe167d9c0 | 45 | char m_endpoint_name[PERSONALITY_NAME_LEN+1]; // our endpoint name (personalities[0]) |
ansond | 4:7f7fe167d9c0 | 46 | Preferences *m_preferences; // preference support |
ansond | 4:7f7fe167d9c0 | 47 | char m_lcd_status[TEMP_BUFFER_LEN+1]; // LCD status buffer |
ansond | 4:7f7fe167d9c0 | 48 | char m_nsp_address[PREFERENCE_VALUE_LEN+1]; // NSP address buffer |
ansond | 4:7f7fe167d9c0 | 49 | int m_instance_id; // Instance ID for this endpoint |
ansond | 0:e1c4378df3fe | 50 | |
ansond | 0:e1c4378df3fe | 51 | public: |
ansond | 0:e1c4378df3fe | 52 | MBEDEndpoint(ErrorHandler *error_handler,EthernetInterface *ethernet); |
ansond | 5:94d000e6fa70 | 53 | virtual ~MBEDEndpoint(); |
ansond | 0:e1c4378df3fe | 54 | ResourceFactory *initResourceFactory(); |
ansond | 0:e1c4378df3fe | 55 | void run(); |
ansond | 0:e1c4378df3fe | 56 | |
ansond | 0:e1c4378df3fe | 57 | char *getEndpointName(); |
ansond | 0:e1c4378df3fe | 58 | char *getNSPAddress(); |
ansond | 0:e1c4378df3fe | 59 | Preferences *preferences(); |
ansond | 0:e1c4378df3fe | 60 | |
ansond | 0:e1c4378df3fe | 61 | char *getLCDStatus(); |
ansond | 0:e1c4378df3fe | 62 | |
ansond | 0:e1c4378df3fe | 63 | int getInstanceID(); |
ansond | 0:e1c4378df3fe | 64 | |
ansond | 0:e1c4378df3fe | 65 | void sendObservations(); |
ansond | 0:e1c4378df3fe | 66 | |
ansond | 0:e1c4378df3fe | 67 | private: |
ansond | 0:e1c4378df3fe | 68 | void initPreferences(); |
ansond | 0:e1c4378df3fe | 69 | void initNSPAddress(); |
ansond | 0:e1c4378df3fe | 70 | void initEndpointName(); |
ansond | 4:7f7fe167d9c0 | 71 | bool initializePersonalities(); |
ansond | 0:e1c4378df3fe | 72 | bool initializeLights(); |
ansond | 0:e1c4378df3fe | 73 | bool initializeTransport(int index,char *key,Transport *transport); |
ansond | 0:e1c4378df3fe | 74 | bool initializeTransports(); |
ansond | 0:e1c4378df3fe | 75 | bool initializeEthernet(EthernetInterface *ethernet); |
ansond | 4:7f7fe167d9c0 | 76 | bool closePersonalities(); |
ansond | 0:e1c4378df3fe | 77 | bool closeTransport(int index,char *key); |
ansond | 0:e1c4378df3fe | 78 | bool closeTransports(); |
ansond | 0:e1c4378df3fe | 79 | bool closeEthernet(); |
ansond | 0:e1c4378df3fe | 80 | }; |
ansond | 0:e1c4378df3fe | 81 | |
ansond | 0:e1c4378df3fe | 82 | #endif // _MBED_ENDPOINT_H_ |