#include <Scripting.h>
Public Member Functions | |
| Scripting (wxWindow *pParent, MapControl *pctlMap) | |
| Scripting constructor - initialize all variables. | |
| ~Scripting () | |
| Destructor - free all memory. | |
| void | Pump () |
| Pump everything. | |
| bool | RunFromFile (wxString strFilename) |
| Run a script from a file. | |
| bool | AddTCPServer (int iPort, bool bLocalConnectionsOnly) |
| Listen on a TCP port for connection for scripting commands. | |
| void | DeleteAllTCPServers () |
| Delete all TCP servers. | |
Static Public Member Functions | |
| static bool | WriteWaypointToFile (wxString strFilename, bool bAppend, const MapMarker &cMarker) |
| Writes a MapMarker to the specified file (add_waypoint command). | |
Private Member Functions | |
| void | PumpScripts () |
| Processes queued up events - best if run from the main thread of the application, in OnIdle or a timer. | |
| void | PumpServers () |
| Accept connections on any servers running. | |
| void | AddScript (wxInputStream *pInputStream, wxOutputStream *pOutputStream, wxSocketBase *pSocket) |
| Internal function to add script to list. | |
| void | AddServer (wxSocketServer *pServer) |
| Internal function to add server to list. | |
| std::list< wxString > | ExecuteCommand (wxString strCmdAndArgs) |
| Low level function to perform the command in a string. | |
| std::list< wxString > | ExecuteCommand (std::list< wxString > vCmdAndArgs) |
| std::list< wxString > | CommandAddWaypoint (wxString strCmd, std::list< wxString > vArgs) |
| add_waypoint command | |
| std::list< wxString > | CommandGetWaypoint (wxString strCmd, std::list< wxString > vArgs) |
| get_waypoint command | |
| std::list< wxString > | CommandDeleteWaypoint (wxString strCmd, std::list< wxString > vArgs) |
| delete_waypoint command | |
| std::list< wxString > | CommandExit (wxString strCmd, std::list< wxString > vArgs) |
| exit command | |
Static Private Member Functions | |
| static wxString | CompileCommand (std::list< wxString > vCmdAndArgs) |
Private Attributes | |
| MapControl * | m_pctlMap |
| associated map control | |
| std::vector< ScriptStream * > | m_vScripts |
| Streams associated with this scripting engine. | |
| wxMutex | m_mtxScripts |
| Mutex protecting m_vScripts. | |
| std::vector< wxSocketServer * > | m_vServers |
| Socket servers associated with this engine. | |
| wxMutex | m_mtxServers |
| Mutex protecting m_vServers. | |
| wxWindow * | m_pParent |
| Parent window. | |
ADD_WAYPOINT <name> <visible> <call_out> <small_label> <icon_filename> <long> <lat> [scale_icon]
ADD_WAYPOINT <name> <visible> <call_out> <small_label> <icon_filename> <street_#> <street_name> <street_type> <city> <state> [scale_icon]
where:
<name> is the name of the waypoint being created or updated.
<visible> is either 1 or 0, indicating if the waypoint should be visible or not.
<call_out> is either 1 or 0, indicating if a callout box should be shown or not.
<small_label> is either 1 or 0, indicating if a small label just showing the waypoint name should be visible or not.
<icon_filename> is the name of the icon that should be shown for the marker. It may be blank to have no icon shown.
[scale_icon] is optional and is either 1 or 0, indicating if the waypoint's icon should be scaled based on the zoom level of the map.
<long> is the longitude of the marker. If must be in ddd.ddddddd format at this time.
<lat> is the latitude of the marker. If must be in ddd.ddddddd format at this time.
<street_#> is the street number of the marker's address.
<street_name> is the street name of the marker's address.
<street_type> is the street type of the marker's address (drive, lane, road, etc.).
<city> is the city of the marker's address.
<state> is the state of the marker's address.
The scripting engine can also read commands from ordinary text files. In the typical use case, on the car computer, in preferences, the startup script enabled option would be checked, and Roadnav would read the script from a USB stick or other removable media. The script would be generated on a different computer, generally a desktop machine. This way, waypoints and other settings can be configured from the convenience of a desktop machine, and then fed into a (typically keyboard-less) car computer for actual use.
Definition at line 154 of file Scripting.h.
| Scripting::Scripting | ( | wxWindow * | pParent, | |
| MapControl * | pctlMap | |||
| ) |
| Scripting::~Scripting | ( | ) |
| void Scripting::Pump | ( | ) |
| bool Scripting::RunFromFile | ( | wxString | strFilename | ) |
| bool Scripting::AddTCPServer | ( | int | iPort, | |
| bool | bLocalConnectionsOnly | |||
| ) |
Listen on a TCP port for connection for scripting commands.
Definition at line 386 of file Scripting.cpp.
| void Scripting::DeleteAllTCPServers | ( | ) |
| bool Scripting::WriteWaypointToFile | ( | wxString | strFilename, | |
| bool | bAppend, | |||
| const MapMarker & | cMarker | |||
| ) | [static] |
Writes a MapMarker to the specified file (add_waypoint command).
Definition at line 694 of file Scripting.cpp.
| void Scripting::PumpScripts | ( | ) | [private] |
Processes queued up events - best if run from the main thread of the application, in OnIdle or a timer.
Definition at line 191 of file Scripting.cpp.
| void Scripting::PumpServers | ( | ) | [private] |
| void Scripting::AddScript | ( | wxInputStream * | pInputStream, | |
| wxOutputStream * | pOutputStream, | |||
| wxSocketBase * | pSocket | |||
| ) | [private] |
| void Scripting::AddServer | ( | wxSocketServer * | pServer | ) | [private] |
| std::list< wxString > Scripting::ExecuteCommand | ( | wxString | strCmdAndArgs | ) | [private] |
Low level function to perform the command in a string.
Definition at line 434 of file Scripting.cpp.
| std::list<wxString> Scripting::ExecuteCommand | ( | std::list< wxString > | vCmdAndArgs | ) | [private] |
| list< wxString > Scripting::CommandAddWaypoint | ( | wxString | strCmd, | |
| std::list< wxString > | vArgs | |||
| ) | [private] |
add_waypoint command
add_waypoint <name> <visible> <call_out> <small_label> <icon_filename> <long> <lat> [scale_icon]
add_waypoint <name> <visible> <call_out> <small_label> <icon_filename> <street_#> <street name>=""> <street type>=""> <city> <state> [scale_icon]
Definition at line 491 of file Scripting.cpp.
| list< wxString > Scripting::CommandGetWaypoint | ( | wxString | strCmd, | |
| std::list< wxString > | vArgs | |||
| ) | [private] |
get_waypoint command
get_waypoint <name>
Will return the address and coordinates of waypoint
Definition at line 619 of file Scripting.cpp.
| list< wxString > Scripting::CommandDeleteWaypoint | ( | wxString | strCmd, | |
| std::list< wxString > | vArgs | |||
| ) | [private] |
| list< wxString > Scripting::CommandExit | ( | wxString | strCmd, | |
| std::list< wxString > | vArgs | |||
| ) | [private] |
| static wxString Scripting::CompileCommand | ( | std::list< wxString > | vCmdAndArgs | ) | [static, private] |
MapControl* Scripting::m_pctlMap [private] |
std::vector<ScriptStream *> Scripting::m_vScripts [private] |
wxMutex Scripting::m_mtxScripts [private] |
std::vector<wxSocketServer *> Scripting::m_vServers [private] |
wxMutex Scripting::m_mtxServers [private] |
wxWindow* Scripting::m_pParent [private] |
1.5.5