This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088

Dependents:   MbedFileServer_1768MiniDK2 RedWireBridge IssueDebug_gcc MiMicRemoteMCU-for-Mbed ... more

Embed: (wiki syntax)

« Back to documentation index

ModWebSocket Class Reference

ModWebSocket Class Reference

This class is Websocket module. More...

#include <ModWebSocket.h>

Inherits MiMic::ModBaseClass.

Public Member Functions

bool execute (HttpdConnection &i_connection)
 This function executes websocket negotiation to the current connection.
bool write (const void *i_tx_buf, int i_tx_size)
 Write data to websocket stream.
bool writeFormat (const char *i_fmt,...)
 This function sends data to websocket stream.
int read (void *i_rx_buf, int i_rx_size)
 This function receives data from websocket stream.
void close ()
 This function terminates websocket connection.
bool canRead ()
 This function returns read function status.

Private Member Functions

virtual bool canHandle (HttpdConnection &i_connection)
 URLとパスプレフィクスi_pathを比較して、処理対象のURLかを計算します。 URLに'/i_path/'を含むパスを処理対象とみなします。

Detailed Description

This class is Websocket module.

The class provides 3 services.

  • d.xml - a device description.
  • control/xx - soap handler
  • event/xx -event handler.

Definition at line 21 of file ModWebSocket.h.


Member Function Documentation

bool canRead (  )

This function returns read function status.

This is to confirm that "read" can call without blocking.

Returns:
true if can be call "read" with no-wait. otherwise, "read" might be wait.

Definition at line 88 of file ModWebSocket.cpp.

void close (  )

This function terminates websocket connection.

Should be called if execute function successful.

Definition at line 96 of file ModWebSocket.cpp.

bool execute ( HttpdConnection &  i_connection )

This function executes websocket negotiation to the current connection.

Should be handle websocket session if function successful.

Returns:
true if negotiation successful;otherwishe false.

Definition at line 32 of file ModWebSocket.cpp.

int read ( void *  i_rx_buf,
int  i_rx_size 
)

This function receives data from websocket stream.

Returns:
  • r<0 Error. The socket already closed.
  • r==0 Timeout. The connection is continued.
  • r>0 Success. Received data size.
If an Error found, application should be call close and exit handler.

Definition at line 80 of file ModWebSocket.cpp.

bool write ( const void *  i_tx_buf,
int  i_tx_size 
)

Write data to websocket stream.

Returns:
true if successful;otherwishe false and connection closed.

Definition at line 59 of file ModWebSocket.cpp.

bool writeFormat ( const char *  i_fmt,
  ... 
)

This function sends data to websocket stream.

Parameters:
i_fmtprintf like format text.
...argument list for i_fmt

Definition at line 69 of file ModWebSocket.cpp.