joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Mesh6LoWPAN_ND.cpp Source File

Mesh6LoWPAN_ND.cpp

00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * 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, WITHOUT
00012  * 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 /*
00018  * 6LoWPAN ND (neighbor discovery) network interface.
00019  * Class provides methods for 6LoWPAN (ND) network handling.l
00020  */
00021 
00022 #include <stdio.h>
00023 #include "mbed.h"
00024 #include "mbed-mesh-api/Mesh6LoWPAN_ND.h"
00025 #include "include/nd_tasklet.h"
00026 
00027 #define HAVE_DEBUG 1
00028 #include "ns_trace.h"
00029 
00030 #define TRACE_GROUP  "m6LND"
00031 
00032 Mesh6LoWPAN_ND::Mesh6LoWPAN_ND() : AbstractMesh(MESH_TYPE_6LOWPAN_ND)
00033 {
00034 }
00035 
00036 Mesh6LoWPAN_ND::~Mesh6LoWPAN_ND()
00037 {
00038     tr_debug("~Mesh6LoWPAN()");
00039     nd_tasklet_disconnect(false);
00040 }
00041 
00042 bool Mesh6LoWPAN_ND::getOwnIpAddress(char *address, int8_t len)
00043 {
00044     tr_debug("getOwnIpAddress()");
00045     if (nd_tasklet_get_ip_address(address, len) == 0) {
00046         return true;
00047     }
00048     return false;
00049 }
00050 
00051 bool Mesh6LoWPAN_ND::getRouterIpAddress(char *address, int8_t len)
00052 {
00053     tr_debug("getRouterIpAddress()");
00054     if (nd_tasklet_get_router_ip_address(address, len) == 0) {
00055         return true;
00056     }
00057     return false;
00058 }