Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ivan-odinets/StreamCommand

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamCommand

Library for standartization of communication between arduino and other devices.

Tested with Serial and WiFiClient objects. In theory it should also work with all subclasses of Stream class.

Usage

  • void addCommand(const char* name,void (*f)()) - register handler for command "name". Must be called once for each command in setup() function.

  • void handleChanges(Stream* stream = &Serial) - check if stream has new data, if yes - parse it and execute correct command. Must be called in loop() function.

  • char* next() - get arguments for command. Returns NULL if cmd line is completely parsed. Should be called from command handlers.

Reponses with built-in prefixes.

  • printError(const char* message) - prints message with error prefix.
  • printInfo(const char* message) - prints message with info prefix.
  • printResponse(const char* message) - prints message with response prefix.
  • printOk() - prints simple confirmation message.

Moreover StreamCommand supports usual print() and println() functions.

Responses are printed to stream from which command was recieved. So it is possible to setup common command line interface for Serial and Telnet communication.

Installation:

About

Arduino library for parsing commands recieved from other devices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • C++ 88.0%
  • C 12.0%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.