dist/lib/bridge.js
//DECODE service center ( SC ) to MS ( mobile station switched on with SIM module )
DECODE service center ( SC ) to MS ( mobile station switched on with SIM module )
DECODE service center ( SC ) to MS ( mobile station switched on with SIM module )
function decodePdu(pdu) {
    return new Promise(function (resolve, reject) {
        (function () {
            var resolve_src = resolve;
            resolve = function (_sms) {
                var sms = _sms;
                if (sms.type === TP_MTI.SMS_DELIVER && sms.text === "") {
                    var sms_alt = void 0;
                    try {
                        sms_alt = decodePduWithNodePdu(pdu);
                    }
                    catch (_a) {
                        sms_alt = undefined;
                    }
                    if (!!sms_alt && !sms_alt.text.match(/�/g)) {
                        sms.text = sms_alt.text;
                    }
                }
                resolve_src(sms);
            };
        })();
        (function () {
            var reject_src = reject;
            reject = function (error) {
                try {
                    resolve(decodePduWithNodePdu(pdu));
                    return;
                }
                catch (_a) { }
                reject_src(error);
            };
        })();
        bridge("smsDeliver", { pdu: pdu }, function (error, obj) {
            if (!!error) {
                reject(error);
                return;
            }
            ;
            var smsDescriptor = (function parseDates(obj) {
                var parseDate = function (str) {
                    var date = new Date(str);
                    var userTimezoneOffset = date.getTimezoneOffset() * 60000;
                    date = new Date(date.getTime() - userTimezoneOffset);
                    return date;
                };
                if (obj.date)
                    obj.date = parseDate(obj.date);
                if (obj.type === 2) {
                    if (obj.sr.dt)
                        obj.sr.dt = parseDate(obj.sr.dt);
                    if (obj.sr.scts)
                        obj.sr.scts = parseDate(obj.sr.scts);
                }
                return obj;
            })(obj);
            var smsInstance = descriptorToInstance(smsDescriptor);
            resolve(smsInstance);
        });
    });
}
function decodePdu ( pdu ) { return new Promise ( function ( resolve , reject ) { ( function ( ) { var resolve_src = resolve ; resolve = function ( _sms ) { var sms = _sms ; if ( sms . type === TP_MTI . SMS_DELIVER && sms . text === "" ) { var sms_alt = void 0 ; try { sms_alt = decodePduWithNodePdu ( pdu ) ; } catch ( _a ) { sms_alt = undefined ; } if ( ! ! sms_alt && ! sms_alt . text . match ( / �/g ) ) { sms . text = sms_alt . text ; } } resolve_src ( sms ) ; } ; } ) ( ) ; ( function ( ) { var reject_src = reject ; reject = function ( error ) { try { resolve ( decodePduWithNodePdu ( pdu ) ) ; return ; } catch ( _a ) { } reject_src ( error ) ; } ; } ) ( ) ; bridge ( "smsDeliver" , { pdu : pdu } , function ( error , obj ) { if ( ! ! error ) { reject ( error ) ; return ; } ; var smsDescriptor = ( function parseDates ( obj ) { var parseDate = function ( str ) { var date = new Date ( str ) ; var userTimezoneOffset = date . getTimezoneOffset ( ) * 60000 ; date = new Date ( date . getTime ( ) - userTimezoneOffset ) ; return date ; } ; if ( obj . date ) obj . date = parseDate ( obj . date ) ; if ( obj . type === 2 ) { if ( obj . sr . dt ) obj . sr . dt = parseDate ( obj . sr . dt ) ; if ( obj . sr . scts ) obj . sr . scts = parseDate ( obj . sr . scts ) ; } return obj ; } ) ( obj ) ; var smsInstance = descriptorToInstance ( smsDescriptor ) ; resolve ( smsInstance ) ; } ) ; } ) ; }
DECODE service center ( SC ) to MS ( mobile station switched on with SIM module )
DECODE service center ( SC ) to MS ( mobile station switched on with SIM module )