|
|
|
The following example is taken from the OBDII Plugin.
public override string CF_pluginData(string command, string param1) { string retvalue = ""; switch (command) { case "SENSOR1": retvalue = sensordata[0, 0]; break; case "SENSOR2": retvalue = sensordata[0, 1]; break; case "SENSOR3": retvalue = sensordata[0, 2]; break; case "SENSOR4": retvalue = sensordata[0, 3]; break; case "SENSOR5": retvalue = sensordata[0, 4]; break; case "SENSOR6": retvalue = sensordata[0, 5]; break; case "SENSOR7": retvalue = sensordata[0, 6]; break; case "SENSOR8": retvalue = sensordata[0, 7]; break; case "SENSOR9": retvalue = sensordata[1, 0]; break; case "SENSOR10": retvalue = sensordata[1, 1]; break; case "SENSOR11": retvalue = sensordata[1, 2]; break; case "SENSOR12": retvalue = sensordata[1, 3]; break; case "SENSOR13": retvalue = sensordata[1, 4]; break; case "SENSOR14": retvalue = sensordata[1, 5]; break; case "SENSOR15": retvalue = sensordata[1, 6]; break; case "SENSOR16": retvalue = sensordata[1, 7]; break; } return retvalue; }
The following shows how the above CF_pluginData() function would be invoked by the caller using CF_getPluginData().
// Get the current speed of vehicle string speed = CF_getPluginData("OBDII", "SENSOR1", "");
// Get the current rpm of vehicle string rpm = CF_getPluginData("OBDII", "SENSOR2", "");
The following example is taken from the Web Plugin.
public override void CF_pluginCommand(string command, string param1, string param2) { try { // Make sure plugin has been loaded, if not, load if(firstshow) { this.loadWeb(); firstshow = false; } switch(command.ToUpper()) { case "BROWSE": // ................... // ................... // web plugin code runs here to browse to url passed in by param1 // ................... // ................... break; } }s catch(Exception errmsg) { CFTools.writeError(errmsg.Message, errmsg.StackTrace); } }
The following shows how the above CF_pluginCommand() function would be invoked by the caller using CF_systemCommand().
// Open browser screen in fullscreen mode CF_systemCommand(CF_Actions.PLUGIN, "WEB", "BROWSE", "http://www.fluxmedia.net", "FULLSCREEN");
// Open browser screen in normal mode CF_systemCommand(CF_Actions.PLUGIN, "WEB", "BROWSE", "http://www.fluxmedia.net");
CF_systemCommand(CF_Actions.PLUGIN, "EMAIL", "COMPOSE", [REPLYTO], [SUBJECT]);
where [REPLYTO] and [SUBJECT] refer to the email address that should be sent in the the headers as the reply-to email address, and the subject line of the email. The email body is entered dynamically by the user using quick-reply messages, voice recording as an attachment, or a normal reply using the OSK.
// Open browser screen in fullscreen mode CF_systemCommand(CF_Actions.PLUGIN, "WEB", "BROWSE", "http://www.fluxmedia.net", "FULLSCREEN");
// Open browser screen in normal mode CF_systemCommand(CF_Actions.PLUGIN, "WEB", "BROWSE", "http://www.fluxmedia.net");
// Connect to WiFi network specified by SSID CF_systemCommand(CF_Actions.PLUGIN, "WIFI", "CONNECT", [NETWORKSSID]);
where [NETWORKSSID] refers to the Wifi SSID associated with the access point / network that is being connected to.
// Disconnect current wifi connection CF_systemCommand(CF_Actions.PLUGIN, "WIFI", "DISCONNECT");
string data = CF_getPluginData("OBDII", [SENSORNUMBER], "");
where [SENSORNUMBER] is equal to one of the following strings:
| [SENSORNUMBER] | Returned Value |
| "SENSOR1" | Speed |
| "SENSOR2" | RPM |
| "SENSOR3" | Air Intake |
| "SENSOR4" | Coolant Temperature |
| "SENSOR5" | Engine Load |
| "SENSOR6" | Air Flow Rate |
| "SENSOR7" | Fuel Pressure |
| "SENSOR8" | Intake Pressure |
| "SENSOR9" | Timing Advance |
| "SENSOR10" | Throttle Position |
| "SENSOR11" | Short Term Fuel Trim |
| "SENSOR12" | Fuel System Status |
| "SENSOR13" | PTO Status |
| "SENSOR14" | Long Term Fuel Trim |
| "SENSOR15" | Engine Run Time |
| "SENSOR16" | OBD Requirements |
| Copyright © 2008 Flux Media, Inc. (U.S. Copyright Registration Number: TXu-1-239-794) |
|