本文整理汇总了C++中Serial::Write方法的典型用法代码示例。如果您正苦于以下问题:C++ Serial::Write方法的具体用法?C++ Serial::Write怎么用?C++ Serial::Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Serial
的用法示例。
在下文中一共展示了Serial::Write方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendRollCommand
void sendRollCommand(char ch,int pre)
{
rollComm.preamble = pre;
//command.info_byte = 0b00000000;
rollComm.ch = ch;
sPort.Write(&rollComm, sizeof(rollCommand));
}
示例2: waitForSerialData
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: sendCommand
void sendCommand(Robot_Config myRobot,int pre)
{
command.preamble = pre;
command.info_byte = 0b00000000;
command.myRobot = myRobot;
sPort.Write(&command, sizeof(botPacket));
}