本文整理汇总了C++中FormData::GetRotations方法的典型用法代码示例。如果您正苦于以下问题:C++ FormData::GetRotations方法的具体用法?C++ FormData::GetRotations怎么用?C++ FormData::GetRotations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FormData
的用法示例。
在下文中一共展示了FormData::GetRotations方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MyDoPost
/* Name: MyDoPost
* Description: This the handler for post requests that come into
* our web server
* Inputs: int sock represents the file descriptor that we use to
* communicate with the client
* char * url is the complete URL of the POST destination
* char * pData is the data portion of the post request
* char * rxBuffer is the complete HTTP request
* Outputs: Always returns 0
*/
int MyDoPost( int sock, char *url, char *pData, char *rxBuffer )
{
// Insert your post request handling here
char* data;
char* key;
char* value;
char* error;
char* saveData;
char* saveKey;
char* wrongData;
BYTE run = 0;
data = strtok_r(pData, "&", &saveData);
do {
key = strtok_r(data, "=", &saveKey);
value = strtok_r(NULL, "=", &saveKey);
if(strcmp("MAX_RPM", key) == 0)
myData.SetErrorMaxRPM(myData.SetMaxRPM(value));
else if(strcmp("MIN_RPM", key) == 0)
myData.SetErrorMinRPM(myData.SetMinRPM(value));
else if(strcmp("ROTATIONS", key) == 0)
myData.SetErrorRotations(myData.SetRotations(value));
else if(strcmp("DIRECTION", key) == 0) {
myData.SetDirection(value);
iprintf(" %i", myData.GetDirection());
}
else if(strcmp("ECE315_form", key) == 0)
if(strcmp("validate_me", value) == 0)
run = 1;
iprintf("%s, %s\n", key, value);
} while((data = strtok_r(NULL, "&",&saveData)) != NULL);
// We have to respond to the post with a new HTML page...
// In this case we will redirect so the browser will
//go to that URL for the response...
if(myData.GetMaxRPM() < myData.GetMinRPM()) {
myData.SetErrorMaxRPM(FORM_ERROR);
myData.SetErrorMinRPM(FORM_ERROR);
}
if(run == 1 && myData.GetErrorMaxRPM() == FORM_OK
&& myData.GetErrorMinRPM() == FORM_OK && myData.GetErrorRotations() == FORM_OK) {
int steps;
switch(myData.GetMode()) {
case ECE315_ETPU_SM_HALF_STEP_MODE:
steps = myData.GetRotations() * STEPS_PER_REV_HALF_STEP;
break;
case ECE315_ETPU_SM_FULL_STEP:
steps = myData.GetRotations() * STEPS_PER_REV_FULL_STEP;
break;
default:
steps = 0;
break;
}
myStepper.SetStartPeriodUsingRPM(myData.GetMinRPM());
myStepper.SetSlewPeriodUsingRPM(myData.GetMaxRPM());
switch(myData.GetDirection()) {
case CW:
OSQPost(&lcdQueue, (void *) "w");
myStepper.Step(steps);
break;
case CCW:
OSQPost(&lcdQueue, (void *)"c");
myStepper.Step(steps* -1);
break;
}
}
else {
OSQPost(&lcdQueue, (void *) "s");
myStepper.Stop();
}
iprintf("MAX_RPM: %i\n", myData.GetMaxRPM());
iprintf("MIN_RPM: %i\n", myData.GetMinRPM());
iprintf("ROTATIONS: %i\n", myData.GetRotations());
iprintf("DIRECTION: %i\n", myData.GetDirection());
RedirectResponse( sock, "INDEX.HTM" );
return 0;
//.........这里部分代码省略.........