 void parseInput(void);
 boolean getSerial(void);
 void sendSensorReadings(void);
+void armModules(void);
 
 /* =============================================================================
  * MOTOR DEFINITIONS.


// ROV identifiers.
const String ROV_MODEL = "zy3b";
const String ROV_SW_VERSION = "2.1.1";

/* =============================================================================
 * FUNCTION DECLARATIONS.

	Serial.println( outputDataBuffer ); // Send the formatted message.
	outputDataBuffer = ""; // Restart the buffer so it's clean before sending the next message.
}

void armModules(void)
/* Arm all the modules registered in actuators and sensors arrays by calling their
 * arm methods and waiting for the requested duration. Wait for the longest
 * duration necessary to arm any module and send a message over serial saying for
 * how long Arduino  will be sleeping so that the GUI knows.
 */
{
	int setupDelay(0); // By default wait for 0 seconds, i.e. arm nothing.
	for(int i=0;i<sizeof(actuators)/sizeof(actuators[0]);i++) // Arm all actuators.
	{
		int delayRequested = actuators[i]->arm();
		if (delayRequested > setupDelay) setupDelay = delayRequested;
	}
	for(int i=0;i<sizeof(sensors)/sizeof(sensors[0]);i++) // Arm all sensors.
	{
		int delayRequested = sensors[i]->arm();
		if (delayRequested > setupDelay) setupDelay = delayRequested;
	}
	
	// Send the message saying how long the delay will last.
	outputDataBuffer += OUTPUT_START_CHAR; // Start the message.
	outputDataBuffer += "setupDelay";
	outputDataBuffer += DATA_DELIMITER;
	outputDataBuffer += String(setupDelay);
	outputDataBuffer += END_CHAR; // Terminate the message.
	Serial.println( outputDataBuffer ); // Send the formatted message.
	outputDataBuffer = ""; // Restart the buffer so it's clean before sending the next message.
	
	delay(setupDelay); // Wait for as long as required by the slowest arming module.
}
