Skip to content

Commit

Permalink
Removed obsolete vscp-server code
Browse files Browse the repository at this point in the history
  • Loading branch information
grodansparadis committed May 20, 2022
1 parent 40173c8 commit af63657
Show file tree
Hide file tree
Showing 9 changed files with 572 additions and 1,787 deletions.
580 changes: 234 additions & 346 deletions common/vscp-firmware-level2.c

Large diffs are not rendered by default.

541 changes: 290 additions & 251 deletions common/vscp-firmware-level2.h

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions common/vscp-firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ low end hardware device.
*/


#include <vscp_compiler.h> // This file should be in your project folder
#include <vscp_projdefs.h> // This file should be in your project folder
#include "vscp_compiler.h" // This file should be in your project folder
#include "vscp_projdefs.h" // This file should be in your project folder
#include <inttypes.h>

// Macros
Expand Down
74 changes: 37 additions & 37 deletions common/vscp-link-protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ vscp_link_parser(const void* pdata, const char* cmd)
{
const char* p = cmd;
const char* pcmd;
static lastcmd[128] = {0};
static char lastcmd[128] = {0};

// Check pointers
if ((NULL == pdata) || (NULL == cmd)) {
Expand All @@ -978,8 +978,8 @@ vscp_link_parser(const void* pdata, const char* cmd)
if ('+' == *p) {
pcmd = lastcmd;
// print out the repeat command for convinience to user
vscp_link_callback_writeClient(pdata, lastcmd);
vscp_link_callback_writeClient(pdata, "\r\n");
vscp_link_callback_write_client(pdata, lastcmd);
vscp_link_callback_write_client(pdata, "\r\n");
}
else {
// Save command
Expand All @@ -989,42 +989,42 @@ vscp_link_parser(const void* pdata, const char* cmd)
}

/*
* ENABLE_RCVLOOP_CMD bRcvLoop = ENABLE_RCVLOOP_CMD | !bRcvLoop
* VSCP_LINK_ENABLE_RCVLOOP_CMD bRcvLoop = VSCP_LINK_ENABLE_RCVLOOP_CMD | !bRcvLoop
* 0 0 = 0 | 1 = 1
* 0 1 = 0 | 0 = 0
* 1 0 = 1 | 1 = 1
* 1 1 = 1 | 0 = 1
*/

if (NULL != (p = vscp_link_stristr(pcmd, "help")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
if (NULL != (p = vscp_link_stristr(pcmd, "help")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdHelp(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "noop")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "noop")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdNoop(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "user")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "user")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdUser(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "pass")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "pass")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdPassword(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "challenge")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "challenge")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 9;
return vscp_link_doCmdChallenge(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "send")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "send")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdSend(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "retr")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "retr")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdRetrieve(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "rcvloop")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "rcvloop")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdRcvLoop(pdata, p);
}
Expand All @@ -1036,103 +1036,103 @@ vscp_link_parser(const void* pdata, const char* cmd)
p += 4;
return vscp_link_doCmdQuit(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "cdta")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "cdta")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdCheckData(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "chkdata")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "chkdata")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdCheckData(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "clra")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "clra")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdClearAll(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "clrall")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "clrall")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 6;
return vscp_link_doCmdClearAll(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "stat")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "stat")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdStatistics(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "info")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "info")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdInfo(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "chid")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "chid")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdGetChannelId(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "getchid")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "getchid")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdGetChannelId(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "sgid")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "sgid")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdSetGUID(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "setguid")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "setguid")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdSetGUID(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "ggid")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "ggid")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdGetGUID(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "getguid")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "getguid")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdGetGUID(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "vers")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "vers")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdGetVersion(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "version")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "version")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdGetVersion(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "sflt")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "sflt")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdSetFilter(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "setfilter")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "setfilter")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 9;
return vscp_link_doCmdSetFilter(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "smsk")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "smsk")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdSetMask(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "setmask")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "setmask")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdSetMask(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "test")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "test")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdTest(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "wcyd")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "wcyd")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 4;
return vscp_link_doCmdWhatCanYouDo(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "whatcanyoudo")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "whatcanyoudo")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 12;
return vscp_link_doCmdWhatCanYouDo(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "+")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "+")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 1;
return vscp_link_doCmdCommandAgain(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "interface")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "interface")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 9;
return vscp_link_doCmdInterface(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "shutdown")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "shutdown")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 8;
return vscp_link_doCmdShutdown(pdata, p);
}
else if (NULL != (p = vscp_link_stristr(pcmd, "restart")) && (ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
else if (NULL != (p = vscp_link_stristr(pcmd, "restart")) && (VSCP_LINK_ENABLE_RCVLOOP_CMD || !bRcvLoop)) {
p += 7;
return vscp_link_doCmdRestart(pdata, p);
}
Expand Down
11 changes: 8 additions & 3 deletions common/vscp-link-protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ int
vscp_link_deleteEvent(vscpEvent** pev);

///////////////////////////////////////////////////////////////////////////////
// Command handlers
// Command handlers
///////////////////////////////////////////////////////////////////////////////

/**
Expand Down Expand Up @@ -605,6 +605,9 @@ int
vscp_link_doCmdRestart(const void* pdata, const char* cmd);





///////////////////////////////////////////////////////////////////////////////
// Callbacks
///////////////////////////////////////////////////////////////////////////////
Expand All @@ -613,7 +616,6 @@ vscp_link_doCmdRestart(const void* pdata, const char* cmd);




// Send welcome message for new connection. This can be a multiline reponse and
// the only requirement on the response is that the last line should be "+OK\r\n"
int
Expand Down Expand Up @@ -931,4 +933,7 @@ vscp_link_callback_shutdown(const void* pdata);
*/

int
vscp_link_callback_restart(const void* pdata);
vscp_link_callback_restart(const void* pdata);


// ============ END OF CALLBACKS ============
Loading

0 comments on commit af63657

Please sign in to comment.