SNIC UART Interface library: Serial to Wi-Fi library for Murata TypeYD Wi-Fi module. For more information about TypeYD: http://www.murata.co.jp/products/microwave/module/lbwb1zzydz/index.html
Dependents: SNIC-xively-jumpstart-demo SNIC-FluentLogger-example TCPEchoServer murataDemo ... more
Fork of YDwifiInterface by
Diff: YDwifi/YDwifiUartCommand.cpp
- Revision:
- 2:0ba43344c814
- Child:
- 3:9f90024d7fb2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/YDwifi/YDwifiUartCommand.cpp Tue Mar 11 10:38:36 2014 +0000
@@ -0,0 +1,78 @@
+#include "YDwifiUartCommand.h"
+
+using namespace murata_wifi;
+
+void C_YDwifiUartCommand::setCommandID( unsigned char cmd_id )
+{
+ mCommandID = cmd_id;
+}
+
+unsigned char C_YDwifiUartCommand::getCommandID()
+{
+ return mCommandID;
+}
+
+void C_YDwifiUartCommand::setCommandSID( unsigned char cmd_sid )
+{
+ mCommandSID = cmd_sid;
+}
+
+unsigned char C_YDwifiUartCommand::getCommandSID()
+{
+ return mCommandSID;
+}
+
+void C_YDwifiUartCommand::setCommandStatus( unsigned char status )
+{
+ mCommandStatus = status;
+}
+
+unsigned char C_YDwifiUartCommand::getCommandStatus()
+{
+ return mCommandStatus;
+}
+
+void C_YDwifiUartCommand::setResponseBuf( unsigned char *buf_p )
+{
+ mResponseBuf_p = buf_p;
+}
+
+unsigned char *C_YDwifiUartCommand::getResponseBuf()
+{
+ return mResponseBuf_p;
+}
+
+
+int C_YDwifiUartCommand::wait()
+{
+ int ret = 0;
+ // Get thread ID
+ mCommandThreadID = osThreadGetId();
+
+ // Signal flags that are reported as event are automatically cleared.
+ osEvent event_ret = osSignalWait( UART_COMMAND_SIGNAL, UART_COMMAND_WAIT_TIMEOUT);
+ if( event_ret.status != osEventSignal )
+ {
+ ret = -1;
+ }
+ return ret;
+}
+
+int C_YDwifiUartCommand::signal()
+{
+ // set signal
+ return osSignalSet(mCommandThreadID, UART_COMMAND_SIGNAL);;
+}
+
+bool C_YDwifiUartCommand::isWaitingCommand( unsigned int command_id, unsigned char *payload_p )
+{
+ bool ret = false;
+
+ if( (command_id == getCommandID())
+ && (payload_p[0] == (getCommandSID() | 0x80) ) )
+ {
+ ret = true;
+ }
+ return ret;
+}
+
muRata

Murata TypeYD