コード例 #1
0
/*****************************************************************************
*
* Exosite_Init
*
*  \param  char * vendor - vendor name
*          char * model  - model name
*          char if_nbr   - network interface
*          int reset     - reset the settings to Exosite default
*
*  \return 1 success; 0 failure
*
*  \brief  Initializes the Exosite meta structure, UUID and
*          provision information
*
*****************************************************************************/
int
Exosite_Init(const char *vendor, const char *model, const unsigned char if_nbr, int reset)
{
  char struuid[EXOSITE_SN_MAXLENGTH];
  unsigned char uuid_len = 0;

  uuid_len = exoHAL_ReadUUID(if_nbr, (unsigned char *)struuid);

  if (0 == uuid_len)
  {
    status_code = EXO_STATUS_BAD_UUID;
    return 0;
  }
//  if (strlen(vendor) > EXOSITE_VENDOR_MAXLENGTH)
//  {
//    status_code = EXO_STATUS_BAD_VENDOR;
//    return 0;
//  }
//  if (strlen(model) > EXOSITE_MODEL_MAXLENGTH)
//  {
//    status_code = EXO_STATUS_BAD_MODEL;
//    return 0;
//  }

  // read UUID into 'sn'
  info_assemble(vendor, model, struuid);

  exosite_initialized = 1;

  status_code = EXO_STATUS_OK;

  return 1;
}
コード例 #2
0
ファイル: exosite.c プロジェクト: jfs2389/CC3200CloudDemo
/*****************************************************************************
*
* Exosite_Init
*
*  \param  char * vendor - vendor name
*          char * model  - model name
*          char if_nbr   - network interface
*          int reset     - reset the settings to Exosite default
*
*  \return 1 success; 0 failure
*
*  \brief  Initializes the Exosite meta structure, UUID and
*          provision information
*
*****************************************************************************/
int
Exosite_Init(const char *vendor, const char *model, const unsigned char if_nbr, int reset)
{
  char struuid[EXOSITE_SN_MAXLENGTH];
  unsigned char uuid_len = 0;

  exosite_meta_init(reset);          //always initialize Exosite meta structure
  uuid_len = exoHAL_ReadUUID(if_nbr, struuid);

  if (0 == uuid_len)
  {
    status_code = EXO_STATUS_BAD_UUID;
    return 0;
  }
  if (strlen(vendor) > EXOSITE_VENDOR_MAXLENGTH)
  {
    status_code = EXO_STATUS_BAD_VENDOR;
    return 0;
  }
  if (strlen(model) > EXOSITE_MODEL_MAXLENGTH)
  {
    status_code = EXO_STATUS_BAD_MODEL;
    return 0;
  }

  exosite_meta_write((unsigned char *)struuid, uuid_len, META_UUID);

  // read UUID into 'sn'
  info_assemble(vendor, model, struuid);

  exosite_initialized = 1;

  status_code = EXO_STATUS_OK;

  return 1;
}