Version = "$Id: MARTe-WaterTank.cfg,v 1.5 2010/04/20 15:42:02 ppcc_dev Exp $"
LoggerAddress = "localhost"
DefaultCPUs = 1
+WEB = {
    Class = HttpGroupResource
    +BROWSE = {
        Title = "Http Object Browser"
        Class = HttpGCRCBrowser
        AddReference = {MARTe StateMachine OBJBROWSE THRBROWSE CFGUpload HTTPSignalServer MatlabSignalServer}
    }
	+RGRAPH_LIB_DIR = {
		Class   = HttpDirectoryResource
		BaseDir = "../../3rdPartyLibs/RGraph/libraries"
	}
}
+HTTPSERVER = {
    Class = HttpService
    Port = 8084
    HttpRelayURL = "ignore.me:1234"
    VerboseLevel = 10
    Root = WEB
}
+OBJBROWSE = {
    Class = HttpClassListResource
}
+THRBROWSE = {
    Class = HttpThreadListResource
}
+MatlabSignalServer = {
    Class = MATLABHandler
}
+HTTPSignalServer={
     Class = SignalServer
}
+CFGUpload = {
    Class = CFGUploader
}
+TCPMessageHandler = {
    Class      = TCPMessageHandler
    ServerPort = 9090
    CPUMask    = 1
}
+StateMachine = {
    Class = StateMachine
    VerboseLevel = 10
    +INITIAL = {
        Class = StateMachineState
        StateCode = 0x0
        +START = {
            Class = StateMachineEvent
            NextState = WAITING_FOR_PULSE
            Value = START
            +STARTALL = {
                Class = MessageDeliveryRequest
                Sender = StateMachine
                Destinations = "HTTPSERVER MARTe"
                MsecTimeOut = 1000
                Flags = NoReply
                Message = {
                    Class = Message
                    Content = START
                }
            }
        }
    }
    +WAITING_FOR_PULSE = {
        Class = StateMachineState
        StateCode = 0x500
        +PULSE = {
            Class = StateMachineEvent
            Code = 0x701
            NextState = WAITING_FOR_TRIGGER
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = MARTe
                +MESSAGE = {
                    Class = Message
                    Content = PREPULSECHECK
                }
            }
            +UPDATE_MSS = {
                Class = MessageEnvelope
                Destination = MatlabSignalServer
                +MESSAGE = {
                    Class = Message
                    Content = AUTODETECT
                }
            }
	    +UPDATE_SS = {
                Class = MessageEnvelope
                Destination = HTTPSignalServer
                +MESSAGE = {
                    Class = Message
                    Content = AUTODETECT
                }
            }
        }
        +INHIBIT = {
            Class = StateMachineEvent
            Code = 0x704
            NextState = INHIBIT
        }
        +ACTIVATE = {
            Class = StateMachineEvent
            Code = 0x705
            NextState = SAMESTATE
        }
        +UNRECOVERABLE = {
            Class = StateMachineEvent
            Code = 0x776
            NextState = UNRECOVERABLE
        }
        +CONFIG_ERROR = {
            Class = StateMachineEvent
            Code = 0x777
            NextState = CONFIG_ERROR
        }
        +CONFIG_OK = {
            Class = StateMachineEvent
            Code = 0x778
            NextState = SAMESTATE
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = COULD.BE.A.MIMIC
                +SENDSTATE = {
                    Class = Message
                    Code = 0x500
                }
            }
        }
        +STOP = {
            Class = StateMachineEvent
            NextState = WAITING_FOR_PULSE
            Value = STOP
            Code = 0x005
            +STOPALL = {
                Class = MessageDeliveryRequest
                Sender = StateMachine
                Destinations = "HTTPSERVER MARTe"
                MsecTimeOut = 1000
                Flags = NoReply
                Message = {
                    Class = Message
                    Content = STOP
                }
            }
        }
    }
    +WAITING_FOR_TRIGGER = {
        Class = StateMachineState
        StateCode = 0x504
        +TRIGGER = {
            Class = StateMachineEvent
            Code = 0x708
            NextState = PULSING
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = MARTe
                +MESSAGE = {
                    Class = Message
                    Content = PULSESTART
                }
            }
        }
        +ABORT = {
            Class = StateMachineEvent
            Code = 0x702
            NextState = WAITING_FOR_PULSE
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = MARTe
                +MESSAGE = {
                    Class = Message
                    Content = PULSESTOP
                }
            }
        }
        +COLLECTION_COMPLETED = {
            Class = StateMachineEvent
            Code = 0x703
            NextState = COMM_ERROR
        }
    }
    +PULSING = {
        Class = StateMachineState
        StateCode = 0x505
        +ENTER = {
            Class = MessageEnvelope
            Destination = COULD.BE.A.MIMIC
            +SENDSTATE = {
                Class = Message
            }
        }
        +ABORT = {
            Class = StateMachineEvent
            Code = 0x702
            NextState = WAITING_FOR_PULSE
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = MARTe
                +MESSAGE = {
                    Class = Message
                    Content = PULSESTOP
                }
            }
        }
        +END_PULSE = {
            Class = StateMachineEvent
            Code = 0x709
            NextState = POST_PULSE
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = MARTe
                +MESSAGE = {
                    Class = Message
                    Content = PULSESTOP
                }
            }
        }
    }
    +POST_PULSE = {
        Class = StateMachineState
        StateCode = 0x507
        +ENTER = {
            Class = MessageEnvelope
            Destination = COULD.BE.A.MIMIC
            +SENDSTATE = {
                Class = Message
            }
        }
        +COLLECTION_COMPLETED = {
            Class = StateMachineEvent
            Code = 0x703
            NextState = WAITING_FOR_PULSE
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = MARTe
                +MESSAGE = {
                    Class = Message
                    Content = COLLECTIONCOMPLETED
                }
            }
        }
    }
    +INHIBIT = {
        Class = StateMachineState
        StateCode = 0x508
        +ACTIVATE = {
            Class = StateMachineEvent
            Code = 0x705
            NextState = WAITING_FOR_PULSE
        }
    }
    +ERROR = {
        Class = StateMachineState
        StateCode = 0x601
        +ACTIVATE = {
            Class = StateMachineEvent
            Code = 0x705
            NextState = WAITING_FOR_PULSE
        }
        +COLLECTION_COMPLETED = {
            Class = StateMachineEvent
            Code = 0x703
            NextState = WAITING_FOR_PULSE
        }
    }
    +CONFIG_ERROR = {
        Class = StateMachineState
        StateCode = 0x601
        +ENTER = {
            Class = MessageEnvelope
            Destination = COULD.BE.A.MIMIC
            +SENDSTATE = {
                Class = Message
            }
        }
        +ACTIVATE = {
            Class = StateMachineEvent
            Code = 0x705
            NextState = WAITING_FOR_PULSE
        }
        +CONFIG_OK = {
            Class = StateMachineEvent
            Code = 0x778
            NextState = WAITING_FOR_PULSE
            +NOTIFY = {
                Class = MessageEnvelope
                Sender = StateMachine
                Destination = COULD.BE.A.MIMIC
                +SENDSTATE = {
                    Class = Message
                    Code = 0x500
                }
            }
        }
	+CONFIG_ERROR = {
            Class = StateMachineEvent
            Code = 0x777
            NextState = CONFIG_ERROR
        }
    }
    +UNRECOVERABLE = {
        Class = StateMachineState
        StateCode = 0x601
        +DEFAULT = {
            Class = StateMachineEvent
            UserCode = 0
            NextState = UNRECOVERABLE
        }
    }
    +COMM_ERROR = {
        StateCode = 0x601
        Class = StateMachineState
        +ABORT = {
            Class = StateMachineEvent
            Code = 0x702
            NextState = SAMESTATE
        }
    }
    +DEFAULT = {
        Class = StateMachineState
        StateCode = 0x601
        +ABORT = {
            Class = StateMachineEvent
            Code = 0x702
            NextState = WAITING_FOR_PULSE
        }
        +TRIGGER = {
            Class = StateMachineEvent
            Code = 0x708
            NextState = SAMESTATE
        }
        +END_PULSE = {
            Class = StateMachineEvent
            Code = 0x709
            NextState = SAMESTATE
        }
    }
}
+MARTeMenu = {
    Class = MarteSupLib::MARTeMenu
    Title = "MARTe Menu"
    +MenuA = {
        Class = MenuContainer
        Title = "State Machine"
        +ABORT = {
            Class = SendMessageMenuEntry
            Title = Abort
            Envelope = {
                Class = MessageEnvelope
                Sender = MARTeMenu
                Destination = StateMachine
                +Message = {
                    Class = Message
                    Code = 0x702
                    Content = ABORT
                }
            }
        }
        +INHIBIT = {
            Class = SendMessageMenuEntry
            Title = Inhibit
            Envelope = {
                Class = MessageEnvelope
                Sender = MARTeMenu
                Destination = StateMachine
                +Message = {
                    Class = Message
                    Code = 0x704
                    Content = Inhibit
                }
            }
        }
        +ACTIVATE = {
            Class = SendMessageMenuEntry
            Title = Activate
            Envelope = {
                Class = MessageEnvelope
                Sender = MARTeMenu
                Destination = StateMachine
                +Message = {
                    Class = Message
                    Code = 0x705
                    Content = Activate
                }
            }
        }
        +PULSESETUPCOMPLETE = {
            Class = SendMessageMenuEntry
            Title = "Pulse Setup Complete"
            Envelope = {
                Class = MessageEnvelope
                Sender = MARTeMenu
                Destination = StateMachine
                +Message = {
                    Class = Message
                    Code = 0x701
                    Content = WAITING_FOR_PULSE
                }
            }
        }
        +TRIGGER = {
            Class = SendMessageMenuEntry
            Title = "Pulse Start"
            Envelope = {
                Class = MessageEnvelope
                Sender = MARTeMenu
                Destination = StateMachine
                +Message = {
                    Class = Message
                    Code = 0x708
                    Content = TRIGGER 
                }
            }
        }
        +END_PULSE = {
            Class = SendMessageMenuEntry
            Title = "Pulse End"
            Envelope = {
                Class = MessageEnvelope
                Sender = MARTeMenu
                Destination = StateMachine
                +Message = {
                    Class = Message
                    Code = 0x709
                    Content = END_PULSE 
                }
            }
        }
        +COLLECTION_COMPLETED = {
            Class = SendMessageMenuEntry
            Title = "Collection Completed"
            Envelope = {
                Class = MessageEnvelope
                Sender = MARTeMenu
                Destination = StateMachine
                +Message = {
                    Class = Message
                    Code = 0x703
                    Content = POSTPULSE
                }
            }
        }
    }
    AddReference = MARTe.MARTe
}
+MARTe = {
    Class = MARTeContainer
    StateMachineName = StateMachine
    Level1Name = LEVEL1
    MenuContainerName = MARTe
    +MARTe = {
        Class = MenuContainer
    }
    +DriverPool = {
        Class = GCReferenceContainer
        +TimerBoard = {
            Class = GenericTimerDrv
            NumberOfInputs = 2
            NumberOfOutputs = 0
            TimerUsecPeriod = 10000
            SynchronizationMethod = Synchronizing
            CPUMask = 1
        }
    }
    +Messages = {
        Class = GCReferenceContainer
        +FatalErrorMessage = {
            Class = MessageDeliveryRequest
            Destinations = StateMachine
            MsecTimeOut = 1000
            Flags = NoReply
            Message = {
                Class = Message
                Code = 0x776
                Content = UNRECOVERABLE
            }
        }
        +ConfigLoadErrorMessage = {
            Class = MessageDeliveryRequest
            Destinations = StateMachine
            MsecTimeOut = 1000
            Flags = NoReply
            Message = {
                Class = Message
                Code = 0x777
                Content = CONFIG_ERROR
            }
        }
        +ConfigLoadOKMessage = {
            Class = MessageDeliveryRequest
            Destinations = StateMachine
            MsecTimeOut = 1000
            Flags = NoReply
            Message = {
                Class = Message
                Code = 0x778
                Content = CONFIG_OK
            }
        }
        +SafetyErrorMessage = {
            Class = MessageDeliveryRequest
            Destinations = MARTe
            MsecTimeOut = 1000
            Flags = NoReply
            Message = {
                Class = Message
                Content = ERROR
            }
        }
    }
    +ExternalTimeTriggeringService = {
        Class = InterruptDrivenTTS
        TsOnlineUsecPeriod = 10000
        TsOnlineUsecPhase = 0
        TsOfflineUsecPeriod = 10000
        TsOfflineUsecPhase = 0
        TimeModule = {
            BoardName = TimerBoard
        }
    }
    +Thread_1 = {
        Class = RealTimeThread
        ThreadPriority = 28
        RunOnCPU = 2
        RTStatusChangeMsecTimeout = 1000
        SMStatusChangeMsecTimeout = 1000
        OfflineSemaphoreTimeout = 50
        TriggeringServiceName = MARTe.ExternalTimeTriggeringService
        SafetyMsecSleep = 1
        +DDB = {
            Class = DDB
        }
        +Timer = {
            Class = IOGAMs::TimeInputGAM
            TriggeringServiceName = ExternalTimeTriggeringService
            BoardName = TimerBoard
            Signals = {
                time = {
                    SignalName = usecTime
                    SignalType = uint32
                }
                counter = {
                    SignalName = counter
                    SignalType = int32
                }
            }
        }
        +Statistic = {
            Class = WebStatisticGAM
            Verbose = True
            FrequencyOfVerbose = 2000000
            Signals = {
                SignalU = {
                    SignalName = usecTime
                    SignalType = uint32
                }
        		Signal0 = {
                    SignalName = CycleUsecTime
                    SignalType = float
                }
                Signal9 = {
                    SignalName = StatisticAbsoluteUsecTime
                    SignalType = float
                }
                Signal15 = {
                    SignalName = StatisticRelativeUsecTime
                    SignalType = float
                }
            }
        }

        Online = "Timer Statistic"
        Offline = "Timer Statistic"
    }
}
ReloadAll = 0
