/*!
    \brief Get the domain Name

    \param[in]      domain_name - Pointer to the string to store domain name

    \return         None

    \note

    \warning        Domain name is used only in AP mode.
*/
static _i32 get_domain_name (_u8 *domain_name)
{
    _u8 len = MAX_DOMAIN_NAME_LEN;
    _i32 status = -1;

    status = sl_NetAppGet(SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME,
                 &len, (_u8 *)domain_name);
    ASSERT_ON_ERROR(status);

    domain_name[len] = '\0';

    return SUCCESS;
}
/*!
    \brief Get the device URN

    \param[in]      device_urn - Pointer to the string to store device urn

    \return         None

    \note

    \warning
*/
static _i32 get_device_urn (_u8 *device_urn)
{
    _u8 len = MAX_DEVICE_URN_LEN;
    _i32 status = -1;

    status = sl_NetAppGet(SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN,
                 &len, (_u8 *) device_urn);
    ASSERT_ON_ERROR(status);

    device_urn[len] = '\0';

    return SUCCESS;
}
/*!
    \brief Get the authentication realm

    \param[in]      auth_realm - Pointer to the string to store authentication
                    realm

    \return         None

    \note

    \warning
*/
static _i32 get_auth_realm (_u8 *auth_realm)
{
    _u8 len = MAX_AUTH_REALM_LEN;
    _i32 status = -1;

    status = sl_NetAppGet(SL_NET_APP_HTTP_SERVER_ID, NETAPP_SET_GET_HTTP_OPT_AUTH_REALM,
                 &len, (_u8 *) auth_realm);
    ASSERT_ON_ERROR(status);

    auth_realm[len] = '\0';

    return SUCCESS;
}
/*!
    \brief Get the authentication password

    \param[in]      auth_password - Pointer to the string to store
                    authentication password

    \return         None

    \note

    \warning
*/
static _i32 get_auth_password (_u8 *auth_password)
{
    _u8 len = MAX_AUTH_PASSWORD_LEN;
    _i32 status = -1;

    status = sl_NetAppGet(SL_NET_APP_HTTP_SERVER_ID, NETAPP_SET_GET_HTTP_OPT_AUTH_PASSWORD,
                                                &len, (_u8 *) auth_password);
    ASSERT_ON_ERROR(status);

    auth_password[len] = '\0';

    return SUCCESS;
}
/*!
    \brief Get the authentication user name

    \param[in]      auth_name - Pointer to the string to store authentication
                    name

    \return         None

    \note

    \warning
*/
static _i32 get_auth_name (_u8 *auth_name)
{
    _u8 len = MAX_AUTH_NAME_LEN;
    _i32 status = -1;

    status = sl_NetAppGet(SL_NET_APP_HTTP_SERVER_ID, NETAPP_SET_GET_HTTP_OPT_AUTH_NAME,
                 &len, (_u8 *) auth_name);
    ASSERT_ON_ERROR(status);

    auth_name[len] = '\0';

    return SUCCESS;
}
unsigned long CC3200Helpers_ProfileConnect(char *pszDeviceName, unsigned short wMaxNameLength)
{
  int iResult;
  unsigned char byLength = (unsigned char)wMaxNameLength;
  long lRetVal = 0;
  unsigned long dwResult;
  dwResult = cc3200helpers_startIn(ROLE_STA);
  if ( dwResult )
  {
    return dwResult;
  }
  if ( !cc3200helpers_isProfileConfigured(0) )
  {
    return cc3200Helpers_ProfileNotConfigured;
  }
  if ( pszDeviceName && wMaxNameLength )
  {
    lRetVal = sl_NetAppGet (SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, &byLength, (_u8 *)pszDeviceName);
  }
  return dwResult;
}
Beispiel #7
0
//*****************************************************************************
//! registermDNSService
//!
//! Registers the mDNS Service
//!
//!
//****************************************************************************
int registermDNSService()
{
	uint8_t iretvalmDNS;
	uint8_t i;

	// Obtain the device name
	sl_NetAppGet(SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, (unsigned char *)strlen((const char *)lightConfig.deviceName), lightConfig.deviceName);
	//sl_NetAppGet(SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, strlen((const char *)lightConfig.deviceName), lightConfig.deviceName);


	// Convert  to ASCII
	char  lightCountChar[4];
	sprintf(lightCountChar, "%d", lightConfig.lightCount);
	char  icTypeChar[1];
	sprintf(icTypeChar, "%d", lightConfig.icType);
	char  protocolTypeChar[1];
	sprintf(protocolTypeChar, "%d", lightConfig.protocolType);
	char  colorTypeChar[1];
	sprintf(colorTypeChar, "%d", lightConfig.colorOrder);
	char  bitCountChar[2];
	sprintf(bitCountChar, "%d", lightConfig.bitCount);

	// Create mDNS Service Name
	for (i = 0; i < 40; i++)
		mdnsServiceName[i] = 0x00;

	strcat(mdnsServiceName, (const char *)lightConfig.deviceName);
	strcat(mdnsServiceName, MDNS_SERVICE);

	// Create mDNS Text
	for (i = 0; i < 70; i++)
		mdnsText[i] = 0x00;

	char * macAddress = getMacAddress();

	strcat(mdnsText, "mac=");
	strcat(mdnsText, macAddress);
	strcat(mdnsText, ";ver=");
	strcat(mdnsText, DEVICE_VERSION);
	strcat(mdnsText, ";man=");
	strcat(mdnsText, DEVICE_MANUFACTURE);
	strcat(mdnsText, ";mod=");
	strcat(mdnsText, DEVICE_MODEL);
	strcat(mdnsText, ";l=");
	strcat(mdnsText, (const char *)lightCountChar);
	strcat(mdnsText, ";it=");
	strcat(mdnsText, (const char *)icTypeChar);
	strcat(mdnsText, ";pt=");
	strcat(mdnsText, (const char *)protocolTypeChar);
	strcat(mdnsText, ";ct=");
	strcat(mdnsText, (const char *)colorTypeChar);
	strcat(mdnsText, ";bc=");
	strcat(mdnsText, (const char *)bitCountChar);
	strcat(mdnsText, "\0");

	int strSvrLength = strlen(mdnsServiceName);
	int strTxtLength = strlen(mdnsText);

	//Registering for the mDNS service.
	iretvalmDNS = sl_NetAppMDNSUnRegisterService((const signed char *)mdnsServiceName,strlen(mdnsServiceName));

	iretvalmDNS = sl_NetAppMDNSRegisterService((const signed char *)mdnsServiceName,strlen(mdnsServiceName),
			(const signed char *)mdnsText,strlen(mdnsText)+1, UDPPORT, TTL, UNIQUE_SERVICE);

	if(iretvalmDNS == 0)
	{
		System_printf("MDNS Registration successful\n");
	}
	else
	{
		System_printf("MDNS Registered failed\n");

	}
	System_flush();

	return iretvalmDNS;
}
Beispiel #8
0
//*****************************************************************************
//! getApDomainName
//!
//! Returns the Access Point Domain Name as a string
//!
//****************************************************************************
char * getApDomainName()
{
	static char strDomainName[35];
	sl_NetAppGet (SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME, (unsigned char *)strlen(strDomainName), (unsigned char *)strDomainName);
	return strDomainName;
}
Beispiel #9
0
//*****************************************************************************
//! getDeviceName
//!
//! Returns the Device Name as a string
//!
//****************************************************************************
char * getDeviceName()
{
	static char strDeviceName[35];
	sl_NetAppGet (SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, (unsigned char *)strlen(strDeviceName), (unsigned char *)strDeviceName);
	return strDeviceName;
}