#include <map>
#include <string>
typedef std::map< std::string, CommandResponse * > CMD_RESP_MAP;
int main(void)
{
int32_t ret_value;
if( ret_value )
{
printf( "Error %d: Could not connect to destination.\n", ret_value );
return 1;
}
if( ret_value )
{
printf( "Error %d: Could not get status message list.\n", ret_value );
return 1;
}
printf(
"There are %u status messages for this destination.\n", status_list.
Size() );
for( uint32_t ii = 0; ii < status_list.
Size(); ii++ )
{
printf(
"Status Message: %s\n", status_list.
GetAt(ii) );
char info[1024];
uint32_t info_space = 1024;
pc,
info,
&info_space );
if( ret_value )
{
printf(
"Error %d: Could not retrieve status message %s.\n", ret_value, status_list.
GetAt(ii) );
}
else
{
pc.GetSortedParameterList( param_list, false );
for( uint32_t jj = 0; jj < param_list.
Size(); jj++ )
{
ret_value = pc.FindParameter( param_list.
GetAt(jj), ¶m_ptr );
if( ret_value )
printf(
"Error %d: Unexpected error when finding parameter %s.\n", ret_value, param_list.
GetAt(jj) );
else
}
}
}
if( ret_value )
{
printf( "Error %d: Could not get command response list.\n", ret_value );
return 1;
}
CMD_RESP_MAP response_map;
for( uint32_t ii = 0; ii < resp_list.Size(); ii++ )
{
*cmd_response_ptr );
if( ret_value )
{
printf( "Error %d: Could not retrieve response %s.\n", ret_value, resp_list.GetAt(ii) );
}
else
response_map[resp_list.GetAt(ii)] = cmd_response_ptr;
}
uint32_t token;
if( ret_value )
printf( "Error %d: Could not initiate command.\n", ret_value );
ret_value = api.
GetTrack( token, track_item );
if( ret_value )
printf( "Error %d: Could not track command.\n", ret_value );
else
{
{
response_item resp_item;
CMD_RESP_MAP::iterator response_map_it;
response_map_it = response_map.find( resp_item.name );
if( response_map_it != response_map.end() )
{
struct response_info resp_info;
response_map_it->second->GetErrorDetails( resp_item.value, &resp_info );
printf( "Response %s: %s.\n", resp_item.name, resp_info.info );
}
}
}
if( ret_value )
{
printf( "Error %d: API did not disconnect properly.\n", ret_value );
return 1;
}
return 0;
}