//----------------------------------------------------------------------------
///
///
///
//----------------------------------------------------------------------------


#include <fosh/commands/hwdata.h>
#include <campo/hwinfo_v5.h>
#include <campo/hwinfo_v4.h>

//#include <string.h>        // memset
//#include <lepto/print.h>

int CCommandHwData::exec(int argc, const char *argv[]) const /* virtual */
{
   int container=m_pRetain->restore();
   printf("Layout version : %d\n", m_pRetain->getVersion() );
   printf("Container      : %d\n", container);
   if(container>=0)
   {
      dump( m_pRetain->getMemoryAddress() );
   }
   else
   {
      printf("Error: Could not read hwdata.\n");
      printf("       Container count: %d\n", m_pRetain->containerCount() );
   }

   return(0);
}


void CCommandHwData::printHelp() const
{
   printf("Usage: \n");
}


void CCommandHwDataV5::dump(void *data) const
{
   V5::SEepromBoardInfo *info=(V5::SEepromBoardInfo *)data;
   printf("Article ID :   0x%X\n", info->main.articleId);
   printf("Board code :   0x%X\n", info->main.boardCode);
   printf("      rev. :   0x%X\n", info->main.boardRevision);
   printf("      patch:   0x%X\n", info->main.boardPatch);
   printf("Serial no. :   " FI32 "\n", info->production.serialNumber);
   printf("Prod. year :   %d\n", info->production.dateYear);
   printf("      month:   %d\n", info->production.dateMonth);
   printf("      day  :   %d\n", info->production.dateDay);
   printf("Variant    :   %d\n", info->product.variant);

   return;
}

void CCommandHwDataV4::dump(void *data) const
{

}


//---fin----------------------------------------------------------------------
