/** * Call this method upon connecting. We'll see what the capabilities are and set up the * appropriate session. */ private void SetupSessionBasedOnCapabilities() { if (hs.isDetectionValid() != true) { return; } if (hs.isHardwareSniffable() == true) { msg("Monitor is supported! Switching to monitor mode."); hs.setActiveSession(HybridSession.SESSION_TYPE_MONITOR); // at this point, monitor mode is active and it will automatically detect the network if // available. } else { msg("Monitor mode not supported so we'll enable OBD2 scanning."); // switch to OBD2 communications mode hs.setActiveSession(HybridSession.SESSION_TYPE_OBD2); // sanity check if (hs.getRoutineScan() == null) return; // add one or more datapoints to the routine scan class so that it actively scans that PID to // generate DPN arrived events. hs.getRoutineScan().addDPN("RPM"); } // // OBD2? // if (hs.isDetectionValid() == true) { // msg("Detection was successful, switching to OBD mode and adding a few datapoints to the // scan..."); // // switch to OBD mode. // hs.setActiveSession(HybridSession.SESSION_TYPE_OBD2); // // // start with a clean slate // hs.getRoutineScan().removeAllDPNs(); // // add speed and RPM to the routinescan. Routinescan will // // continuously request PIDs and as they are decoded, the // // DPDecoded event will fire. // hs.getRoutineScan().addDPN("SPEED"); // hs.getRoutineScan().addDPN("RPM"); // } }
public AutoSessionOBD(HybridSession hsession, EventCallback newParentOOBMessageHandler) { hs = hsession; mParentOOBMessageHandler = newParentOOBMessageHandler; // set session type to OBD. That's all we'll be doing here. hs.setActiveSession(HybridSession.SESSION_TYPE_OBD2); rs = new RoutineScan(hs.getOBDSession(), hs.getPIDDecoder()); rs.addDPN("RPM"); rs.addDPN("SPEED"); msg("AutoSessionOBD initialized."); }