Simple interface for Mbed Cloud Client
Embed:
(wiki syntax)
Show/hide line numbers
NetworkInit.cpp
00001 /******************************************************************************* 00002 * Copyright 2016, 2017 ARM Ltd. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 *******************************************************************************/ 00016 00017 #include "mbed.h" 00018 #include "EthernetInterface.h" 00019 00020 bool dhcpDone = true; 00021 static EthernetInterface* netInterface = NULL; 00022 extern "C" { 00023 void* palTestGetNetWorkInterfaceContext(void) 00024 { 00025 nsapi_error_t status = NSAPI_ERROR_OK; 00026 if (NULL == netInterface) 00027 { 00028 netInterface = new EthernetInterface(); 00029 printf("new interface created\r\n"); 00030 status = netInterface->connect(); 00031 if (NSAPI_ERROR_OK == status) 00032 { 00033 printf("interface registered : OK \r\n"); 00034 } 00035 else //connect failed 00036 { 00037 printf("interface registered : FAILED! \r\n"); 00038 delete netInterface; 00039 netInterface = NULL; 00040 } 00041 } 00042 return netInterface; 00043 } 00044 }
Generated on Tue Jul 12 2022 19:01:35 by 1.7.2