encoder/bin/Ais2JsonClient.js
function (job, callback) {
    
    // decode AIS message ignoring any not AIDVM paquet
    var nmea= job.toString ('ascii');
    var ais = new AisDecode (nmea);


    // if message valid and mssi not excluded by --mmsi option
    if (ais.valid) {
        // Some cleanup to make JSON/AIS more human readable
        delete ais.bitarray;
        delete ais.valid;
        delete ais.length;
        delete ais.channel;
        delete ais.repeat;
        delete ais.navstatus;
        delete ais.utc;
        ais.lon = (parseInt(ais.lon * 10000))/10000;
        ais.lat = (parseInt(ais.lat * 10000))/10000;
        ais.sog = (parseInt(ais.sog * 10))/10;
        ais.cog = (parseInt(ais.cog * 10))/10;

        // we do not need class for each navigation report
        if (ais.msgtype === 18 || ais.msgtype === 3) {
            delete ais.class;
        }
        MsgCount ++;
        // push AIS usefull info to user
        if (DumpFd !== null) {
            fs.writeSync (DumpFd,MsgCount + " , " +JSON.stringify (ais)+'\n');
        }
        if ((MmsiFilter===null || MmsiFilter===parseInt(ais.mmsi)) 
           && (TypeFilter===null || TypeFilter===parseInt(ais.msgtype))){
           console.log ("-%d- %s", MsgCount, JSON.stringify (ais));
        }
        if (Verbose) console.log ("-%d- %s", MsgCount, nmea)

    } else {
        if (Verbose) console.log ("\n-***- %s", nmea)
    }

    // we're done let's move to next job in queue
    callback();
}
function (job, callback) {
    
    // decode AIS message ignoring any not AIDVM paquet
    var nmea= job.toString ('ascii');
    var ais = new AisDecode (nmea);


    // if message valid and mssi not excluded by --mmsi option
    if (ais.valid) {
        // Some cleanup to make JSON/AIS more human readable
        delete ais.bitarray;
        delete ais.valid;
        delete ais.length;
        delete ais.channel;
        delete ais.repeat;
        delete ais.navstatus;
        delete ais.utc;
        ais.lon = (parseInt(ais.lon * 10000))/10000;
        ais.lat = (parseInt(ais.lat * 10000))/10000;
        ais.sog = (parseInt(ais.sog * 10))/10;
        ais.cog = (parseInt(ais.cog * 10))/10;

        // we do not need class for each navigation report
        if (ais.msgtype === 18 || ais.msgtype === 3) {
            delete ais.class;
        }
        MsgCount ++;
        // push AIS usefull info to user
        if (DumpFd !== null) {
            fs.writeSync (DumpFd,MsgCount + " , " +JSON.stringify (ais)+'\n');
        }
        if ((MmsiFilter===null || MmsiFilter===parseInt(ais.mmsi)) 
           && (TypeFilter===null || TypeFilter===parseInt(ais.msgtype))){
           console.log ("-%d- %s", MsgCount, JSON.stringify (ais));
        }
        if (Verbose) console.log ("-%d- %s", MsgCount, nmea)

    } else {
        if (Verbose) console.log ("\n-***- %s", nmea)
    }

    // we're done let's move to next job in queue
    callback();
}
function ( job , callback ) { // decode AIS message ignoring any not AIDVM paquet var nmea = job . toString ( 'ascii' ) ; var ais = new AisDecode ( nmea ) ; // if message valid and mssi not excluded by --mmsi option if ( ais . valid ) { // Some cleanup to make JSON/AIS more human readable delete ais . bitarray ; delete ais . valid ; delete ais . length ; delete ais . channel ; delete ais . repeat ; delete ais . navstatus ; delete ais . utc ; ais . lon = ( parseInt ( ais . lon * 10000 ) ) / 10000 ; ais . lat = ( parseInt ( ais . lat * 10000 ) ) / 10000 ; ais . sog = ( parseInt ( ais . sog * 10 ) ) / 10 ; ais . cog = ( parseInt ( ais . cog * 10 ) ) / 10 ; // we do not need class for each navigation report if ( ais . msgtype === 18 || ais . msgtype === 3 ) { delete ais . class ; } MsgCount ++ ; // push AIS usefull info to user if ( DumpFd !== null ) { fs . writeSync ( DumpFd , MsgCount + " , " + JSON . stringify ( ais ) + '\n' ) ; } if ( ( MmsiFilter === null || MmsiFilter === parseInt ( ais . mmsi ) ) && ( TypeFilter === null || TypeFilter === parseInt ( ais . msgtype ) ) ) { console . log ( "-%d- %s" , MsgCount , JSON . stringify ( ais ) ) ; } if ( Verbose ) console . log ( "-%d- %s" , MsgCount , nmea ) } else { if ( Verbose ) console . log ( "\n-***- %s" , nmea ) } // we're done let's move to next job in queue callback ( ) ; }
Notice method is called by async within unknow context !!!!
Notice method is called by async within unknow context !!!!