Skip to content

Commit 942209e

Browse files
Mika Leppänenkjbracey
authored andcommitted
Updated non-blocking connect changes to EMAC greentea test server
1 parent 2162257 commit 942209e

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

TESTS/network/emac/emac_TestNetworkStack.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,17 @@ EmacTestNetworkStack::Interface::Interface()
125125

126126
}
127127

128+
129+
void EmacTestNetworkStack::Interface::attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb)
130+
{
131+
132+
}
133+
134+
nsapi_connection_status_t EmacTestNetworkStack::Interface::get_connection_status() const
135+
{
136+
return NSAPI_STATUS_ERROR_UNSUPPORTED;
137+
}
138+
128139
char *EmacTestNetworkStack::Interface::get_mac_address(char *buf, nsapi_size_t buflen)
129140
{
130141
return NULL;
@@ -145,7 +156,7 @@ char *EmacTestNetworkStack::Interface::get_gateway(char *buf, nsapi_size_t bufle
145156
return NULL;
146157
}
147158

148-
nsapi_error_t EmacTestNetworkStack::Interface::bringup(bool dhcp, const char *ip, const char *netmask, const char *gw, const nsapi_ip_stack_t stack)
159+
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)
149160
{
150161
if (!emac_if_init()) {
151162
TEST_ASSERT_MESSAGE(0, "emac initialization failed!");

TESTS/network/emac/emac_TestNetworkStack.h

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,14 @@ class EmacTestNetworkStack : public OnboardNetworkStack, private mbed::NonCopyab
4949
* @param netmask Net mask to be used for the interface as "W:X:Y:Z" or NULL
5050
* @param gw Gateway address to be used for the interface as "W:X:Y:Z" or NULL
5151
* @param stack Allow manual selection of IPv4 and/or IPv6.
52+
* @param blocking Specify whether bringup blocks for connection completion.
5253
* @return NSAPI_ERROR_OK on success, or error code
5354
*/
5455
virtual nsapi_error_t bringup(bool dhcp, const char *ip,
55-
const char *netmask, const char *gw,
56-
nsapi_ip_stack_t stack
57-
#ifdef __cplusplus
58-
= DEFAULT_STACK
59-
#endif
60-
);
56+
const char *netmask, const char *gw,
57+
nsapi_ip_stack_t stack = DEFAULT_STACK,
58+
bool blocking = true
59+
);
6160

6261
/** Disconnect interface from the network
6362
*
@@ -67,6 +66,22 @@ class EmacTestNetworkStack : public OnboardNetworkStack, private mbed::NonCopyab
6766
*/
6867
virtual nsapi_error_t bringdown();
6968

69+
/** Register callback for status reporting
70+
*
71+
* The specified status callback function will be called on status changes
72+
* on the network. The parameters on the callback are the event type and
73+
* event-type dependent reason parameter.
74+
*
75+
* @param status_cb The callback for status changes
76+
*/
77+
virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
78+
79+
/** Get the connection status
80+
*
81+
* @return The connection status according to ConnectionStatusType
82+
*/
83+
virtual nsapi_connection_status_t get_connection_status() const;
84+
7085
/** Return MAC address of the network interface
7186
*
7287
* @return MAC address as "V:W:X:Y:Z"

0 commit comments

Comments
 (0)