SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 62 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"


36 Why We Need Model-Based Analysis
// ... continued
bool ResetEnabled()
{
return (cevent == ControlEvent.Timeout && waitfor == WaitFor.Timeout
&& sensor == Sensor.Error);
}
void Reset()
{
Console.WriteLine(" Reset");
ResetSensor(); // send reset command to sensor
StartTimer(MessageTimeout); // wait for response from sensor
waitfor = WaitFor.Message;
}
bool PollEnabled()
{
return (cevent == ControlEvent.Timeout && waitfor == WaitFor.Timeout
&& sensor == Sensor.OK);
}
void Poll()
{
Console.WriteLine(" Poll");
PollSensor(); // send poll command to sensor
StartTimer(MessageTimeout); // wait for response from sensor
waitfor = WaitFor.Message;
}
bool CalibrateEnabled()
{
return (cevent == ControlEvent.Command && waitfor == WaitFor.Timeout
&& sensor == Sensor.OK);
}
void Calibrate()
{
Console.WriteLine(" Calibrate ??™{0}??™", buffer);
double data = Double.Parse(buffer);
// compute with data (not shown)
}
// to be continued ...
Figure 3.3. Process controller class with dispatcher and handlers (2).
Overview 37
// ... continued
bool CheckMessageEnabled()
{
return (cevent == ControlEvent.Message && waitfor == WaitFor.Message);
}
void CheckMessage()
{
double tol = 5.0;
Console.Write(" CheckMessage ??™{0}??™", buffer);
try {
double data = Double.Parse(buffer);
if (previous == Double.MaxValue) previous = data; // initialize
Console.


Pages:
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6