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@6:edf306673e54, 2014-03-31 (annotated)
- Committer:
- ansond
- Date:
- Mon Mar 31 19:13:10 2014 +0000
- Revision:
- 6:edf306673e54
- Parent:
- 5:94d000e6fa70
- Child:
- 11:c4d02616e10f
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 | 5:94d000e6fa70 | 22 | // BaseClass support |
ansond | 5:94d000e6fa70 | 23 | #include "BaseClass.h" |
ansond | 0:e1c4378df3fe | 24 | |
ansond | 0:e1c4378df3fe | 25 | // NSP Transport support |
ansond | 0:e1c4378df3fe | 26 | #include "NSPTransport.h" |
ansond | 0:e1c4378df3fe | 27 | |
ansond | 0:e1c4378df3fe | 28 | // HTTP Transport support |
ansond | 0:e1c4378df3fe | 29 | #include "HTTPTransport.h" |
ansond | 0:e1c4378df3fe | 30 | |
ansond | 4:7f7fe167d9c0 | 31 | // Personality Support |
ansond | 4:7f7fe167d9c0 | 32 | #include "Personality.h" |
ansond | 0:e1c4378df3fe | 33 | |
ansond | 0:e1c4378df3fe | 34 | // Preferences Support |
ansond | 0:e1c4378df3fe | 35 | #include "Preferences.h" |
ansond | 6:edf306673e54 | 36 | |
ansond | 6:edf306673e54 | 37 | #ifndef CELLULAR_NETWORK |
ansond | 6:edf306673e54 | 38 | // MBED Ethernet Interface |
ansond | 6:edf306673e54 | 39 | #include "EthernetInterface.h" |
ansond | 6:edf306673e54 | 40 | #endif |
ansond | 0:e1c4378df3fe | 41 | |
ansond | 5:94d000e6fa70 | 42 | class MBEDEndpoint : public BaseClass { |
ansond | 0:e1c4378df3fe | 43 | private: |
ansond | 6:edf306673e54 | 44 | #ifndef CELLULAR_NETWORK |
ansond | 4:7f7fe167d9c0 | 45 | EthernetInterface *m_ethernet; // ethernet interface |
ansond | 6:edf306673e54 | 46 | #endif |
ansond | 4:7f7fe167d9c0 | 47 | Transport *m_transports[NUM_TRANSPORTS]; // our transport |
ansond | 4:7f7fe167d9c0 | 48 | Personality *m_personalities[NUM_PERSONALITY_INSTANCES]; // our personalities (at least 1 instance) |
ansond | 4:7f7fe167d9c0 | 49 | char m_endpoint_name[PERSONALITY_NAME_LEN+1]; // our endpoint name (personalities[0]) |
ansond | 4:7f7fe167d9c0 | 50 | Preferences *m_preferences; // preference support |
ansond | 4:7f7fe167d9c0 | 51 | char m_lcd_status[TEMP_BUFFER_LEN+1]; // LCD status buffer |
ansond | 4:7f7fe167d9c0 | 52 | char m_nsp_address[PREFERENCE_VALUE_LEN+1]; // NSP address buffer |
ansond | 4:7f7fe167d9c0 | 53 | int m_instance_id; // Instance ID for this endpoint |
ansond | 0:e1c4378df3fe | 54 | |
ansond | 0:e1c4378df3fe | 55 | public: |
ansond | 6:edf306673e54 | 56 | MBEDEndpoint(ErrorHandler *error_handler,void *ethernet); |
ansond | 5:94d000e6fa70 | 57 | virtual ~MBEDEndpoint(); |
ansond | 0:e1c4378df3fe | 58 | ResourceFactory *initResourceFactory(); |
ansond | 0:e1c4378df3fe | 59 | void run(); |
ansond | 0:e1c4378df3fe | 60 | |
ansond | 0:e1c4378df3fe | 61 | char *getEndpointName(); |
ansond | 0:e1c4378df3fe | 62 | char *getNSPAddress(); |
ansond | 0:e1c4378df3fe | 63 | Preferences *preferences(); |
ansond | 0:e1c4378df3fe | 64 | |
ansond | 0:e1c4378df3fe | 65 | char *getLCDStatus(); |
ansond | 0:e1c4378df3fe | 66 | |
ansond | 0:e1c4378df3fe | 67 | int getInstanceID(); |
ansond | 0:e1c4378df3fe | 68 | |
ansond | 0:e1c4378df3fe | 69 | void sendObservations(); |
ansond | 0:e1c4378df3fe | 70 | |
ansond | 0:e1c4378df3fe | 71 | private: |
ansond | 0:e1c4378df3fe | 72 | void initPreferences(); |
ansond | 0:e1c4378df3fe | 73 | void initNSPAddress(); |
ansond | 0:e1c4378df3fe | 74 | void initEndpointName(); |
ansond | 4:7f7fe167d9c0 | 75 | bool initializePersonalities(); |
ansond | 0:e1c4378df3fe | 76 | bool initializeLights(); |
ansond | 0:e1c4378df3fe | 77 | bool initializeTransport(int index,char *key,Transport *transport); |
ansond | 0:e1c4378df3fe | 78 | bool initializeTransports(); |
ansond | 4:7f7fe167d9c0 | 79 | bool closePersonalities(); |
ansond | 0:e1c4378df3fe | 80 | bool closeTransport(int index,char *key); |
ansond | 0:e1c4378df3fe | 81 | bool closeTransports(); |
ansond | 6:edf306673e54 | 82 | #ifndef CELLULAR_NETWORK |
ansond | 6:edf306673e54 | 83 | bool initializeEthernet(EthernetInterface *ethernet); |
ansond | 0:e1c4378df3fe | 84 | bool closeEthernet(); |
ansond | 6:edf306673e54 | 85 | #endif |
ansond | 0:e1c4378df3fe | 86 | }; |
ansond | 0:e1c4378df3fe | 87 | |
ansond | 0:e1c4378df3fe | 88 | #endif // _MBED_ENDPOINT_H_ |