Text for Web Sequence Diagrams and Class Diagrams for SeabirdGPCTD
(see https://www.websequencediagrams.com/# or http://yuml.me/diagram/scruffy/class/draw)

1. Static class digram

// Class diagram for SeabirdGPCTD (maybe too much detail)

[SBGPCTDProgram|+SBGPCTDProgram();+~SBGPCTDProgram();+Initialize();+Shutdown();+SendCommand();|-GPSSampleHandlerAsSample();-OnCommandCompleted();-OnSample();-OnSerialNumber();-OnTelemetryChanged();]
[SBGPCTDController|+SBGPCTDController();+~SBGPCTDController();+Initialize();+Shutdown();+ConfigureBlockReporting();+GetSensorPtr();+GetPersistSettings();+GetSettings();+GetStatus();+IsOxygenInstalled();+SavePersistentSettings();+SetPower();+StartSampling();+StopSampling();+sampleReport;+serialNumberReport;+sampleTelemetryChange;|-OnAsynchronousSample();-OnGPSSampleEvent();-OnRawReceive();-OnRawSend();-OnShutdownEvent();-ParseCommand();-GetDefaultOutputFormatter();|-Background();-StartupStage2();-IsO2Installed();-GetSerialNumber();]
[SBGPCTDSensor|+SBGPCTDSensor();+~SBGPCTDSensor();+Initialize();+Shutdown();+EnterQuiescentMode();+EstablishComms();+GetConfigurationData();+GetDisplayStatus();+GetDisplayCalibration();+GetHarwareData();+GetLastSample();+GetLastPressureSample();+GetStatusData();+IsInitialized();+IsPowered();+IsPowerStateKnown();+ResetLogging();+SampleNow();+SampleNowNoPump();+SamplePressureNow();+SendLowLevelCommand();+SetAutoRun();+SetAutoSamplingInterval();+SetAutoSamplingMinConductivity();+SetAutoSamplingRealtimeTransmit();+SetCustomPumpMode();+SetOxygenInstalled();+SetPump();+SetSampleNumber();+SetTime();+SetPower();+StartAutonomousSampling();+StopAutonomousSampling();+UploadHeaders();+UploadSamples();+asynchronousSample;+rawSend;+rawReceive;|-OnAsynchronousData();-OnSerialReceive();-SendCommand();-TryComms();-CheckLogging();-ChangeBaudRates();-VerifyReacting();-DoWrite();-DoThrow();-ClosePort();-OpenPort();-EstablishCommsIfPortClosed();]
[SBGPCTDControllerBase0|+ConfigureBlockReporting();+GetSensorPtr();+GetPersistSettings();+GetSettings();+GetStatus();+IsOxygenInstalled();+SavePersistentSettings();+SetPower();+StartSampling();+StopSampling();]
[IObjectBroker]^-[ObjectBroker]
[Logger]^-[StdOutLogger]
[BoilerplateCORBAServer<>]settings->[SBGPCTDProgramSettings]
[BoilerplateCORBAServer<>]prog->[SBGPCTDProgram]
[BoilerplateCORBAServer<>]logger->[StdOutLogger]
[BoilerplateCORBAServer<>]broker->[ObjectBroker]
[BoilerplateCORBAServer<>]theServer->[ISensorWithEvents_tie<SBGPCTDProgram>]
[ISensorWithEvents_tie<SBGPCTDProgram>]->[SBGPCTDProgram]
[BoilerplateCORBAServer<>]pmClient->[PayloadManagerClient]
[SBGPCTDProgram]pmClient->[PayloadManagerClient]
[SBGPCTDProgram]logger->[Logger]
[SBGPCTDProgram]broker->[IObjectBroker]
[SBGPCTDProgram]settings->[SBGPCTDProgramSettings]
[SBGPCTDProgram]ctrl-0..1>[SBGPCTDController]
[SensorProgram]^-[SBGPCTDProgram]
[SensorProgram]->[SensorProgramSettings]
[EventTransceiver]^-[SensorProgram]
[ICommandableBase]^-[SensorProgram]
[SBGPCTDController]settings->[SBGPCTDControllerSettings]
[SBGPCTDController]persist->[SBGPCTDControllerPersistSettings{bg:yellow}]
[SBGPCTDController]sensorPtr-0..1>[SBGPCTDSensor]
[SBGPCTDController]csvSamples->[CSVSampleFileSet]
[SensorController<>]^-[SBGPCTDController]
[SBGPCTDControllerBase0]^-[SensorController<>]
[SensorControllerBase<>]^-[SBGPCTDControllerBase0]
[SBGPCTDSensor]settings->[SBGPCTDSensorSettings]
[SBGPCTDSensor]logger->[Logger]
[SBGPCTDSensor]serialPort-0..1>[ISerialPort]
[ISerialPort]^-[SerialPort]
[SBGPCTDSensor]serialListener-0..1>[SerialListener]
[EventTransceiver]->[EventTransceiverSettings]
[PayloadManagerClient]->[EventTransceiver]
[SBGPCTDProgramSettings]<>[SensorProgramSettings]
[SBGPCTDProgramSettings]<>[SBGPCTDControllerSettings]
[SBGPCTDControllerSettings]<>[FileSetSettings]
[SBGPCTDControllerSettings]<>[SBGPCTDSensorSettings]
[SBGPCTDSensorSettings]<>[SerialListenerSettings]
[SBGPCTDSensorSettings]<>[SerialPortSettings]
[SerialListener]->[ISerialPort]
[SerialListener]uses-.->[SerialListenerSettings]
[SensorController<>]broker->[IObjectBroker]
[SensorController<>]logger->[Logger]
[SensorController<>]cmdOutputFormatterCF->[CmdOutputFormatterCF]
[SensorController<>]commandQueue-0..1>[CommandQueue]
[SBGPCTDController]creates-.->[SBGPCTDAutoRunCmd]
[SBGPCTDController]creates-.->[SBGPCTDExpertCmd]
[SBGPCTDController]creates-.->[SBGPCTDGetStatusCmd]
[SBGPCTDController]creates-.->[SBGPCTDLoggingCmd]
[SBGPCTDController]creates-.->[SBGPCTDPowerCmd]
[SBGPCTDController]creates-.->[SBGPCTDStartCmd]
[SBGPCTDController]creates-.->[SBGPCTDStopCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDAutoRunCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDExpertCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDGetStatusCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDLoggingCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDPowerCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDStartCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDStopCmd]
[SBGPCTDAutoRunCmd]->[SBGPCTDControllerBase0]
[SBGPCTDExpertCmd]->[SBGPCTDControllerBase0]
[SBGPCTDGetStatusCmd]->[SBGPCTDControllerBase0]
[SBGPCTDLoggingCmd]->[SBGPCTDControllerBase0]
[SBGPCTDPowerCmd]->[SBGPCTDControllerBase0]
[SBGPCTDStartCmd]->[SBGPCTDControllerBase0]
[SBGPCTDStopCmd]->[SBGPCTDControllerBase0]

// Class diagram for SeabirdGPCTD (simplified overview)

[SBGPCTDProgram{bg:yellow}]
[SBGPCTDController{bg:yellow}]
[SBGPCTDSensor{bg:yellow}]
[SBGPCTDControllerBase0{bg:yellow}]
[SBGPCTDProgramSettings{bg:yellow}]
[SBGPCTDControllerPersistSettings{bg:yellow}]
[SBGPCTDControllerSettings{bg:yellow}]
[SBGPCTDSensorSettings{bg:yellow}]
[IObjectBroker]^-[ObjectBroker]
[Logger]^-[StdOutLogger]
[BoilerplateCORBAServer<>]settings->[SBGPCTDProgramSettings]
[BoilerplateCORBAServer<>]prog->[SBGPCTDProgram]
[BoilerplateCORBAServer<>]logger->[StdOutLogger]
[BoilerplateCORBAServer<>]broker->[ObjectBroker]
[BoilerplateCORBAServer<>]theServer->[ISensorWithEvents_tie<SBGPCTDProgram>]
[ISensorWithEvents_tie<SBGPCTDProgram>]->[SBGPCTDProgram]
[BoilerplateCORBAServer<>]pmClient->[PayloadManagerClient]
[SBGPCTDProgram]pmClient->[PayloadManagerClient]
[SBGPCTDProgram]logger->[Logger]
[SBGPCTDProgram]broker->[IObjectBroker]
[SBGPCTDProgram]settings->[SBGPCTDProgramSettings]
[SBGPCTDProgram]ctrl-0..1>[SBGPCTDController]
[SensorProgram]^-[SBGPCTDProgram]
[SensorProgram]->[SensorProgramSettings]
[EventTransceiver]^-[SensorProgram]
[ICommandableBase]^-[SensorProgram]
[SBGPCTDController]settings->[SBGPCTDControllerSettings]
[SBGPCTDController]persist->[SBGPCTDControllerPersistSettings{bg:yellow}]
[SBGPCTDController]sensorPtr-0..1>[SBGPCTDSensor]
[SBGPCTDController]csvSamples->[CSVSampleFileSet]
[SensorController<>]^-[SBGPCTDController]
[SBGPCTDControllerBase0]^-[SensorController<>]
[SensorControllerBase<>]^-[SBGPCTDControllerBase0]
[SBGPCTDSensor]settings->[SBGPCTDSensorSettings]
[SBGPCTDSensor]logger->[Logger]
[SBGPCTDSensor]serialPort-0..1>[ISerialPort]
[ISerialPort]^-[SerialPort]
[SBGPCTDSensor]serialListener-0..1>[SerialListener]
[EventTransceiver]->[EventTransceiverSettings]
[PayloadManagerClient]->[EventTransceiver]
[SBGPCTDProgramSettings]<>[SensorProgramSettings]
[SBGPCTDProgramSettings]<>[SBGPCTDControllerSettings]
[SBGPCTDControllerSettings]<>[FileSetSettings]
[SBGPCTDControllerSettings]<>[SBGPCTDSensorSettings]
[SBGPCTDSensorSettings]<>[SerialListenerSettings]
[SBGPCTDSensorSettings]<>[SerialPortSettings]
[SerialListener]->[ISerialPort]
[SerialListener]uses-.->[SerialListenerSettings]
[SensorController<>]broker->[IObjectBroker]
[SensorController<>]logger->[Logger]
[SensorController<>]cmdOutputFormatterCF->[CmdOutputFormatterCF]
[SensorController<>]commandQueue-0..1>[CommandQueue]

// Class diagram for SeabirdGPCTD (featuring core classes)

[SBGPCTDProgram|+SBGPCTDProgram();+~SBGPCTDProgram();+Initialize();+Shutdown();+SendCommand();|-GPSSampleHandlerAsSample();-OnCommandCompleted();-OnSample();-OnSerialNumber();-OnTelemetryChanged();{bg:yellow}]
[SBGPCTDController|+SBGPCTDController();+~SBGPCTDController();+Initialize();+Shutdown();+ConfigureBlockReporting();+GetSensorPtr();+GetPersistSettings();+GetSettings();+GetStatus();+IsOxygenInstalled();+SavePersistentSettings();+SetPower();+StartSampling();+StopSampling();+sampleReport;+serialNumberReport;+sampleTelemetryChange;|-OnAsynchronousSample();-OnGPSSampleEvent();-OnRawReceive();-OnRawSend();-OnShutdownEvent();-ParseCommand();-GetDefaultOutputFormatter();|-Background();-StartupStage2();-IsO2Installed();-GetSerialNumber();{bg:yellow}]
[SBGPCTDSensor|+SBGPCTDSensor();+~SBGPCTDSensor();+Initialize();+Shutdown();+EnterQuiescentMode();+EstablishComms();+GetConfigurationData();+GetDisplayStatus();+GetDisplayCalibration();+GetHarwareData();+GetLastSample();+GetLastPressureSample();+GetStatusData();+IsInitialized();+IsPowered();+IsPowerStateKnown();+ResetLogging();+SampleNow();+SampleNowNoPump();+SamplePressureNow();+SendLowLevelCommand();+SetAutoRun();+SetAutoSamplingInterval();+SetAutoSamplingMinConductivity();+SetAutoSamplingRealtimeTransmit();+SetCustomPumpMode();+SetOxygenInstalled();+SetPump();+SetSampleNumber();+SetTime();+SetPower();+StartAutonomousSampling();+StopAutonomousSampling();+UploadHeaders();+UploadSamples();+asynchronousSample;+rawSend;+rawReceive;|-OnAsynchronousData();-OnSerialReceive();-SendCommand();-TryComms();-CheckLogging();-ChangeBaudRates();-VerifyReacting();-DoWrite();-DoThrow();-ClosePort();-OpenPort();-EstablishCommsIfPortClosed();{bg:yellow}]
[SBGPCTDControllerBase0|+ConfigureBlockReporting();+GetSensorPtr();+GetPersistSettings();+GetSettings();+GetStatus();+IsOxygenInstalled();+SavePersistentSettings();+SetPower();+StartSampling();+StopSampling();{bg:yellow}]
[BoilerplateCORBAServer<>]settings->[SBGPCTDProgramSettings{bg:yellow}]
[BoilerplateCORBAServer<>]prog->[SBGPCTDProgram]
[BoilerplateCORBAServer<>]logger->[StdOutLogger]
[BoilerplateCORBAServer<>]broker->[ObjectBroker]
[BoilerplateCORBAServer<>]theServer->[ISensorWithEvents_tie<SBGPCTDProgram>]
[ISensorWithEvents_tie<SBGPCTDProgram>]->[SBGPCTDProgram]
[BoilerplateCORBAServer<>]pmClient->[PayloadManagerClient]
[SBGPCTDProgram]pmClient->[PayloadManagerClient]
[SBGPCTDProgram]logger->[Logger]
[SBGPCTDProgram]broker->[IObjectBroker]
[SBGPCTDProgram]settings->[SBGPCTDProgramSettings]
[SBGPCTDProgram]ctrl-0..1>[SBGPCTDController]
[SensorProgram]^-[SBGPCTDProgram]
[SensorProgram]->[SensorProgramSettings]
[EventTransceiver]^-[SensorProgram]
[ICommandableBase]^-[SensorProgram]
[SBGPCTDController]settings->[SBGPCTDControllerSettings{bg:yellow}]
[SBGPCTDController]persist->[SBGPCTDControllerPersistSettings{bg:yellow}]
[SBGPCTDController]sensorPtr-0..1>[SBGPCTDSensor]
[SBGPCTDController]csvSamples->[CSVSampleFileSet]
[SensorController<>]^-[SBGPCTDController]
[SBGPCTDControllerBase0]^-[SensorController<>]
[SensorControllerBase<>]^-[SBGPCTDControllerBase0]
[SBGPCTDSensor]settings->[SBGPCTDSensorSettings{bg:yellow}]
[SBGPCTDSensor]logger->[Logger]
[SBGPCTDSensor]serialPort-0..1>[ISerialPort]
[SBGPCTDSensor]serialListener-0..1>[SerialListener]
[EventTransceiver]->[EventTransceiverSettings]
[PayloadManagerClient]->[EventTransceiver]
[SBGPCTDProgramSettings]<>[SensorProgramSettings]
[SBGPCTDProgramSettings]<>[SBGPCTDControllerSettings]
[SBGPCTDControllerSettings]<>[FileSetSettings]
[SBGPCTDControllerSettings]<>[SBGPCTDSensorSettings]
[SBGPCTDSensorSettings]<>[SerialListenerSettings]
[SBGPCTDSensorSettings]<>[SerialPortSettings]
[SerialListener]->[ISerialPort]
[ISerialPort]^-[SerialPort]
[SerialListener]uses-.->[SerialListenerSettings]
[SBGPCTDController]creates-.->[SBGPCTDAutoRunCmd{bg:yellow}]
[SBGPCTDController]creates-.->[SBGPCTDExpertCmd{bg:yellow}]
[SBGPCTDController]creates-.->[SBGPCTDGetStatusCmd{bg:yellow}]
[SBGPCTDController]creates-.->[SBGPCTDLoggingCmd{bg:yellow}]
[SBGPCTDController]creates-.->[SBGPCTDPowerCmd{bg:yellow}]
[SBGPCTDController]creates-.->[SBGPCTDStartCmd{bg:yellow}]
[SBGPCTDController]creates-.->[SBGPCTDStopCmd{bg:yellow}]
[SBGPCTDConcreteCmd{bg:yellow}]^-[SBGPCTDAutoRunCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDExpertCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDGetStatusCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDLoggingCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDPowerCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDStartCmd]
[SBGPCTDConcreteCmd]^-[SBGPCTDStopCmd]
[SBGPCTDAutoRunCmd]->[SBGPCTDControllerBase0]
[SBGPCTDExpertCmd]->[SBGPCTDControllerBase0]
[SBGPCTDGetStatusCmd]->[SBGPCTDControllerBase0]
[SBGPCTDLoggingCmd]->[SBGPCTDControllerBase0]
[SBGPCTDPowerCmd]->[SBGPCTDControllerBase0]
[SBGPCTDStartCmd]->[SBGPCTDControllerBase0]
[SBGPCTDStopCmd]->[SBGPCTDControllerBase0]

2. Startup

-----
title SeabirdGPCTD Startup (too complicated)

main->BoilerplateCORBAServer: BoilerplateCORBAServer(argc,argv,"SeabirdGPCTD-config.xml")
BoilerplateCORBAServer->SBGPCTDProgramSettings: SBGPCTDProgramSettings()
BoilerplateCORBAServer->SBGPCTDProgramSettings: Load()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetServerName()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetServerKind()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetLoggerSettings()
BoilerplateCORBAServer->StdOutLogger: StdOutLogger()
BoilerplateCORBAServer->ObjectBroker: ObjectBroker()
BoilerplateCORBAServer->ObjectBroker: Initizalize(argc, argv)
BoilerplateCORBAServer->SBGPCTDProgram: SBGPCTDProgram()
BoilerplateCORBAServer->ISensorWithEvents_tie: ISensorWithEvents_tie(program)
BoilerplateCORBAServer->ObjectBroker: AdvertiseInstance(tie server, server name, server kind)
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetPayloadManagerClientSettings()
BoilerplateCORBAServer->PayloadManagerClient: PayloadManagerClient(pm client settings)
BoilerplateCORBAServer->SBGPCTDProgram: Initialize(tie server, pm client)
SBGPCTDProgram->SBGPCTDProgram: SensorProgram::Initialize()
SBGPCTDProgram->SBGPCTDController: SBGPCTDController()
SBGPCTDController->SensorController<>: SensorController<>(broker, logger,\ngps subscriber, shutdown subscriber)
SBGPCTDController->SBGPCTDControllerSettings: GetFileSetSettings()
SBGPCTDController->CSVSampleFileSet: SBGPCTDController->CSVSampleFileSet(file set settings)
SBGPCTDController->SBGPCTDControllerSettings: GetPersistentXMLFileName()
SBGPCTDProgram->SBGPCTDController: SubscribeCommandComplete()
SBGPCTDProgram->SBGPCTDController: sampleReport.Subscribe()
SBGPCTDProgram->SBGPCTDController: serialNumberReport.Subscribe()
SBGPCTDProgram->SBGPCTDController: sampleTelemetryChange.Subscribe()
SBGPCTDProgram->SBGPCTDController: Initialize()
SBGPCTDController->SBGPCTDControllerPersistSettings: SBGPCTDControllerPersistSettings()
SBGPCTDController->SBGPCTDControllerPersistSettings: Load()
opt On exception
    SBGPCTDController->SBGPCTDControllerPersistSettings: SetDefaults()
    SBGPCTDController->SBGPCTDControllerPersistSettings: Save()
end
SBGPCTDController->SBGPCTDController: SensorController<>::Initialize()
SBGPCTDController->CSVSampleFileSet: Initialize()
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("CTDO" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("DEVINFO" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("RECV" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("SEND" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("START" ...)
SBGPCTDController->SBGPCTDController: GetSensorPtr(turn on sensor = false)
opt Sensor not allocated
SBGPCTDController->SBGPCTDControllerSettings: GetSensorSettings()
SBGPCTDController->SBGPCTDSensor: SBGPCTDSensor(sensor settings, logger)
SBGPCTDController->SBGPCTDSensor: asynchronousSample.Subscribe()
SBGPCTDController->SBGPCTDSensor: rawReceive.Subscribe()
SBGPCTDController->SBGPCTDSensor: rawSend.Subscribe()
SBGPCTDController->SBGPCTDSensor: Initialize()
end
opt Sensor allocated, but not communicating and turning on
SBGPCTDController->SBGPCTDSensor: EstablishComms(true)
loop Try at supported baud rates 9600, 38400, 115200
SBGPCTDSensor->+SBGPCTDSensor: TryComms(baud rate)
SBGPCTDSensor->+SBGPCTDSensor: ClosePort()
SBGPCTDSensor->SerialListener: GetFiringMutex()
SBGPCTDSensor->SerialListener: Shutdown()
SBGPCTDSensor->SerialListener: ~SerialListener()
SBGPCTDSensor->ISerialPort: Close()
SBGPCTDSensor->ISerialPort: ~ISerialPort()
SBGPCTDSensor-->-SBGPCTDSensor: returns
SBGPCTDSensor->+SBGPCTDSensor: OpenPort()
SBGPCTDSensor->SBGPCTDSensorSettings: GetSerialPortSettings()
SBGPCTDSensor->SerialPort: SerialPort(port name)
SBGPCTDSensor->SBGPCTDSensorSettings: GetChracterSize()
SBGPCTDSensor->SBGPCTDSensorSettings: GetParity()
SBGPCTDSensor->SBGPCTDSensorSettings: GetStopBits()
SBGPCTDSensor->SBGPCTDSensorSettings: GetFlowControl()
SBGPCTDSensor->SerialPort: Open()
SBGPCTDSensor->SerialPort: FlushAll()
SBGPCTDSensor->SBGPCTDSensorSettings: GetSerialListenerSettings()
SBGPCTDSensor->SerialListener: SerialListener(port, settings)
SBGPCTDSensor->SerialListener: Subscribe(boost::bind(&SBGPCTDSensor::OnSerialReceive, this, _1, _2))
SBGPCTDSensor->SerialListener: Initialize()
SBGPCTDSensor-->-SBGPCTDSensor: returns
SBGPCTDSensor->CommandBuffer: CommandBuffer()
CommandBuffer->SBGPCTDSensor: commandData.Subscribe(boost::bind(&CommandBuffer::OnDataRecieved, this, _1))
SBGPCTDSensor->SBGPCTDSensor: DoWrite("\x8\x8\r")
SBGPCTDSensor->SerialPort: Write()
note over SBGPCTDSensor: Raw send event fires
SBGPCTDSensor->SBGPCTDController: OnRawSend("\x8\x8\r")
SBGPCTDController->SBGPCTDControllerPersistSettings: GetRawLoggingEnabled()
opt Raw logging enabled
SBGPCTDController->CSVSampleFileSet: WriteSample("SEND")
end
SBGPCTDSensor->CommandBuffer: blobs.ReadTest(time left)

note over SerialListener: Some time later
SerialListener->SBGPCTDSensor: OnSerialReceive()

note over SBGPCTDSensor: Raw receive event fires
SBGPCTDSensor->SBGPCTDController: OnRawReceive()
SBGPCTDController->SBGPCTDControllerPersistSettings: GetRawLoggingEnabled()
opt Raw logging enabled
SBGPCTDController->CSVSampleFileSet: WriteSample("RECV")
end

note over SBGPCTDSensor: Internal command data\nsignal fires
SBGPCTDSensor->CommandBuffer: OnDataReceived()
CommandBuffer->CommandBuffer: blobs.WriteExpand()
note over CommandBuffer: Causes reads to return

note over SBGPCTDSensor: Any data left after\ninternal command runs\nis fired to internal asynchronous\ndata event, looking for samples
SBGPCTDSensor->SBGPCTDSensor: OnAsynchronousData()
note over SBGPCTDSensor: Asynchronous sample signal\nfires if there is a valid\nsample
SBGPCTDSensor->SBGPCTDController: OnAsynchronousSample()
SBGPCTDController->SBGPCTDControllerPersistSettings: GetLoggingEnabled()
opt Logging enabled
SBGPCTDController->CSVSampleFileSet: WriteSample("CTDO")
end
note over SBGPCTDController: Fires a signal to internal\nsubscriber while sampling




SBGPCTDSensor-->-SBGPCTDSensor: returns
end
opt If not at the desired baud rate
SBGPCTDSensor->SBGPCTDSensor: TryComms(desired baud rate)
end
end





BoilerplateCORBAServer->PayloadManagerClient: Register(tie server)
BoilerplateCORBAServer->ObjectBroker: ListenForRequests()


------
title SeabirdGPCTD Startup (still too complicated)

main->BoilerplateCORBAServer: BoilerplateCORBAServer(argc,argv,"SeabirdGPCTD-config.xml")
BoilerplateCORBAServer->SBGPCTDProgramSettings: SBGPCTDProgramSettings()
BoilerplateCORBAServer->SBGPCTDProgramSettings: Load()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetServerName()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetServerKind()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetLoggerSettings()
BoilerplateCORBAServer->StdOutLogger: StdOutLogger()
BoilerplateCORBAServer->ObjectBroker: ObjectBroker()
BoilerplateCORBAServer->ObjectBroker: Initizalize(argc, argv)
BoilerplateCORBAServer->SBGPCTDProgram: SBGPCTDProgram()
BoilerplateCORBAServer->ISensorWithEvents_tie: ISensorWithEvents_tie(program)
BoilerplateCORBAServer->ObjectBroker: AdvertiseInstance(tie server, server name, server kind)
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetPayloadManagerClientSettings()
BoilerplateCORBAServer->PayloadManagerClient: PayloadManagerClient(pm client settings)
BoilerplateCORBAServer->SBGPCTDProgram: Initialize(tie server, pm client)
SBGPCTDProgram->SBGPCTDProgram: SensorProgram::Initialize()
SBGPCTDProgram->SBGPCTDController: SBGPCTDController()
SBGPCTDController->SensorController<>: SensorController<>(broker, logger,\ngps subscriber, shutdown subscriber)
SBGPCTDController->SBGPCTDControllerSettings: GetFileSetSettings()
SBGPCTDController->CSVSampleFileSet: SBGPCTDController->CSVSampleFileSet(file set settings)
SBGPCTDController->SBGPCTDControllerSettings: GetPersistentXMLFileName()
SBGPCTDProgram->SBGPCTDController: SubscribeCommandComplete()
SBGPCTDProgram->SBGPCTDController: sampleReport.Subscribe()
SBGPCTDProgram->SBGPCTDController: serialNumberReport.Subscribe()
SBGPCTDProgram->SBGPCTDController: sampleTelemetryChange.Subscribe()
SBGPCTDProgram->SBGPCTDController: Initialize()
SBGPCTDController->SBGPCTDControllerPersistSettings: SBGPCTDControllerPersistSettings()
SBGPCTDController->SBGPCTDControllerPersistSettings: Load()
opt On exception
    SBGPCTDController->SBGPCTDControllerPersistSettings: SetDefaults()
    SBGPCTDController->SBGPCTDControllerPersistSettings: Save()
end
SBGPCTDController->SBGPCTDController: SensorController<>::Initialize()
SBGPCTDController->CSVSampleFileSet: Initialize()
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("CTDO" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("DEVINFO" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("RECV" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("SEND" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("START" ...)
SBGPCTDController->SBGPCTDController: GetSensorPtr(turn on sensor = false)
opt Sensor not allocated
SBGPCTDController->SBGPCTDControllerSettings: GetSensorSettings()
SBGPCTDController->SBGPCTDSensor: SBGPCTDSensor(sensor settings, logger)
SBGPCTDController->SBGPCTDSensor: asynchronousSample.Subscribe()
SBGPCTDController->SBGPCTDSensor: rawReceive.Subscribe()
SBGPCTDController->SBGPCTDSensor: rawSend.Subscribe()
SBGPCTDController->SBGPCTDSensor: Initialize()
end
opt Sensor allocated, but not communicating and turning on
SBGPCTDController->SBGPCTDSensor: EstablishComms(true)
loop Try at supported baud rates 9600, 38400, 115200
SBGPCTDSensor->+SBGPCTDSensor: TryComms(baud rate)
SBGPCTDSensor->+SBGPCTDSensor: ClosePort()
SBGPCTDSensor->SerialListener: GetFiringMutex()
SBGPCTDSensor->SerialListener: Shutdown()
SBGPCTDSensor->SerialListener: ~SerialListener()
SBGPCTDSensor->ISerialPort: Close()
SBGPCTDSensor->ISerialPort: ~ISerialPort()
SBGPCTDSensor-->-SBGPCTDSensor: returns
SBGPCTDSensor->+SBGPCTDSensor: OpenPort()
SBGPCTDSensor->SBGPCTDSensorSettings: GetSerialPortSettings()
SBGPCTDSensor->SerialPort: SerialPort(port name)
SBGPCTDSensor->SBGPCTDSensorSettings: GetChracterSize()
SBGPCTDSensor->SBGPCTDSensorSettings: GetParity()
SBGPCTDSensor->SBGPCTDSensorSettings: GetStopBits()
SBGPCTDSensor->SBGPCTDSensorSettings: GetFlowControl()
SBGPCTDSensor->SerialPort: Open()
SBGPCTDSensor->SerialPort: FlushAll()
SBGPCTDSensor->SBGPCTDSensorSettings: GetSerialListenerSettings()
SBGPCTDSensor->SerialListener: SerialListener(port, settings)
SBGPCTDSensor->SerialListener: Subscribe(boost::bind(&SBGPCTDSensor::OnSerialReceive, this, _1, _2))
SBGPCTDSensor->SerialListener: Initialize()
SBGPCTDSensor-->-SBGPCTDSensor: returns
SBGPCTDSensor->CommandBuffer: CommandBuffer()
CommandBuffer->SBGPCTDSensor: commandData.Subscribe(boost::bind(&CommandBuffer::OnDataRecieved, this, _1))
SBGPCTDSensor->SBGPCTDSensor: DoWrite("\x8\x8\r")
SBGPCTDSensor->SerialPort: Write()
note over SBGPCTDSensor: Raw send event fires
SBGPCTDSensor->SBGPCTDController: OnRawSend("\x8\x8\r")
SBGPCTDController->SBGPCTDControllerPersistSettings: GetRawLoggingEnabled()
opt Raw logging enabled
SBGPCTDController->CSVSampleFileSet: WriteSample("SEND")
end
SBGPCTDSensor->CommandBuffer: blobs.ReadTest(time left)

note over SerialListener: Some time later
SerialListener->SBGPCTDSensor: OnSerialReceive()

note over SBGPCTDSensor: Raw receive event fires
SBGPCTDSensor->SBGPCTDController: OnRawReceive()
SBGPCTDController->SBGPCTDControllerPersistSettings: GetRawLoggingEnabled()
opt Raw logging enabled
SBGPCTDController->CSVSampleFileSet: WriteSample("RECV")
end

note over SBGPCTDSensor: Internal command data\nsignal fires
SBGPCTDSensor->CommandBuffer: OnDataReceived()
CommandBuffer->CommandBuffer: blobs.WriteExpand()
note over CommandBuffer: Causes reads to return

note over SBGPCTDSensor: TryComms() evaluates response\n(looks for S>)





SBGPCTDSensor-->-SBGPCTDSensor: returns
end
opt If not at the desired baud rate
SBGPCTDSensor->SBGPCTDSensor: TryComms(desired baud rate)
end
end





BoilerplateCORBAServer->PayloadManagerClient: Register(tie server)
BoilerplateCORBAServer->ObjectBroker: ListenForRequests()

-----------
title SeabirdGPCTD Startup

main->BoilerplateCORBAServer: BoilerplateCORBAServer(argc,argv,"SeabirdGPCTD-config.xml")
BoilerplateCORBAServer->SBGPCTDProgramSettings: SBGPCTDProgramSettings()
BoilerplateCORBAServer->SBGPCTDProgramSettings: Load()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetServerName()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetServerKind()
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetLoggerSettings()
BoilerplateCORBAServer->StdOutLogger: StdOutLogger()
BoilerplateCORBAServer->ObjectBroker: ObjectBroker()
BoilerplateCORBAServer->ObjectBroker: Initizalize(argc, argv)
BoilerplateCORBAServer->SBGPCTDProgram: SBGPCTDProgram()
BoilerplateCORBAServer->ISensorWithEvents_tie: ISensorWithEvents_tie(program)
BoilerplateCORBAServer->ObjectBroker: AdvertiseInstance(tie server, server name, server kind)
BoilerplateCORBAServer->SBGPCTDProgramSettings: GetPayloadManagerClientSettings()
BoilerplateCORBAServer->PayloadManagerClient: PayloadManagerClient(pm client settings)
BoilerplateCORBAServer->SBGPCTDProgram: Initialize(tie server, pm client)
SBGPCTDProgram->SBGPCTDProgram: SensorProgram::Initialize()
SBGPCTDProgram->SBGPCTDController: SBGPCTDController()
SBGPCTDController->SensorController<>: SensorController<>(broker, logger,\ngps subscriber, shutdown subscriber)
SBGPCTDController->SBGPCTDControllerSettings: GetFileSetSettings()
SBGPCTDController->CSVSampleFileSet: SBGPCTDController->CSVSampleFileSet(file set settings)
SBGPCTDController->SBGPCTDControllerSettings: GetPersistentXMLFileName()
SBGPCTDProgram->SBGPCTDController: SubscribeCommandComplete()
SBGPCTDProgram->SBGPCTDController: sampleReport.Subscribe()
SBGPCTDProgram->SBGPCTDController: serialNumberReport.Subscribe()
SBGPCTDProgram->SBGPCTDController: sampleTelemetryChange.Subscribe()
SBGPCTDProgram->SBGPCTDController: Initialize()
SBGPCTDController->SBGPCTDControllerPersistSettings: SBGPCTDControllerPersistSettings()
SBGPCTDController->SBGPCTDControllerPersistSettings: Load()
opt On exception
    SBGPCTDController->SBGPCTDControllerPersistSettings: SetDefaults()
    SBGPCTDController->SBGPCTDControllerPersistSettings: Save()
end
SBGPCTDController->SBGPCTDController: SensorController<>::Initialize()
SBGPCTDController->CSVSampleFileSet: Initialize()
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("CTDO" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("DEVINFO" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("RECV" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("SEND" ...)
SBGPCTDController->CSVSampleFileSet: RegisterSampleHeaders("START" ...)
SBGPCTDController->SBGPCTDController: GetSensorPtr(turn on sensor = false)
opt Sensor not allocated
SBGPCTDController->SBGPCTDControllerSettings: GetSensorSettings()
SBGPCTDController->SBGPCTDSensor: SBGPCTDSensor(sensor settings, logger)
SBGPCTDController->SBGPCTDSensor: asynchronousSample.Subscribe()
SBGPCTDController->SBGPCTDSensor: rawReceive.Subscribe()
SBGPCTDController->SBGPCTDSensor: rawSend.Subscribe()
SBGPCTDController->SBGPCTDSensor: Initialize()
end

note over SBGPCTDController: Not establishing comms yet\nbecause parameter is false

SBGPCTDController->Startup thread: thread(boost::bind(&SBGPCTDController::StartupStage2, this))

BoilerplateCORBAServer->PayloadManagerClient: Register(tie server)
BoilerplateCORBAServer->ObjectBroker: ListenForRequests()

Startup thread->+SBGPCTDController: StartupStage2()
note over SBGPCTDController: Waits for PayloadManagerClient\nto register
SBGPCTDController->SBGPCTDController: ConfigureBlockReporting()
note over SBGPCTDController: Fires sample telemetry change signal
SBGPCTDController->SBGPCTDProgram: OnTelemetryChanged(block size, report interval)
SBGPCTDProgram->SBGPCTDProgramSettings: GetTelemetryChangedEventSettings()
SBGPCTDProgram->SBGPCTDProgramSettings: GetSampleFormatCode()
note over SBGPCTDProgram: Creates a TelemetrySettingsChangedEvent\nand sets its properties; fires\ntwo events, one for CTD message\nand one for CTDO message
SBGPCTDProgram->SBGPCTDProgram: TransmitEvent()
SBGPCTDProgram->SBGPCTDProgramSettings: GetO2SampleFormatCode()
SBGPCTDProgram->SBGPCTDProgram: TransmitEvent()

SBGPCTDController->SBGPCTDControllerPersistSettings: GetAutoRun()
opt Auto-run enabled
SBGPCTDController->SBGPCTDController: StartSampling()
end

SBGPCTDController-->-Startup thread: Thread ends


3. Executing startup command

title Executing Startup Command

Note over User: User enters "ctd -- start"\nin WGMS or from ServerExec\nThe SendCommand method\nis invoked via CORBA from\nPayloadInterface or ServerExec,\nforwarded from\nISensorWithEvents_tie
User->SBGPCTDProgram: SendCommand(command string,\nrequester, transaction)
SBGPCTDProgram->ParsingContext: ParsingContext(controller, command string,\nrequester, transaction)
SBGPCTDProgram->SBGPCTDController: SendCommand(parsing context)
SBGPCTDController->SBGPCTDController: ParseCommandBuffer(parsing context)

alt Single line command
SBGPCTDController->ParsingContext: GetCmd()
SBGPCTDController->CommandLineParser: CommandLineParser(command)
SBGPCTDController->SBGPCTDController: ParseCommand(parsing context)
SBGPCTDController->SensorControllerRunFileCmd<>: Parse("ctd","--run",controller,parser,parsing context,logger)
SBGPCTDController->SBGPCTDAutoRunCmd: Parse("ctd","--autorun",controller,parser,parsing context,logger)
SBGPCTDController->SBGPCTDExpertCmd: Parse("ctd","--expert",controller,parser,parsing context,logger)
SBGPCTDController->SBGPCTDLoggingCmd: Parse("ctd","--log-raw",controller,parser,parsing context,logger,true)
SBGPCTDController->SBGPCTDLoggingCmd: Parse("ctd","--log-samples",controller,parser,parsing context,logger,false)
SBGPCTDController->SBGPCTDPowerCmd: Parse("ctd","--power",controller,parser,parsing context,logger)
SBGPCTDController->SBGPCTDStartCmd: Parse("ctd","--start",controller,parser,parsing context,logger)
SBGPCTDStartCmd->SBGPCTDStartCmd: SBGPCTDStartCmd()
else Multiple line command
SBGPCTDController->SensorControllerMultipleLinesCmd<>: Parse(controller,lines,parsing context,logger)
end

SBGPCTDController->ParsingContext: GetID()
SBGPCTDController->SBGPCTDStartCmd: SetCompletionParams()
SBGPCTDController->SBGPCTDController: GetDefaultOutputFormatter()
SBGPCTDController->CmdOutputFormatterCF: Create("basic")
CmdOutputFormatterCF->BasicCmdOutputFormatter: BasicCmdOutputFormatter()
SBGPCTDController->ParsingContext: GetCmd()
SBGPCTDController->CmdOutputFormatter: SetCommandName()
SBGPCTDController->SBGPCTDStartCmd: SetOutputFormatter()
SBGPCTDController->SBGPCTDController: EnqueueCommand()
SBGPCTDController->Command QueueWorker: EnqueueWorkItem()
note over SBGPCTDController: throws ReturnsAsynchronously exception

note over Command QueueWorker: The new command wakes up a\nbackground thread, which fires\nits work item processed signal
Command QueueWorker->SBGPCTDController: OnProcessCommand()
SBGPCTDController->SBGPCTDStartCmd: Execute()
SBGPCTDStartCmd->SBGPCTDStartCmd: SignalStarted()
SBGPCTDStartCmd->SBGPCTDController: GetPersistSettings()

opt Operational parameters given
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: GetSamplePeriodSec()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: SetSamplePeriodSec()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: GetReportBlockSize()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: SetReportBlockSize()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: GetFlushTimeSec()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: SetFlushTimeSec()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: GetDutyCycleSec()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: SetDutyCycleSec()
SBGPCTDStartCmd->SBGPCTDController: SavePersistentSettings()
SBGPCTDStartCmd->SBGPCTDController: ConfigureBlockReporting()
end

SBGPCTDStartCmd->SBGPCTDController: GetSensorPtr()
SBGPCTDStartCmd->SBGPCTDController: StartSampling()
SBGPCTDStartCmd->SBGPCTDStartCmd: GetOutputFormatter()
SBGPCTDStartCmd->SBGPCTDController: IsOxygenInstalled()
SBGPCTDStartCmd->SBGPCTDControllerPersistSettings: GetSamplePeriodSec()

alt Oxygen sensor installed and sample period > 14 sec
SBGPCTDStartCmd->BasicCmdOutputFormatter: AppendOutput("WARNING: oxygen samples will not be returned for sample period less than 15")
else No oxygen installed or sample period < 15
SBGPCTDStartCmd->BasicCmdOutputFormatter: AppendOutput("OK")
end

SBGPCTDController->SBGPCTDStartCmd: SignalComplete()
SBGPCTDController->SBGPCTDStartCmd: ActionWait()

note over SBGPCTDController: Fires command completion signal
SBGPCTDController->SBGPCTDStartCmd: GetCompletionParams()
SBGPCTDController->SBGPCTDProgram: OnCommandCompleted(completion params, result string)
SBGPCTDProgram->ParsingContext: GetRequester()
SBGPCTDProgram->ParsingContext: GetTransactionID()
SBGPCTDProgram->SBGPCTDProgram: FireCommandCompleteEvent(result string, requester, transaction)
SBGPCTDProgram->SBGPCTDProgramSettings: GetCommandCompleteEvent()
SBGPCTDProgram->SendCommandCompleteEvent: SendCommandCompleteEvent()
SBGPCTDProgram->SendCommandCompleteEvent: Complete(true)
SBGPCTDProgram->SendCommandCompleteEvent: Requester(requester)
SBGPCTDProgram->SendCommandCompleteEvent: TransactionID(transaction ID)
SBGPCTDProgram->SendCommandCompleteEvent: ResultVariantString(result string)
SBGPCTDProgram->SBGPCTDProgram: TransmitEvent()







