本文整理汇总了C++中EthernetClient::readStringUntil方法的典型用法代码示例。如果您正苦于以下问题:C++ EthernetClient::readStringUntil方法的具体用法?C++ EthernetClient::readStringUntil怎么用?C++ EthernetClient::readStringUntil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EthernetClient
的用法示例。
在下文中一共展示了EthernetClient::readStringUntil方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseRequest
bool PyrobarHTTPRequestHandler::parseRequest(EthernetClient client) {
if (client.available()) {
if(client.readStringUntil(' ') == "GET") {
if(client.read() == '/') {
String dataType = client.readStringUntil('/');
if (DEBUG_REQUEST_HANDLER) {
Serial.print("Data Type: ");
Serial.println(dataType);
}
if(dataType == pyrobarDataTypeBuffer) {
return handleBuffer(client);
} else if(dataType == pyrobarDataTypeFire) {
return handleFireSequence(client);
} else if(dataType == pyrobarDataTypeScalar) {
return handleScalar(client);
} else if(dataType == pyrobarDataTypeLights) {
return handleLightsOnOff(client);
} else {
return false;
}
}
} else {
return false;
}
}
}
示例2: handleScalar
bool PyrobarHTTPRequestHandler::handleScalar(EthernetClient client) {
// E.g. /sclr/sndSens/0.789
String scalarType = client.readStringUntil('/');
if (DEBUG_REQUEST_HANDLER) {
Serial.print("Scalar type: ");
Serial.println(scalarType);
}
float value = client.readStringUntil(' ').toFloat();
return _lightMap->setScalar(scalarType, value);
}
示例3: handleLightsOnOff
bool PyrobarHTTPRequestHandler::handleLightsOnOff(EthernetClient client) {
String type = client.readStringUntil('/');
String instruction = client.readStringUntil(' ');
if (DEBUG_REQUEST_HANDLER) {
Serial.print("Turning lights ");
Serial.println(instruction);
}
if (instruction == pyrobarLightsOut) _lightMap->turnLights(type, OFF);
else if (instruction == pyrobarLightsOn) _lightMap->turnLights(type, ON);
else return false;
return true;
}
示例4: handleBuffer
bool PyrobarHTTPRequestHandler::handleBuffer(EthernetClient client) {
// E.g. /bfr/snd/0/000001...
String bufferType = client.readStringUntil('/');
if (DEBUG_REQUEST_HANDLER) {
Serial.print("Buffer type: ");
Serial.println(bufferType);
}
if (bufferType == pyrobarBfrTypeFreq || bufferType == pyrobarBfrTypeSnd) {
int zone = atoi(client.readStringUntil('/').c_str());
if (zone < TOTAL_ZONE_COUNT) {
loadBuffer(bufferType, zone, client);
return true;
} else {
// add error notice to stream
return false;
}
}
}