mirror of https://github.com/ARMmbed/mbed-os.git
Adding PPP link status callback
mbed_ppp_init() is extended to take a function ptr. ppp_lwip will call this callback upon a change in ppp link status. in the beginning, the Ublox driver waits until the PPP link is established properly.pull/4119/head
parent
091396defe
commit
2abb078f27
|
@ -38,6 +38,8 @@ extern "C" { // "pppos.h" is missing extern C
|
||||||
|
|
||||||
#include "lwip_stack.h"
|
#include "lwip_stack.h"
|
||||||
|
|
||||||
|
static void (*notify_ppp_link_status_cb)(int) = 0;
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
using rtos::Thread;
|
using rtos::Thread;
|
||||||
|
@ -187,6 +189,8 @@ static void ppp_link_status(ppp_pcb *pcb, int err_code, void *ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
notify_ppp_link_status_cb(err_code);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/*
|
/*
|
||||||
* This should be in the switch case, this is put outside of the switch
|
* This should be in the switch case, this is put outside of the switch
|
||||||
|
@ -307,13 +311,11 @@ err_t ppp_lwip_if_init(struct netif *netif, FileHandle *stream)
|
||||||
return ppp_connect(my_ppp_pcb, 0);
|
return ppp_connect(my_ppp_pcb, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "drivers/BufferedSerial.h"
|
|
||||||
using mbed::BufferedSerial;
|
|
||||||
|
|
||||||
static struct netif my_ppp_netif;
|
static struct netif my_ppp_netif;
|
||||||
|
|
||||||
nsapi_error_t mbed_ppp_init(FileHandle *stream)
|
nsapi_error_t mbed_ppp_init(FileHandle *stream, void (*link_status)(int))
|
||||||
{
|
{
|
||||||
|
notify_ppp_link_status_cb = link_status;
|
||||||
mbed_lwip_init();
|
mbed_lwip_init();
|
||||||
ppp_lwip_if_init(&my_ppp_netif, stream);
|
ppp_lwip_if_init(&my_ppp_netif, stream);
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,8 @@
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
void ppp_bringup_test();
|
|
||||||
|
|
||||||
NetworkStack *mbed_ppp_get_stack();
|
NetworkStack *mbed_ppp_get_stack();
|
||||||
nsapi_error_t mbed_ppp_init(FileHandle *stream);
|
nsapi_error_t mbed_ppp_init(FileHandle *stream, void (*link_status)(int));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue