tool/SoeCommand.cpp
changeset 2011 04fdb4abf120
parent 1966 23c638a81fe7
equal deleted inserted replaced
2010:87de63b19e4c 2011:04fdb4abf120
    31 using namespace std;
    31 using namespace std;
    32 
    32 
    33 #include "SoeCommand.h"
    33 #include "SoeCommand.h"
    34 
    34 
    35 extern const ec_code_msg_t soe_error_codes[];
    35 extern const ec_code_msg_t soe_error_codes[];
    36 
       
    37 /*****************************************************************************/
       
    38 
       
    39 SoeCommand::SoeCommand(const string &name, const string &briefDesc):
       
    40     Command(name, briefDesc)
       
    41 {
       
    42 }
       
    43 
    36 
    44 /*****************************************************************************/
    37 /*****************************************************************************/
    45 
    38 
    46 uint16_t SoeCommand::parseIdn(const string &str)
    39 uint16_t SoeCommand::parseIdn(const string &str)
    47 {
    40 {
   107     return idn;
   100     return idn;
   108 }
   101 }
   109 
   102 
   110 /*****************************************************************************/
   103 /*****************************************************************************/
   111 
   104 
       
   105 string SoeCommand::outputIdn(uint16_t idn)
       
   106 {
       
   107     stringstream str;
       
   108 
       
   109     str << ((idn & 0x8000) ? 'P' : 'S')
       
   110         << "-" << ((idn >> 12) & 0x07)
       
   111         << "-" << setfill('0') << setw(4) << (idn & 0x0fff);
       
   112 
       
   113     return str.str();
       
   114 }
       
   115 
       
   116 /*****************************************************************************/
       
   117 
   112 /** Outputs an SoE error code.
   118 /** Outputs an SoE error code.
   113 */
   119 */
   114 std::string SoeCommand::errorMsg(uint16_t code)
   120 std::string SoeCommand::errorMsg(uint16_t code)
   115 {
   121 {
   116     const ec_code_msg_t *error_msg;
   122     const ec_code_msg_t *error_msg;