function publishCommand(command) {
    let txtMessage = JSON.stringify(command);
    txtMessage = txtMessage.replace(/\\/g, "");
    console.log("pubsub message: " + txtMessage);
    // Only send a message when it is not empty
    if (txtMessage.length > 0) {
        command_topic.publish(txtMessage, (err) => {
            if (err) {
                console.log(err);
                return;
            }
            console.log("publishCommand(): message # " + txtMessage);
        });
    }
    else {
        console.log("publishCommand(): Command is empty - Nothing to send");
    }
}
/************************************************************
 Send prepared command message to the car via PubSub.
 Input:
 - Command object
 Output:
 - none, but the result of the function is that single PubSub message is sent
 ************************************************************/
Send prepared command message to the car via PubSub.
Input:
Command object
Output:
none, but the result of the function is that single PubSub message is sent
Send prepared command message to the car via PubSub . Input : Command object Output : none but the result of the function is that single PubSub message is sent
function publishCommand(command) {
    let txtMessage = JSON.stringify(command);
    txtMessage = txtMessage.replace(/\\/g, "");
    console.log("pubsub message: " + txtMessage);
    if (txtMessage.length > 0) {
        command_topic.publish(txtMessage, (err) => {
            if (err) {
                console.log(err);
                return;
            }
            console.log("publishCommand(): message # " + txtMessage);
        });
    }
    else {
        console.log("publishCommand(): Command is empty - Nothing to send");
    }
}
function publishCommand ( command ) { let txtMessage = JSON . stringify ( command ) ; txtMessage = txtMessage . replace ( / \\ / g , "" ) ; console . log ( "pubsub message: " + txtMessage ) ; if ( txtMessage . length > 0 ) { command_topic . publish ( txtMessage , ( err ) => { if ( err ) { console . log ( err ) ; return ; } console . log ( "publishCommand(): message # " + txtMessage ) ; } ) ; } else { console . log ( "publishCommand(): Command is empty - Nothing to send" ) ; } }
Send prepared command message to the car via PubSub.
Send prepared command message to the car via PubSub .
// Only send a message when it is not empty