v1.3.0.0
WASimCommander::Client Namespace Reference

WASimCommander::Client namespace. Defines/declares everything needed to interact with the WASimCommander Client API, including the WASimClient class itself. More...

Classes

struct  ClientEvent
 Client Event data, delivered via callback. More...
 
struct  DataRequestRecord
 DataRequestRecord inherits and extends WASimCommander::DataRequest with data pertinent for use by a data consumer/Client. In particular, any value data sent from the server is stored here as a byte array in the data member (a std::vector of unsigned char). More...
 
struct  ListResult
 Structure for delivering list results, eg. of local variables sent from Server. More...
 
struct  RegisteredEvent
 Structure to hold data for registered (reusable) calculator events. Used to submit events with WASimClient::registerEvent(). More...
 
struct  VariableRequest
 Structure for using with WASimClient::getVariable() and WASimClient::setVariable() to specify information about the variable to set or get. Variables and Units can be specified by name or by numeric ID. Only some variable types have an associated numeric ID ('A', 'L', 'T' types) and only some variable types accept a Unit specifier ('A', 'C', 'E', 'L' types). Using numeric IDs, if already known, is more efficient on the server side since it saves the lookup step. More...
 
class  WASimClient
 WASimCommander Client implementation. Handles all aspects of communication with the WASimCommander Server WASM module. More...
 

Typedefs

using clientEventCallback_t = std::function< void __stdcall(const ClientEvent &)>
 Callback function for Client events. More...
 
using listResultsCallback_t = std::function< void __stdcall(const ListResult &)>
 Callback function for delivering list results, eg. of local variables sent from Server. More...
 
using dataCallback_t = std::function< void __stdcall(const DataRequestRecord &)>
 Callback function for subscription result data. More...
 
using logCallback_t = std::function< void __stdcall(const LogRecord &, LogSource)>
 Callback function for log entries (from both Client and Server). More...
 
using commandCallback_t = std::function< void __stdcall(const Command &)>
 Callback function for commands sent from server. More...
 

Enumerations

enum class  ClientStatus : uint8_t {
  Idle = 0x00 ,
  Initializing = 0x01 ,
  SimConnected = 0x02 ,
  Connecting = 0x04 ,
  Connected = 0x08 ,
  ShuttingDown = 0x10 ,
  AllConnected = SimConnected | Connected
}
 Client status flags. More...
 
enum class  ClientEventType : uint8_t {
  None = 0 ,
  SimConnecting ,
  SimConnected ,
  SimDisconnecting ,
  SimDisconnected ,
  ServerConnecting ,
  ServerConnected ,
  ServerDisconnected
}
 Client event type enumeration. More...
 
enum class  LogSource : uint8_t {
  Client ,
  Server
}
 Log entry source, Client or Server. More...
 

Functions

static bool isCustomKeyEventName (const std::string &name)
 

Variables

static const uint32_t CUSTOM_KEY_EVENT_ID_MIN = 0x00020000
 Starting ID range for "Custom Key Events" for use with registerCustomKeyEvent() generated IDs. (This corresponds to the value of 1 + THIRD_PARTY_EVENT_ID_MAX constant from SimConnect SDK header file 'MSFS/Legacy/gauges.h'.) More...
 
static const uint32_t CUSTOM_KEY_EVENT_LEGACY_TRIGGER_FLAG = 0x80000000
 
Enumeration name strings
static const std::vector< const char * > ClientStatusNames = { "Idle", "Initializing", "SimConnected", "Connecting", "Connected", "ShuttingDown" }
 Client::ClientStatus enum names. More...
 
static const std::vector< const char * > ClientEventTypeNames
 Client::ClientEventType enum names. More...
 
static const std::vector< const char * > LogSourceNames = { "Client", "Server" }
 Client::LogSource enum names. More...
 
Return result values
static const HRESULT E_NOT_CONNECTED = 2250L | ( 7 << 16) | 0x80000000
 Error result: server not connected. More...
 
static const HRESULT E_TIMEOUT = 1460L | ( 7 << 16) | 0x80000000
 Error result: timeout communicating with server. More...
 

Detailed Description

WASimCommander::Client namespace. Defines/declares everything needed to interact with the WASimCommander Client API, including the WASimClient class itself.


Class Documentation

◆ WASimCommander::Client::ClientEvent

struct WASimCommander::Client::ClientEvent

Client Event data, delivered via callback.

See also
WASimClient::setClientEventCallback(), ClientEventType, ClientStatus

Definition at line 31 of file structs.h.

Class Members
ClientEventType eventType The type of event. See enum docs for details.
ClientStatus status Current status flag(s). See enum docs for details.
string message A short message about the event (eg. "Server Connected")

◆ WASimCommander::Client::ListResult

struct WASimCommander::Client::ListResult

Structure for delivering list results, eg. of local variables sent from Server.

See also
WASimClient::list(), listResultsCallback_t, WASimCommander::LookupItemType, WASimCommander::CommandId::List command.

Definition at line 41 of file structs.h.

Class Members
typedef vector< pair< int, string > > listResult_t A mapping of IDs to names.
Class Members
LookupItemType listType the type of items being listed
HRESULT result Execution result, one of: S_OK, E_FAIL, E_TIMEOUT
listResult_t list Mapping of numeric item IDs to name strings.

Typedef Documentation

◆ clientEventCallback_t

using WASimCommander::Client::clientEventCallback_t = typedef std::function<void __stdcall(const ClientEvent &)>

Callback function for Client events.

See also
WASimClient::setClientEventCallback()

Definition at line 72 of file WASimClient.h.

◆ listResultsCallback_t

using WASimCommander::Client::listResultsCallback_t = typedef std::function<void __stdcall(const ListResult &)>

Callback function for delivering list results, eg. of local variables sent from Server.

See also
WASimClient::setListResultsCallback()

Definition at line 73 of file WASimClient.h.

◆ dataCallback_t

using WASimCommander::Client::dataCallback_t = typedef std::function<void __stdcall(const DataRequestRecord &)>

Callback function for subscription result data.

See also
WASimClient::setDataCallback()

Definition at line 74 of file WASimClient.h.

◆ logCallback_t

using WASimCommander::Client::logCallback_t = typedef std::function<void __stdcall(const LogRecord &, LogSource)>

Callback function for log entries (from both Client and Server).

See also
WASimClient::setLogCallback()

Definition at line 75 of file WASimClient.h.

◆ commandCallback_t

using WASimCommander::Client::commandCallback_t = typedef std::function<void __stdcall(const Command &)>

Callback function for commands sent from server.

See also
WASimClient::setCommandResultCallback(), WASimClient::setResponseCallback()

Definition at line 76 of file WASimClient.h.

Enumeration Type Documentation

◆ ClientStatus

enum class WASimCommander::Client::ClientStatus : uint8_t
strong

Client status flags.

See also
WASimClient::status()
Enumerator
Idle 

no active SimConnect or WASim server connection

Initializing 

trying to connect to SimConnect

SimConnected 

have SimConnect link

Connecting 

attempting connection to WASim server

Connected 

connected to WASim server

ShuttingDown 

closing SimConnect link, before being back in Idle status mode

Definition at line 35 of file enums_impl.h.

◆ ClientEventType

enum class WASimCommander::Client::ClientEventType : uint8_t
strong

Client event type enumeration.

See also
ClientEvent, ClientStatus, WASimClient::setClientEventCallback()
Enumerator
SimConnecting 

Initializing status.

SimConnected 

SimConnected status.

SimDisconnecting 

ShuttingDown status.

SimDisconnected 

From SimConnected to Initializing status change.

ServerConnecting 

Connecting status.

ServerConnected 

Connected status.

ServerDisconnected 

From Connected to SimConnected status change.

Definition at line 54 of file enums_impl.h.

◆ LogSource

enum class WASimCommander::Client::LogSource : uint8_t
strong

Log entry source, Client or Server.

See also
WASimClient::logCallback_t
Enumerator
Client 

Log record from WASimClient.

Server 

Log record from WASimModule (Server)

Definition at line 73 of file enums_impl.h.

Function Documentation

◆ isCustomKeyEventName()

static bool WASimCommander::Client::isCustomKeyEventName ( const std::string &  name)
inlinestatic

Definition at line 1903 of file WASimClient.cpp.

Variable Documentation

◆ ClientStatusNames

const std::vector<const char *> WASimCommander::Client::ClientStatusNames = { "Idle", "Initializing", "SimConnected", "Connecting", "Connected", "ShuttingDown" }
static

Client::ClientStatus enum names.

Definition at line 50 of file enums_impl.h.

◆ ClientEventTypeNames

const std::vector<const char *> WASimCommander::Client::ClientEventTypeNames
static
Initial value:
= { "None",
"SimConnecting", "SimConnected", "SimDisconnecting", "SimDisconnected",
"ServerConnecting", "ServerConnected", "ServerDisconnected" }

Client::ClientEventType enum names.

Definition at line 67 of file enums_impl.h.

◆ LogSourceNames

const std::vector<const char *> WASimCommander::Client::LogSourceNames = { "Client", "Server" }
static

Client::LogSource enum names.

Definition at line 80 of file enums_impl.h.

◆ E_NOT_CONNECTED

const HRESULT WASimCommander::Client::E_NOT_CONNECTED = 2250L | ( 7 << 16) | 0x80000000
static

Error result: server not connected.

Definition at line 56 of file WASimClient.h.

◆ E_TIMEOUT

const HRESULT WASimCommander::Client::E_TIMEOUT = 1460L | ( 7 << 16) | 0x80000000
static

Error result: timeout communicating with server.

Definition at line 59 of file WASimClient.h.

◆ CUSTOM_KEY_EVENT_ID_MIN

const uint32_t WASimCommander::Client::CUSTOM_KEY_EVENT_ID_MIN = 0x00020000
static

Starting ID range for "Custom Key Events" for use with registerCustomKeyEvent() generated IDs. (This corresponds to the value of 1 + THIRD_PARTY_EVENT_ID_MAX constant from SimConnect SDK header file 'MSFS/Legacy/gauges.h'.)

Definition at line 65 of file WASimClient.h.

◆ CUSTOM_KEY_EVENT_LEGACY_TRIGGER_FLAG

const uint32_t WASimCommander::Client::CUSTOM_KEY_EVENT_LEGACY_TRIGGER_FLAG = 0x80000000
static

Definition at line 63 of file WASimClient.cpp.