コード例 #1
0
ファイル: main.cpp プロジェクト: abhinavcoder/sirius
void sendRollCommand(char ch,int pre)
{
    rollComm.preamble = pre;
    //command.info_byte = 0b00000000;
    rollComm.ch = ch;
    sPort.Write(&rollComm, sizeof(rollCommand));
}
コード例 #2
0
void RfidListener::waitForSerialData()
{
	Serial serial = Serial();
	while (serial.Init(_port) == 0)
		Sleep(200);

	serial.Write("auth");
	serial.Read();
	if (serial.DataRead.compare("0") == 0)
	{
		serial.Write("init");
		serial.Read();
		if (serial.DataRead.compare("ok") == 0)
			serial.Write("ok");
	}

	while (!_quit)	// Ends thread on end
	{
		serial.Write("check");
		serial.Read();
		if (serial.DataRead.compare("1") == 0)
		{
			serial.Write("get");
			serial.Read();

			list<Credential>::iterator it = _credentials.begin();
			for (int i = 0; i < _credentials.size(); i++)
			{
				advance(it, 0);
				if (serial.DataRead.compare(it->id) == 0)
				{
					ZeroMemory(_username, sizeof(_username));
					ZeroMemory(_password, sizeof(_password));

					wcscpy_s(_username, 1024, it->username);
					wcscpy_s(_password, 1024, it->password);
					_connected = TRUE;
					_pProvider->OnConnectStatusChanged();
					break;
				}
			}
			if (_connected)
				break;
		}
		Sleep(1000); // Wait so as no to flood the serial port
	}
}
コード例 #3
0
ファイル: main.cpp プロジェクト: abhinavcoder/sirius
void sendCommand(Robot_Config myRobot,int pre)
{
    command.preamble = pre;
    command.info_byte = 0b00000000;
    command.myRobot = myRobot;

    sPort.Write(&command, sizeof(botPacket));
}