docs: function JobQueue (job, callback) {
       // ignore null job but notify the queue.
       var device;
  
      if (job === null) {
           callback (null);
           return;
      }
      
      var gateway = job.gateway;
      var status = 0;
      
      // set few defaults
      if (job.timeout === undefined) job.timeout=0;  // no retry
      if (job.retry   === undefined) job.retry  =0;  // retry counter
      if (job.args    === undefined) job.args   =""; // optional arguments
      
      gateway.Debug (4,"Queue Request=%s DevId=%s Command=%s Retry=%d", job.request, job.devId, job.command, job.retry);
      
      // broadcast command loop on active device list to split commands
      if (parseInt (job.devId) === 0) {
          var subrqst=1;
          for (var devid in gateway.activeClients) {
              // we only broadcast to device with a valid TCP session
              if (device && device.socket !== null) {
                  var request = {
                    gateway : job.gateway,
                    devId  : gateway.activeClients[devid].devid,
                    command: job.command,
                    request: [job.request, subrqst++],
                    retry  : job.retry, 
                    timeout: job.timeout
                  };
              gateway.queue.push (request, JobCallback); // broadcast to all active devices
              }
          }
          var broadcast = {
              gateway  : job.gateway,
              command : 'Broadcast',
              request : [request, subrqst++]
          };
          callback (broadcast);
          return;
      };
      
      // search for devId withing global active devices list
      if (gateway.activeClients [job.devId] !== undefined) {
          // device is present check if it is logged
          gateway.Debug (5,"Queue Request=%s DevId=%s Command=%s args=%s Sent", job.request, job.devId, job.command, job.args);
          device  = gateway.activeClients [job.devId];
          status  = device.RequestAction (job.command, job.args);
      } else {
          gateway.event.emit ("queue","NOTLOG",job);
          status = 1; // device not present in active list
      }
  
      // process status result and notify callback function
      switch (status) {
          case 0 : // command was accepted by device
              // wait JOB_QUEUE_PAUSE time before processing Job next request
              gateway.queue.pause ();
              setTimeout(function () {gateway.queue.resume();}, JOB_QUEUE_TIMER);
              gateway.event.emit ("queue", "ACCEPT", job);
              break;
              
          case 1: // device not present command will be retry later  
              if (job.timeout === 0) break;     // no retry
              if (job.timeout >= new Date()) {  // check time out and either push or notify users
                  job.retry ++;
                  gateway.event.emit ("queue", "RETRY", job);
                  setTimeout(function () {gateway.queue.push (job, JobCallback);}, JOB_RETRY_TIMER);
              } else {
                  gateway.event.emit ("queue", "TIMEOUT", job);
              }                
              break;
                 
          case -1 : // device exits but command was refused
              gateway.event.emit ("queue", "REFUSED", job);
              break;
              
          case -2 : // device does not exist in active device list
              gateway.event.emit ("queue", "UNKNOWN", job);
              break;
                 
          default:
              gateway.Debug (2,"Hoops invalid status code: Device DevId=%s Status=%s", job.devId, status);
              break;
      }
      callback (job);
  }