receiveTypeMode(inputData) {
        const isAssigned = function(assigned) {
                // None, Port Error, Unknown, Initializing
                return [0x7E, 0x7F, 0xFF, 0x7D].indexOf(assigned) === -1;
            };
        let assignedCount = 0;
        let hadAssignment = false;
        let p             = this._layers[this._pending.command.layer || 0];
        const updateAssigned = (port, assigned, valid, i) => {
                if (valid && (port.assigned === assigned)) {
                    return;
                }
                if (valid) {
                    if (port.assignedTimeout) {
                        clearTimeout(port.assignedTimeout);
                    }
                    port.assigned = assigned;
                } else if (port.assignedTimeout) {
                    this._foundDisconnect = true;
                    if (port.assignedTimeout) {
                        clearTimeout(port.assignedTimeout);
                    }
                    port.assigned = assigned;
                } else {
                    this._foundDisconnect = true;
                    port.assignedTimeout = setTimeout(
                        () => {
                            port.assignedTimeout = null;
                            port.assigned        = assigned;
                        },
                        5000
                    );
                }
            };
        for (let i = 0; i < 4; i++) {
            let value    = inputData[5 + (i * 2)] || 0;
            let assigned = parseInt(messageEncoder.byteString(value), 16);
            if (!isAssigned(assigned)) {
                p[i].mode = null;
            }
            updateAssigned(p[i], assigned, this.isValidAssignedSensor(assigned), i);
            let j = i + 4;
            assigned = inputData[5 + (j * 2)] || 0;
            updateAssigned(p[j], assigned, this.isValidAssignedMotor(assigned));
        }
        return hadAssignment && (assignedCount === 0);
    }
/**
     * Process the inputData for the connected device information.
     *
     * Return true if there was an earlier connection but no connections are found now.
    **/
Process the inputData for the connected device information.
Return true if there was an earlier connection but no connections are found now.
Process the inputData for the connected device information . Return true if there was an earlier connection but no connections are found now .
receiveTypeMode(inputData) {
        const isAssigned = function(assigned) {
                return [0x7E, 0x7F, 0xFF, 0x7D].indexOf(assigned) === -1;
            };
        let assignedCount = 0;
        let hadAssignment = false;
        let p             = this._layers[this._pending.command.layer || 0];
        const updateAssigned = (port, assigned, valid, i) => {
                if (valid && (port.assigned === assigned)) {
                    return;
                }
                if (valid) {
                    if (port.assignedTimeout) {
                        clearTimeout(port.assignedTimeout);
                    }
                    port.assigned = assigned;
                } else if (port.assignedTimeout) {
                    this._foundDisconnect = true;
                    if (port.assignedTimeout) {
                        clearTimeout(port.assignedTimeout);
                    }
                    port.assigned = assigned;
                } else {
                    this._foundDisconnect = true;
                    port.assignedTimeout = setTimeout(
                        () => {
                            port.assignedTimeout = null;
                            port.assigned        = assigned;
                        },
                        5000
                    );
                }
            };
        for (let i = 0; i < 4; i++) {
            let value    = inputData[5 + (i * 2)] || 0;
            let assigned = parseInt(messageEncoder.byteString(value), 16);
            if (!isAssigned(assigned)) {
                p[i].mode = null;
            }
            updateAssigned(p[i], assigned, this.isValidAssignedSensor(assigned), i);
            let j = i + 4;
            assigned = inputData[5 + (j * 2)] || 0;
            updateAssigned(p[j], assigned, this.isValidAssignedMotor(assigned));
        }
        return hadAssignment && (assignedCount === 0);
    }
receiveTypeMode ( inputData ) { const isAssigned = function ( assigned ) { return [ 0x7E , 0x7F , 0xFF , 0x7D ] . indexOf ( assigned ) === - 1 ; } ; let assignedCount = 0 ; let hadAssignment = false ; let p = this . _layers [ this . _pending . command . layer || 0 ] ; const updateAssigned = ( port , assigned , valid , i ) => { if ( valid && ( port . assigned === assigned ) ) { return ; } if ( valid ) { if ( port . assignedTimeout ) { clearTimeout ( port . assignedTimeout ) ; } port . assigned = assigned ; } else if ( port . assignedTimeout ) { this . _foundDisconnect = true ; if ( port . assignedTimeout ) { clearTimeout ( port . assignedTimeout ) ; } port . assigned = assigned ; } else { this . _foundDisconnect = true ; port . assignedTimeout = setTimeout ( ( ) => { port . assignedTimeout = null ; port . assigned = assigned ; } , 5000 ) ; } } ; for ( let i = 0 ; i < 4 ; i ++ ) { let value = inputData [ 5 + ( i * 2 ) ] || 0 ; let assigned = parseInt ( messageEncoder . byteString ( value ) , 16 ) ; if ( ! isAssigned ( assigned ) ) { p [ i ] . mode = null ; } updateAssigned ( p [ i ] , assigned , this . isValidAssignedSensor ( assigned ) , i ) ; let j = i + 4 ; assigned = inputData [ 5 + ( j * 2 ) ] || 0 ; updateAssigned ( p [ j ] , assigned , this . isValidAssignedMotor ( assigned ) ) ; } return hadAssignment && ( assignedCount === 0 ) ; }
Process the inputData for the connected device information.
Process the inputData for the connected device information .
// None, Port Error, Unknown, Initializing