Updated non-blocking connect changes to EMAC greentea test server

pull/6847/head
Mika Leppänen 2018-04-27 09:25:43 +03:00 committed by Kevin Bracey
parent 82b2a27a1c
commit d9a66f1c54
2 changed files with 33 additions and 7 deletions

View File

@ -125,6 +125,17 @@ EmacTestNetworkStack::Interface::Interface()
} }
void EmacTestNetworkStack::Interface::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
{
}
nsapi_connection_status_t EmacTestNetworkStack::Interface::get_connection_status() const
{
return NSAPI_STATUS_ERROR_UNSUPPORTED;
}
char *EmacTestNetworkStack::Interface::get_mac_address(char *buf, nsapi_size_t buflen) char *EmacTestNetworkStack::Interface::get_mac_address(char *buf, nsapi_size_t buflen)
{ {
return NULL; return NULL;
@ -145,7 +156,7 @@ char *EmacTestNetworkStack::Interface::get_gateway(char *buf, nsapi_size_t bufle
return NULL; return NULL;
} }
nsapi_error_t EmacTestNetworkStack::Interface::bringup(bool dhcp, const char *ip, const char *netmask, const char *gw, const nsapi_ip_stack_t stack) nsapi_error_t EmacTestNetworkStack::Interface::bringup(bool dhcp, const char *ip, const char *netmask, const char *gw, const nsapi_ip_stack_t stack, bool blocking)
{ {
if (!emac_if_init()) { if (!emac_if_init()) {
TEST_ASSERT_MESSAGE(0, "emac initialization failed!"); TEST_ASSERT_MESSAGE(0, "emac initialization failed!");

View File

@ -49,15 +49,14 @@ public:
* @param netmask Net mask to be used for the interface as "W:X:Y:Z" or NULL * @param netmask Net mask to be used for the interface as "W:X:Y:Z" or NULL
* @param gw Gateway address to be used for the interface as "W:X:Y:Z" or NULL * @param gw Gateway address to be used for the interface as "W:X:Y:Z" or NULL
* @param stack Allow manual selection of IPv4 and/or IPv6. * @param stack Allow manual selection of IPv4 and/or IPv6.
* @param blocking Specify whether bringup blocks for connection completion.
* @return NSAPI_ERROR_OK on success, or error code * @return NSAPI_ERROR_OK on success, or error code
*/ */
virtual nsapi_error_t bringup(bool dhcp, const char *ip, virtual nsapi_error_t bringup(bool dhcp, const char *ip,
const char *netmask, const char *gw, const char *netmask, const char *gw,
nsapi_ip_stack_t stack nsapi_ip_stack_t stack = DEFAULT_STACK,
#ifdef __cplusplus bool blocking = true
= DEFAULT_STACK );
#endif
);
/** Disconnect interface from the network /** Disconnect interface from the network
* *
@ -67,6 +66,22 @@ public:
*/ */
virtual nsapi_error_t bringdown(); virtual nsapi_error_t bringdown();
/** Register callback for status reporting
*
* The specified status callback function will be called on status changes
* on the network. The parameters on the callback are the event type and
* event-type dependent reason parameter.
*
* @param status_cb The callback for status changes
*/
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
/** Get the connection status
*
* @return The connection status according to ConnectionStatusType
*/
virtual nsapi_connection_status_t get_connection_status() const;
/** Return MAC address of the network interface /** Return MAC address of the network interface
* *
* @return MAC address as "V:W:X:Y:Z" * @return MAC address as "V:W:X:Y:Z"