Exemplo n.º 1
0
void Initialize()
{
    if(CAInitialize() != CA_STATUS_OK)
    {
        Serial.println("Initialize failed");
        return;
    }
    SelectNetwork();
    // set handler.
    CARegisterHandler(RequestHandler, ResponseHandler, ErrorHandler);
}
Exemplo n.º 2
0
void loop()
{
    char buffer[5] = {0};
    size_t len;
    if (Serial.available() > 0)
    {
        GetData(buffer, sizeof(buffer), &len);
        if (0 >= len)
        {
            Serial.println("i/p err");
            return;
        }
        switch (toupper(buffer[0]))
        {
            case 'M': // menu
                PrintMenu();
                break;

            case 'Q': // quit
                Serial.println("quit");
                return;

            case 'I': // Initialize interface
                Initialize();
                break;

            case 'S': // start listening server
                StartListeningServer();
                break;

            case 'D': // start discovery server
                StartDiscoveryServer();
                break;

            case 'R': // send request
                SendRequest();
                break;

            case 'E': //send request to all
                SendRequestAll();
                break;
            case 'B': // send notification
                SendNotification();
                break;
            case 'G': // Get network info
                GetNetworkInfo();
                break;

            case 'N': // select network
                SelectNetwork();
                break;

            case 'X': // unselect network
                UnselectNetwork();
                break;

            case 'H': // handle request response
                HandleRequestResponse();
                break;

            case 'T': // handle request response
                Terminate();
                break;

            default:
                Serial.println("wrong menu");
                break;
        }
    }
    //1:Add check for startserver before calling below api
    if (g_isLeSelected)
    {
        HandleRequestResponse();
    }
    delay(1000);
}
void CTestLtsyPhoneStepBase::SetAndSelectNetwork()
	{
	INFO_PRINTF1(_L("SetAndSelectNetwork() invoked......\n"));
	SetNetworkSelectionSetting();
	SelectNetwork();
	}