mqtt specific components for the impact mbed endpoint library
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_mqtt_endpoint_nxp
Revision 46:32a7545dde45, committed 2014-07-01
- Comitter:
- ansond
- Date:
- Tue Jul 01 21:26:40 2014 +0000
- Parent:
- 45:974cd0fba897
- Child:
- 47:b775f5453b5d
- Commit message:
- made gw port configurable
Changed in this revision
--- a/IOCHTTPTransport.cpp Tue Jul 01 20:59:35 2014 +0000 +++ b/IOCHTTPTransport.cpp Tue Jul 01 21:26:40 2014 +0000 @@ -78,7 +78,7 @@ // use the GW HTTP redirector memset(this->m_url_buffer,0,IOC_REST_URL_LEN+1); - sprintf(this->m_url_buffer,GW_REDIRECT_URL,endpoint->getGWAddress()); + sprintf(this->m_url_buffer,GW_REDIRECT_URL,endpoint->getGWPort(),endpoint->getGWAddress()); } return this->m_url_buffer; }
--- a/MBEDEndpoint.cpp Tue Jul 01 20:59:35 2014 +0000 +++ b/MBEDEndpoint.cpp Tue Jul 01 21:26:40 2014 +0000 @@ -119,14 +119,19 @@ void MBEDEndpoint::initGWAddress() { memset(this->m_gw_address,0,PREFERENCE_VALUE_LEN+1); strcpy(this->m_gw_address,GW_IPADDRESS); - if (this->m_preferences != NULL) + if (this->m_preferences != NULL) { this->m_preferences->getPreference("gw_address",this->m_gw_address,PREFERENCE_VALUE_LEN,GW_IPADDRESS); - this->logger()->log("GW IP: %s",this->m_gw_address); + this->m_preferences->getPreference("gw_port",this->m_gw_port,PREFERENCE_VALUE_LEN,GW_PORT); + this->logger()->log("GW: %s:%s",this->m_gw_address,this->m_gw_port); + } } // get our GW address char *MBEDEndpoint::getGWAddress() { return this->m_gw_address; } + // get our GW Port + char *MBEDEndpoint::getGWPort() { return this->m_gw_port; } + // get our LCD status char *MBEDEndpoint::getLCDStatus() { memset(this->m_lcd_status,0,TEMP_BUFFER_LEN+1);
--- a/MBEDEndpoint.h Tue Jul 01 20:59:35 2014 +0000 +++ b/MBEDEndpoint.h Tue Jul 01 21:26:40 2014 +0000 @@ -66,6 +66,7 @@ Preferences *m_preferences; // preference support char m_lcd_status[TEMP_BUFFER_LEN+1]; // LCD status buffer char m_gw_address[PREFERENCE_VALUE_LEN+1]; // GW address buffer + char m_gw_port[PREFERENCE_VALUE_LEN+1]; // GW port buffer int m_instance_id; // instance ID for this endpoint public: @@ -83,6 +84,7 @@ char *getEndpointName(); char *getGWAddress(); + char *getGWPort(); char *getLCDStatus();
--- a/MQTTDefinitions.h Tue Jul 01 20:59:35 2014 +0000 +++ b/MQTTDefinitions.h Tue Jul 01 21:26:40 2014 +0000 @@ -24,15 +24,11 @@ // Until we get HTTPS with BasicAuth working in MBED... #define GW_IPADDRESS "192.168.1.220" // gateway IP address (default) +#define GW_PORT "8888" // gateway port (default) #define USE_GW_HTTP_REDIRECTOR true // true - make http calls to IOC via GW, false - make http calls directly to IOC -#ifdef CELLULAR_NETWORK -// Gateway REST API URL (external) -#define GW_REDIRECT_URL "http://%s:15479/NSP-IOC-Gateway/IOCRestAPI" -#else // Gateway REST API URL -#define GW_REDIRECT_URL "http://%s:8888/NSP-IOC-Gateway/IOCRestAPI" -#endif +#define GW_REDIRECT_URL "http://%s:%s/NSP-IOC-Gateway/IOCRestAPI" // Preference File Configuration #define PREFERENCES_FILE "/local/mqtt.cfg" // preferences file for endpoint