Commit d0463444 authored by berge's avatar berge
Browse files

Added T3Doc to LibItsECall_Functions

parent 4f97ff54
Loading
Loading
Loading
Loading
+113 −48
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@
    
    /**
    * @desc   Establish a call. This function waits for a call incoming event and accepts the call. An optional message box is displayed if msg is not empty.
    * @param msg optional message to display before waiting for incoming call, if the message is an empty charstring no message box is displayed
    * @param  p_establishMessage  Optional message to display before waiting for incoming call, if the message is an empty charstring no message box is displayed
    * @return CallEstablishedEvent
    */
    function f_establishCall(in charstring p_establishMessage := "Establish IVS eCall") runs on PsapMtc return FeedbackResult {
@@ -73,6 +73,10 @@
        return v_feedback;
    }
    
    /**
     * @desc    Wait for reception of an eCall message and voice connection establishment 
     * @param   p_expectedEcallMessage  eCall message to be received
     */
    function f_verifyMSD(in template(present) ECallMessageUnion p_expectedEcallMessage) runs on PsapMtc {
        f_expectFeedback(mw_inbandMsdReceived(PX_WORKER, ?, f_toTemplate(p_expectedEcallMessage)));

@@ -80,10 +84,9 @@
    }
    
    /**
    * @desc Clear down the call.
    *
    * @param clearDownType Type of clear down, NETWORK or APPLICATION
    * @param timeoutBeforeHangUp Time to wait until the call hang up command is issued
    * @desc  Clear down the call
    * @param p_clearDownType        Type of clear down, NETWORK or APPLICATION
    * @param p_timeoutBeforeHangUp  Time to wait until the call hang up command is issued
    */
    function f_clearDown(in ClearDownType p_clearDownType := NETWORK, in float p_timeoutBeforeHangUp := PX_CALL_HANG_UP_DELAY) runs on PsapMtc {
        if (NETWORK == p_clearDownType) {
@@ -105,12 +108,20 @@
        }
    }
    
    /**
     * @desc  Set the eCall message to be sent by simulated IVS
     * @param p_eCall   eCall message to be sent
     */
    function f_setMSD(ECallMessageUnion p_eCall) runs on IvsMtc {
        var ConfigParameters v_newConfig := {eCallMessage := p_eCall};

        eCallControl.send(m_setConfig(PX_WORKERS[0].id, v_newConfig));
    }

    /**
     * @desc  Verify that eCall message is sent 
     * @param p_alAckValue  Expected AL Ack value
     */
    function f_verifyMsdSentSuccesfully(template(present) AckValueType p_alAckValue := c_positiveAlAck) runs on IvsMtc {
        f_expectFeedback(mw_inbandStartSignalReceived(PX_WORKERS[0].id, -, -, true));

@@ -120,6 +131,10 @@
        f_setMSD(vc_eCallMessage);
    }

    /**
     * @desc  Wait for reception of AL Ack message
     * @param p_alAckValue  Expected AL Ack value
     */
    function f_verifyAckReceived(template(present) AckValueType p_alAckValue := c_positiveAlAck) runs on IvsMtc {
        timer t := PX_TIMEOUT;

@@ -145,6 +160,12 @@
        }
    }

    /**
     * @desc  Set the verdict and stop the testcase
     * @param p_verdict     Verdict value
     * @param p_reason      Success/Failure description
     * @verdict 
     */
    function f_stopTestcase(in verdicttype p_verdict, in charstring p_reason) runs on ECallMtc {
        setverdict(p_verdict, p_reason);

@@ -153,7 +174,11 @@
        stop;
    }
      
    function f_setSimulatorConfiguration(in template(value) ConfigParameters p_configuration) runs on PsapMtc {
    /**
    * @desc Sets the initial simulator configuration (PSAP mode), all previous state is lost.
    * @param p_configuration Configuration to use
    */      
    function f_setSimulatorConfigurationPsap(in template(value) ConfigParameters p_configuration) runs on PsapMtc {

        var ConfigParameters v_ivsConfig := {mode := IVS};

@@ -171,12 +196,11 @@
    }

    /**
* @desc Sets the initial simulator configuration, all previous state is lost.
*
* @param workerConf worker to use
* @param configuration configuration to use
    * @desc Sets the initial simulator configuration (IVS mode), all previous state is lost.
    * @param p_workerConf    Worker to use
    * @param p_configuration Configuration to use
    */
    function f_setSimulatorConfiguration2(in WorkerConf p_workerConf, in  template(value) ConfigParameters p_configuration) runs on IvsMtc {
    function f_setSimulatorConfigurationIvs(in WorkerConf p_workerConf, in  template(value) ConfigParameters p_configuration) runs on IvsMtc {
        var ECallMessageUnion v_eCallMessageExpanded := valueof(f_expandMsd(p_configuration.eCallMessage));
        var ConfigParameters v_psapConfig := {mode := PSAP};
        
@@ -197,6 +221,13 @@
        f_expectFeedback(p_e := mw_ivsConfigChanged(p_workerConf.id, ?, p_configuration), p_ignoreOtherMessages := true);
    }

    /**
     * @desc   Wait for a specific event
     * @param  p_e                      Expected event to be received 
     * @param  p_event_timeout          Timeout value for receiving the event
     * @param  p_ignoreOtherMessages    Whether other events shall be ignored or not
     * @return FeedbackResult           Received event if reception is successful, or failure
     */
    function f_expectFeedback(template Event p_e, float p_event_timeout := PX_TIMEOUT, in boolean p_ignoreOtherMessages := false) runs on ECallMtc return FeedbackResult {
        timer t := p_event_timeout;
        var Event v_received;
@@ -230,7 +261,7 @@
    /**
    * @desc   Decodes the encoded eCallMessage if it valid and sets the decoded field of ECallMessageUnion,
    *         otherwise the ECallMessageUnion is unchanged.
    *
    * @param  p_eCallMessageUnion   eCall message to be decoded
    * @return ECallMessageUnion with the decoded field set (if the input is valid), otherwise unchanged
    */
    function f_expandMsd(in template(present) ECallMessageUnion p_eCallMessageUnion) return template(present) ECallMessageUnion {
@@ -248,8 +279,7 @@
    }

    /**
    * @desc Generates a template from the given
    *
    * @desc   Generates a template from the given eCall message
    * @return ECallMessageUnion with the decoded field set (if the input is valid), otherwise unchanged
    */
    function f_toTemplate(in template(present) ECallMessageUnion p_eCallMessage) return template(present) ECallMessageUnion {
@@ -275,14 +305,22 @@
    }
      
    group altsteps {
        altstep a_default_ui_behaviour() runs on IvsMtc {
        
        /**
         * @desc   Default for User Interface
         * @remark Ignores message box selection
         */
        altstep a_defaultUi() runs on IvsMtc {
            // ignore message box selection by default
            [] uiPort.receive(MessageBoxSelection:?) {
                repeat;
            }
        }
           
        altstep a_default_behaviour() runs on IvsMtc {
        /**
         * @desc Default for IVS mode
         */
        altstep a_defaultIvs() runs on IvsMtc {
            var Event v_event;

            [] eCallFeedback.receive(LogMessage:?) {
@@ -355,7 +393,10 @@
            }
        }

        altstep a_unexpectedEvents() runs on PsapMtc {
        /**
         * @desc Default for PSAP mode
         */        
        altstep a_defaultPsap() runs on PsapMtc {
            var Event v_event;

            [] uiPort.receive {
@@ -393,6 +434,10 @@
          
    group configurationFunctions {
     
        /**
         * @desc  Setup fonction for IVS test system      
         * @param p_configuration   Simulator's configuration parameters (PSAP mode)
         */
        function f_configIvsUp(in template(value) ConfigParameters p_configuration) runs on PsapMtc {
            vc_logComponent := LogComponent.create("Log Component");
            vc_uiComponent := UIComponent.create("UIComponent");
@@ -403,16 +448,20 @@
            connect(self:uiPort, vc_uiComponent:uiPort);

            vc_logComponent.start(f_logBehaviour());
            vc_uiComponent.start(uiComponentBehaviour());
            vc_uiComponent.start(f_uiComponentBehaviour());

            activate(a_unexpectedEvents());
            activate(a_defaultPsap());
 
            f_setSimulatorConfiguration(p_configuration);
            f_setSimulatorConfigurationPsap(p_configuration);

            vc_initialized := true;
            
        } // end f_configIvsUp

        /**
         * @desc  Setup fonction for PSAP test system      
         * @param p_configuration   Simulator's configuration parameters (IVS mode)
         */      
        function f_configPsapUp(in template(value)ConfigParameters p_configuration) runs on IvsMtc {
            vc_logComponent := LogComponent.create("LogComponent");
            vc_uiComponent := UIComponent.create("UIComponent");
@@ -423,17 +472,20 @@
            connect(self:uiPort, vc_uiComponent:uiPort);

            vc_logComponent.start(f_logBehaviour());
            vc_uiComponent.start(uiComponentBehaviour());
            vc_uiComponent.start(f_uiComponentBehaviour());

            activate(a_default_ui_behaviour());
            activate(a_default_behaviour());
            activate(a_defaultUi());
            activate(a_defaultIvs());

            f_setSimulatorConfiguration2(PX_WORKERS[0], p_configuration);
            f_setSimulatorConfigurationIvs(PX_WORKERS[0], p_configuration);
          
            vc_initialized := true;
          
        } // end f_configPsapUp

        /**
         * @desc Tear down test system configuration
         */
        function f_configDown() runs on ECallMtc {
            if (getverdict == none) {
                setverdict(pass);
@@ -460,8 +512,8 @@
        /**
        * @desc   The time elapsed time between <code>first</code> and <code>second</code> in milliseconds. The format of the timestamp is assumed to be <code>yyyy-MM-dd'T'HH:mm:ss.SSS</code>.
        *
        * @param first first timestamp
        * @param second second timestamp
        * @param  p_first    First timestamp
        * @param  p_second   Second timestamp
        * @return second - first (in milliseconds)
        */
        external function fx_timeDiff(charstring p_first, charstring p_second) return integer;
@@ -469,24 +521,26 @@
        /**
        * @desc   Return a <code>charstring</code> containing onliy the time from the given timestamp. The format of the timestamp is assumed to be <code>yyyy-MM-dd'T'HH:mm:ss.SSS</code>
        *
        * @param ts timestamp to extract time from
        * @param  p_ts  Timestamp to extract time from
        * @return Time in the format <code>HH:mm:ss.SSS</code>
        */
        external function fx_extractTime(charstring p_ts) return charstring;

        /**
        * @desc Return the charstring representation of a float.
        * @desc   Convert float to charstring
        * @param  p_f   The float to be converted
        * @return The charstring representation of a float.
        */
        external function fx_float2str(float p_f) return charstring;

        /**
        * @desc Check if the time between <code>timestamp1</code> and <code>timestamp2</code> is less than <code>timeoutDuration</code>
        *
        * @param timestamp1 first timestamp (format <code>HH:mm:ss.SSS</code>)
        * @param timestamp2 second timestamp (format <code>HH:mm:ss.SSS</code>)
        * @param timeoutDuration max difference between <code>timestamp1</code> and <code>timestamp2</code>
        * @param passMsg message to use for pass verdict
        * @param failMsg message to use for fail verdict
        * @param  p_timestamp1       First timestamp (format <code>HH:mm:ss.SSS</code>)
        * @param  p_timestamp2       Second timestamp (format <code>HH:mm:ss.SSS</code>)
        * @param  p_timeoutDuration  Max difference between <code>timestamp1</code> and <code>timestamp2</code>
        * @param  p_passMsg          Message to use for pass verdict
        * @param  p_failMsg          Message to use for fail verdict
        *
        * @return <code>true</code> if <code>timestamp2 - timestamp1 <= timeoutDuration</code>, <code>false</code> otherwise
        */
@@ -506,6 +560,10 @@
        }
    } // end utilityFunctions

    /**
     * @desc    Request user to perfrom an action 
     * @param   p_msg   Description of the action to be performed 
     */
    function f_userAction(in charstring p_msg) runs on ECallMtc {
        var integer v_button := f_messageBox("Action", p_msg, {"Done", "Cancel"}, 0);
        if (v_button != 0) { // message box was closed or cancel was clicked
@@ -513,6 +571,14 @@
        }
    }

    /**
     * @desc    Request user to verify something
     * @param   p_question      Verification to be performed by the user
     * @param   p_passMessage   Verdict message for success
     * @param   p_failMessage   Verdict message for failure
     * @param   p_passOption    Expected success answer
     * @verdict Pass if user's response matches p_passOption. Fail otherwise
     */
    function f_userVerify(in charstring p_question, in charstring p_passMessage, in charstring p_failMessage, in integer p_passOption := c_mbYes) runs on ECallMtc {
        var integer v_button := f_messageBoxYesNo("Verify", p_question);
        if (v_button == p_passOption) {
@@ -566,5 +632,4 @@
            }
        }
    }          
          
}
+31 −3
Original line number Diff line number Diff line
@@ -16,10 +16,17 @@ module LibLogger {

    group componentsAndPorts {
        
        /**
         * @desc Port for receiving log messages
         */
        type port LogMessagePort message {
            in LogMessage;
        }
    
        /**
         * @desc   Log component 
         * @member logPort
         */
        type component LogComponent {
            port LogMessagePort logPort;
        }
@@ -27,11 +34,22 @@ module LibLogger {
    } // end componentsAndPorts
    
    group types {
        
        /**
         * @desc Definition of Log level
         */        
        type enumerated LogLevel {
            e_debug,
            e_info
        }
      
        /**
         * @desc   Log message
         * @member worker   ID of the worker emitting this log message 
         * @member time     Timestamp
         * @member level    Criticality of the log message
         * @member text     Log message
         */
        type record LogMessage {
            integer worker,
            charstring time,
@@ -48,6 +66,10 @@ module LibLogger {
    } // end types

    group templates {
        
        /**
         * @desc Receive template for 'debug' log message
         */
        template LogMessage mw_debugLogMessage := {
            worker := ?,
            time := ?,
@@ -55,6 +77,9 @@ module LibLogger {
            text := ?
        }

        /**
         * @desc Receive template for 'info' log message
         */
        template LogMessage mw_infoLogMessage := {
            worker := ?,
            time := ?,
@@ -66,6 +91,9 @@ module LibLogger {
    
    group functions {
    
        /**
         * @desc Behaviour function for Log component 
         */
        function f_logBehaviour() runs on LogComponent {
            var LogMessage v_logMessage;

+47 −9
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@
 */
module LibUserInterface {

    /**
     * @desc List of button labels
     */
    type record of charstring ButtonLabels;

    /**
@@ -21,9 +24,19 @@ module LibUserInterface {
    */
    modulepar integer MESSAGEBOX_DISPLAY_TIME := 10;

    /**
     * @desc Constant value for 'yes' button 
     */
    const integer c_mbYes := 0;
    
    /**
     * @desc Constant value for 'no' button 
     */    
    const integer c_mbNo := 1;

    /**
     * @desc Messagebox request template for establishing IVS call
     */
    template ShowMessageBox m_stablishECallMgs := {
        title := "Establish IVS eCall",
        msg := "Establish IVS eCall",
@@ -38,7 +51,7 @@ module LibUserInterface {
    * @member msg               MessageBox message
    * @member buttonLables      MessageBox button labels
    * @member defaultSelection  MessageBox default button selection
    * @member msgTimeout optional MessageBox timeout, the message box is hidden after msgTimeout seconds if no button is selected by the user
    * @member msgTimeout        Optional MessageBox timeout, the message box is hidden after msgTimeout seconds if no button is selected by the user
    */
    type record ShowMessageBox {
        charstring title,
@@ -54,23 +67,39 @@ module LibUserInterface {
    type integer MessageBoxSelection;

    /**
    * @desc Port for ui commands to a UIComponent
    * @desc Port for UI commands to a UIComponent
    */
    type port UIPort message {
        inout ShowMessageBox, MessageBoxSelection;
    }

    /**
    * @desc Component for displaying ui messages
    * @desc Component for displaying non blocking UI messages
    */
    type component UIComponent {
        port UIPort uiPort;
    }

    /**
     * @desc   Display a blocking messagebox to the user 
     * @param  p_title              Title of the messagebox
     * @param  p_message            Text to be displayed in the messagebox
     * @param  p_buttonLabels       Buttons definition
     * @param  p_defaultSelection   Default button 
     * @param  p_msgTimeout         Timeout value for displaying the messagebox
     * @return Value of the button pressed by the user
     */
    function f_messageBox(in charstring p_title, in charstring p_message, in ButtonLabels p_buttonLabels, in integer p_defaultSelection := 0, in integer p_msgTimeout := 0) return integer {
        return fx_messageBox(p_title, p_message, p_buttonLabels, p_defaultSelection, p_msgTimeout);
    } // end f_messageBox

    /**
     * @desc   Display a blocking YesNo messagebox to the user 
     * @param  p_title              Title of the messagebox
     * @param  p_message            Text to be displayed in the messagebox
     * @return Value of the button pressed by the user
     * @see    f_messageBox()
     */
    function f_messageBoxYesNo(in charstring p_title, in charstring p_message) return integer {
        return f_messageBox(p_title, p_message, {"Yes", "No"});
    } // end f_messageBoxYesNo
@@ -79,7 +108,7 @@ module LibUserInterface {
    /**
    * @desc Default behaviour for UIComponent
    */
    function uiComponentBehaviour() runs on UIComponent {
    function f_uiComponentBehaviour() runs on UIComponent {
        var ShowMessageBox v_showMessageBoxCmd;

        alt {
@@ -108,6 +137,15 @@ module LibUserInterface {
    
    group externalFunctions {
        
        /**
         * @desc   Display a blocking messagebox to the user 
         * @param  p_title              Title of the messagebox
         * @param  p_message            Text to be displayed in the messagebox
         * @param  p_buttonLabels       Buttons definition
         * @param  p_defaultSelection   Default button 
         * @param  p_msgTimeout         Timeout value for displaying the messagebox
         * @return Value of the button pressed by the user
         */
        external function fx_messageBox(in charstring p_title, in charstring p_message, in ButtonLabels p_buttonLabels, in integer p_defaultSelection, in integer p_msgTimeout) return integer;
        
    } // externalFunctions