Kinetis Bootloader Host  2.0.0
Host Tools for Kinetis devices
blfwk::Command Class Reference

Represents a bootloader command. More...

#include <Command.h>

+ Inheritance diagram for blfwk::Command:
+ Collaboration diagram for blfwk::Command:

Public Member Functions

virtual ~Command ()
 Destructor.
 
virtual bool init ()
 Initialize. More...
 
virtual void sendTo (Packetizer &packetizer)
 Send command to packetizer and on to peripheral.
 
virtual const uint32_vector_t * getResponseValues () const
 Get response values vector.
 
virtual std::string getResponse () const
 Get response as JSON string.
 
void logResponses () const
 Log the response description.
 
void registerProgress (Progress *progress)
 initial the process callback.
 
String arguments accessors.
virtual std::string getArg (int arg) const
 Get the specified argument.
 
virtual std::string getName () const
 Get the command name (i.e. argv[0]).
 
virtual size_t getArgCount () const
 Get the number of arguments, including the command name.
 

Static Public Member Functions

static Commandcreate (const string_vector_t *argv)
 Create an appropriate command subclass. More...
 
static std::string getStatusMessage (status_t code)
 Get a status code description.
 

Public Attributes

Progressm_progress
 Variable for progress control.
 

Protected Member Functions

 Command (const string_vector_t *argv)
 Constructor that takes a command name and list of arguments. More...
 
 Command (const char *const name)
 Constructor that takes a command name. More...
 
virtual bool processResponse (const generic_response_packet_t *packet, uint8_t commandTag)
 Check generic response packet. More...
 

Protected Attributes

string_vector_t m_argv
 Vector of argument strings.
 
uint32_vector_t m_responseValues
 Vector of response values.
 
string m_responseDetails
 Descriptive response.
 

Detailed Description

Represents a bootloader command.

Do not instantiate this class. Instead, use the create() method to create the appropriate subclass based on command name in argv[0].

Constructor & Destructor Documentation

blfwk::Command::Command ( const string_vector_t *  argv)
inlineprotected

Constructor that takes a command name and list of arguments.

Parameters
argvArgument vector
blfwk::Command::Command ( const char *const  name)
inlineprotected

Constructor that takes a command name.

Parameters
nameName of the command

Member Function Documentation

Command * Command::create ( const string_vector_t *  argv)
static

Create an appropriate command subclass.

Pass the command name in argv[0] and optional arguments in the rest of the string vector. Caller is responsible for deleting the returned object.

This factory method is just a shorthand for creating a subclass directly, for example:

string_vector_t cmdv;
cmdv.push_back("my-reset");
Reset * reset = new Reset(&cmdv);
reset->init();
Command * cmd = reset;
Parameters
argvArgument vector
Return values
Commandobject
bool Command::processResponse ( const generic_response_packet_t *  packet,
uint8_t  commandTag 
)
protectedvirtual

Check generic response packet.

Parameters
packetPacket received from device
commandTagExpected command tag in packet

The documentation for this class was generated from the following files: