示例#1
0
文件: tests.cpp 项目: PetRover/rTests
    void testWifiSendCommandNoMessage(const char* ipAddressLocal, const char* ipAddressRemote)
    {
        NetworkManager* ourNetworkManager = new NetworkManager;
        ourNetworkManager->initializeNewConnection("USBSocket", ipAddressLocal, ipAddressRemote, 1024, ConnectionInitType::CONNECT, ConnectionProtocol::TCP);

        //make and fill command with data
        Command *ourCommand = new Command;
        ourCommand->setCommandType(CommandType::DRIVE_BACKWARD);

        //turn command into NetworkChunk
        NetworkChunk* ourNetworkChunk = new NetworkChunk;
        *ourNetworkChunk = ourCommand->toNetworkChunk();

        //send NetworkChunk
        ourNetworkManager->sendData("USBSocket", ourNetworkChunk);
    }
示例#2
0
文件: tests.cpp 项目: PetRover/rTests
    void testWifiSendText(const char* ipAddressLocal, const char* ipAddressRemote)
    {
        NetworkManager* ourNetworkManager = new NetworkManager;
        ourNetworkManager->initializeNewConnection("USBSocket", ipAddressLocal, ipAddressRemote, 1024, ConnectionInitType::CONNECT, ConnectionProtocol::TCP);

        //make and fill text with data
        Text *ourTextMessage = new Text;
        ourTextMessage->setLength(10);
        char message[100] = "YESSSSS!!!";
        ourTextMessage->setTextMessage(message);

        //turn command into NetworkChunk
        NetworkChunk* ourNetworkChunk = new NetworkChunk;
        *ourNetworkChunk = ourTextMessage->toNetworkChunk();

        //send NetworkChunk
        ourNetworkManager->sendData("USBSocket", ourNetworkChunk);
    }
示例#3
0
文件: tests.cpp 项目: PetRover/rTests
    void testWifiSendStatus(const char* ipAddressLocal, const char* ipAddressRemote)
    {
        NetworkManager* ourNetworkManager = new NetworkManager;
        ourNetworkManager->initializeNewConnection("USBSocket", ipAddressLocal, ipAddressRemote, 1024, ConnectionInitType::CONNECT, ConnectionProtocol::TCP);

        //make and fill status with data
        Status *ourStatus = new Status;
        ourStatus->setStatusType(StatusType::NOT_CHARGING);
        char message[100] = "YES!";
        ourStatus->setStatusData(message);

        //turn status into NetworkChunk
        NetworkChunk* ourNetworkChunk = new NetworkChunk;
        *ourNetworkChunk = ourStatus->toNetworkChunk();

        //send NetworkChunk
        ourNetworkManager->sendData("USBSocket", ourNetworkChunk);
    }