Rev

Rev 601 | Blame | Compare with Previous | Last modification | View Log | Download | SVN | Bug Tracker

/*
 *  @author     STF 435
 *  @version    $Id$
 *  @desc       This module provides the functions used by the test component
 *              for SIP-SMS over IMS as specified in 3GPP 24.341 tests.
 *              This module is part of LibSipV2.
 */

module LibSip_SMSFunctions {
    import from LibSip_SMSTypesAndValues all;

    function f_IA5_2oct(
        charstring p_ASCII_String
    ) return octetstring  {
        var integer i;
        var integer j;
        var integer v_Length := lengthof(p_ASCII_String);
        var integer v_Temp;
        var octetstring v_Noctets := ''O;
        var bitstring v_TempBitSrc := ''B;
        var bitstring v_TempBitDes := ''B;

        if ((v_Length <= 0) or (v_Length > 160) or (((v_Length * 7) mod 8) != 0)) {
            log("*** " & __SCOPE__ & "INFO: Invalid value of input string length ***");
        }

        for (i := 0; i < v_Length; i := i + 1) {
            v_Temp := char2int(p_ASCII_String[i]);
            v_TempBitSrc := int2bit(v_Temp, 8);

            for (j := 1; j <= 7; j := j + 1) {

                v_TempBitDes := v_TempBitSrc[8 - j] & v_TempBitDes;

                if (((7 * i + j) mod 8) == 0) {

                    v_Noctets := v_Noctets & bit2oct(v_TempBitDes);
                    v_TempBitDes := ''B;
                }
            }
        }

        return v_Noctets;
    } // f_IA5_2oct

    external function fx_GetSC_TimeStamp(
        integer p_TimeZone
    ) return TP_ServiceCentreTimeStamp_Type;
} // End of module LibSip_SMSFunctions