1

i want to turn off movement and interface of a node, and here i using activeTime=0,1800,25000,42300 settings, the movement inactive but the interface is active. what should i do? is there something missing in the settings section? or how? can you give me some clue?

here the code

public boolean isActive() {
    boolean active;

    if (ah == null) {
        return true; /* no handler: always active */
    }

    active = ah.isActive(this.activenessJitterValue);

    if (active && host.getComBus().getDouble(EnergyModel.ENERGY_VALUE_ID,
                1) <= 0) {
        /* TODO: better way to check battery level */
        /* no battery -> inactive */
        active = false;
    }

    if (active == false && this.transmitRange > 0) {
        /* not active -> make range 0 */
        this.oldTransmitRange = this.transmitRange;
        host.getComBus().updateProperty(RANGE_ID, 0.0);
                    System.out.println("tuyul");
    } else if (active == true && this.transmitRange == 0.0) {
        /* active, but range == 0 -> restore range  */
        host.getComBus().updateProperty(RANGE_ID, 
                this.oldTransmitRange);
    }   
    return active;
}

the problem is "active" always considered to True and never false

  • What node? What code are you using? Please paste the code here – Hari Prasad Apr 02 '19 at 04:48
  • I have added the source code sir, – Peter Gigih Apr 02 '19 at 07:29
  • Have you used debugger to debug the issue? If you step through and inspect each line and variable you will find the problem. Probably isActive is returning true and the second part of the first if statement is returning false. Hence it will never becomes false – Hari Prasad Apr 02 '19 at 09:53
  • I have debugged it sir, and I have found the problem in isActive, but it still points to false when i try again – Peter Gigih Apr 05 '19 at 07:43

0 Answers0