/* Set new host name, use mdns_iface_state_change(interface, REANNOUNCE) to anounce the new host name.  */
int32_t MX_WIFI_MDNS_set_hostname(MX_WIFIObject_t *Obj, char *hostname)
/* Set new host name, use mdns_iface_state_change(interface, REANNOUNCE) to anounce the new host name.  */
int32_t MX_WIFI_MDNS_set_hostname(MX_WIFIObject_t *Obj, char *hostname)
{
  int32_t ret = MX_WIFI_STATUS_ERROR;
  mdns_set_hostname_cparams_t cparams;
  int32_t status = MIPC_CODE_ERROR;
  uint16_t out_size = sizeof(status);
  if (NULL == Obj)
  {
    ret = MX_WIFI_STATUS_PARAM_ERROR;
  }
  else
  {
    memset(&cparams, 0, sizeof(cparams));
    strncpy(cparams.hostname, hostname, MDNS_MAX_LABEL_LEN);
    if (MIPC_CODE_SUCCESS == mipc_request(MIPC_API_MDNS_SET_HOSTNAME_CMD,
                                          (uint8_t *)&cparams, sizeof(cparams),
                                          (uint8_t *)&status, &out_size,
                                          MX_WIFI_CMD_TIMEOUT))
    {
      if (MIPC_CODE_SUCCESS == status)
      {
        ret = MX_WIFI_STATUS_OK;
      }
    }
  }
  return ret;
}