/***************************************************************************** * * exosite_meta_defaults * * \param None * * \return None * * \brief Writes default meta values to NV memory. Erases existing meta * information! * *****************************************************************************/ void exosite_meta_defaults(void) { const unsigned char meta_server_ip[6] = {173,255,209,28,0,80}; exoHAL_EraseMeta(); //erase the information currently in meta exosite_meta_write((unsigned char *)meta_server_ip, 6, META_SERVER); //store server IP exosite_meta_write((unsigned char *)EXOMARK, META_MARK_SIZE, META_MARK); //store exosite mark return; }
/***************************************************************************** * * update_m2ip * * \param None * * \return None * * \brief Checks /ip API to see if a new server IP address should be used * *****************************************************************************/ void update_m2ip(void) { char ipbuf[6]; if (exoHAL_dns(STR_M2_HOST, ipbuf)) exosite_meta_write((unsigned char *)ipbuf, 6, META_SERVER); //store server IP return; }
/***************************************************************************** * * Exosite_SetCIK * * \param pointer to CIK * * \return None * * \brief Programs a new CIK to flash / non volatile * *****************************************************************************/ void Exosite_SetCIK(char * pCIK) { if (!exosite_initialized) { status_code = EXO_STATUS_INIT; return; } exosite_meta_write((unsigned char *)pCIK, CIK_LENGTH, META_CIK); status_code = EXO_STATUS_OK; return; }
/***************************************************************************** * * 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; }
/***************************************************************************** * * Exosite_SetMRF * * \param char *buffer, int length * * \return None * * \brief Programs a new MRF structure to flash / non volatile * *****************************************************************************/ void Exosite_SetMRF(char *buffer, int length) { exosite_meta_write((unsigned char *)buffer, length, META_MFR); }