// DESCRIPTION: // * Tests the numMixer object with the passed state. // * Pings the numMixer and prints returned values, if it succeeds. // // PRECONDITIONS: // * numMixerObj must not be null. // * numMixerObj must have a dataset containing the requested parity. // // POSTCONDITIONS: // * numMixer may no longer be active. static void testParity(numMixer numMixerObj, numMixer.OutputController parity, ref StreamWriter sw) { if (parity == numMixerObj.getControllerState()) { writeHeader("PING " + numMixerObj.getControllerStateName(), ref sw); sw.WriteLine("State change failed (already set)."); } else { numMixerObj.setControllerState(parity); writeHeader("PING " + numMixerObj.getControllerStateName(), ref sw); sw.WriteLine("State set to {0}.", numMixerObj.getControllerStateName()); } }
// DESCRIPTION: // * Lets the client know how the state of the seerObj has changed. // // PRECONDITIONS: // * seerObj must not be null. static void pingMixer(numMixer numMixerObj, numMixer.OutputController parity, ref StreamWriter sw) { testParity(numMixerObj, parity, ref sw); const int SIZE = 10; int[] pingedData = new int[SIZE]; if (numMixerObj.ping(ref pingedData)) { sw.WriteLine("Ping successful ({0} elements requested):", SIZE); for (int i = 0; i < pingedData.Length; i++) { sw.WriteLine(pingedData[i]); } } else { sw.WriteLine("Ping failed."); } sw.WriteLine("\r\n"); }