diff options
author | 2017-03-21 23:52:22 +0100 | |
---|---|---|
committer | 2017-03-22 10:26:36 +0000 | |
commit | 2d16ddb2623249d3cbdde89288ae047416b62cb6 (patch) | |
tree | 9d56493cf776e63609cadb0c958a60681a6e986e /icnet/ccnx | |
parent | e1bda5c0821c3aae2e1609ba752fdb9f06a6dfb4 (diff) |
Adding android support
Change-Id: Id8d0aaf61e6576209a8e329aa26cb73113832296
Signed-off-by: Mauro Sardara <msardara+fdio@cisco.com>
Diffstat (limited to 'icnet/ccnx')
-rw-r--r-- | icnet/ccnx/icnet_ccnx_local_connector.cc | 19 | ||||
-rw-r--r-- | icnet/ccnx/icnet_ccnx_portal.cc | 11 |
2 files changed, 29 insertions, 1 deletions
diff --git a/icnet/ccnx/icnet_ccnx_local_connector.cc b/icnet/ccnx/icnet_ccnx_local_connector.cc index 2a47c117..efe995cc 100644 --- a/icnet/ccnx/icnet_ccnx_local_connector.cc +++ b/icnet/ccnx/icnet_ccnx_local_connector.cc @@ -13,8 +13,13 @@ * limitations under the License. */ +#ifdef __ANDROID__ +#include <android/log.h> +#endif + #include "icnet_ccnx_local_connector.h" + namespace icnet { namespace ccnx { @@ -131,7 +136,11 @@ void LocalConnector::doReadHeader() { void LocalConnector::tryReconnect() { if (!is_connecting_) { +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Connection lost. Trying to reconnect...\n"); +#else std::cerr << "Connection lost. Trying to reconnect..." << std::endl; +#endif is_connecting_ = true; is_reconnection_ = true; io_service_.post([this]() { @@ -158,7 +167,11 @@ void LocalConnector::doConnect() { if (is_reconnection_) { is_reconnection_ = false; - std::cout << "Connection recovered!" << std::endl; +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Connection recovered!\n"); +#else + std::cout << "Connection recovered!" << std::endl; +#endif for (auto &name : served_name_list_) { bind(name); } @@ -184,7 +197,11 @@ void LocalConnector::handleDeadline(const boost::system::error_code &ec) { if (!ec) { io_service_.post([this]() { socket_.close(); +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Error connecting. Is the forwarder running?\n"); +#else std::cerr << "Error connecting. Is the forwarder running?" << std::endl; +#endif io_service_.stop(); }); } diff --git a/icnet/ccnx/icnet_ccnx_portal.cc b/icnet/ccnx/icnet_ccnx_portal.cc index 99e2ee7f..33e8c82f 100644 --- a/icnet/ccnx/icnet_ccnx_portal.cc +++ b/icnet/ccnx/icnet_ccnx_portal.cc @@ -12,6 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#ifdef __ANDROID__ +#include <android/log.h> +#endif #include "icnet_ccnx_portal.h" @@ -135,9 +138,17 @@ void Portal::processControlMessage(CCNxMetaMessage *response) { CCNxControl *control_message = ccnxMetaMessage_GetControl(response); if (ccnxControl_IsACK(control_message)) { +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Route set correctly!\n"); +#else std::cout << "Route set correctly!" << std::endl; +#endif } else { +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_DEBUG, "libICNet", "Failed to set the route.\n"); +#else std::cout << "Failed to set the route." << std::endl; +#endif } } |