// Get fad control connected function handleFadConnected(wait_state) { var state = dim.state("FAD_CONTROL"); if (state===undefined) return undefined; if (wait_state && wait_state.length>0 && state.name!=wait_state) return wait_state; //dim.log("BIAS_CONTROL: "+state.name+"["+state.index+"]"); switch (state.name) { case "Offline": return undefined; case "Disconnected": console.out("Fad in Diconnected... connect."); dim.send("FAD_CONTROL/START"); return "Connected"; // Do-nothing conditions case "Connecting": return wait_state; // Do-something conditions case "Configuring1": case "Configuring2": case "Configured": console.out("Bias in Configure state... reset."); dim.send("FAD_CONTROL/RESET_CONFIGURE"); return "Connected"; // Final state reached condition case "Connected": case "WritingData": return ""; } throw new Error("FAD_CONTROL:"+state.name+"["+state.index+"] unknown or not handled."); }