26#include <msclr/marshal.h> 
   27#include <msclr/marshal_cppstd.h> 
   30#include "WASimCommander_CLI.h" 
   34using namespace System;
 
   35using namespace System::Collections::Generic;
 
   36using namespace System::Runtime::InteropServices;
 
   37using namespace msclr::interop;
 
   45  #define WSE  WASimCommander::Enums 
   77    #define DELEGATE_DECL(D)  { void add(D^); void remove(D^); } 
 
   97    explicit WASimClient(UInt32 clientId, String ^configFile);
 
  113    ClientStatus 
status() { 
return (ClientStatus)m_client->status(); }
 
  128    HR connectSimulator([Optional] Nullable<uint32_t> timeout) { 
return (
HR)m_client->connectSimulator(timeout.HasValue ? timeout.Value : 0); }
 
  133    HR connectSimulator(
int networkConfigId, [Optional] Nullable<uint32_t> timeout) { 
return (
HR)m_client->connectSimulator(networkConfigId, timeout.HasValue ? timeout.Value : 0); }
 
  138    uint32_t 
pingServer([Optional] Nullable<uint32_t> timeout) { 
return m_client->pingServer(timeout.HasValue ? timeout.Value : 0); }
 
  140    HR connectServer([Optional] Nullable<uint32_t> timeout) { 
return (
HR)m_client->connectServer(timeout.HasValue ? timeout.Value : 0); }
 
  192    HR setLocalVariable(String ^variableName, 
const double value) { 
return (
HR)m_client->setLocalVariable(marshal_as<std::string>(variableName), value); }
 
  194      return (
HR)m_client->setLocalVariable(marshal_as<std::string>(variableName), value, marshal_as<std::string>(unitName));
 
 
  197    HR setOrCreateLocalVariable(String ^variableName, 
const double value) { 
return (
HR)m_client->setOrCreateLocalVariable(marshal_as<std::string>(variableName), value); }
 
  200      return (
HR)m_client->setOrCreateLocalVariable(marshal_as<std::string>(variableName), value, marshal_as<std::string>(unitName));
 
 
  205      return (
HR)m_client->setSimVarVariable(marshal_as<std::string>(variableName), marshal_as<std::string>(unitName), value);
 
 
  209      return (
HR)m_client->setSimVarVariable(marshal_as<std::string>(variableName), index, marshal_as<std::string>(unitName), value);
 
 
  213      return (
HR)m_client->setSimVarVariable(marshal_as<std::string>(variableName), marshal_as<std::string>(stringValue));
 
 
  217      return (
HR)m_client->setSimVarVariable(marshal_as<std::string>(variableName), index, marshal_as<std::string>(stringValue));
 
 
  251    HR sendKeyEvent(uint32_t keyEventId, [Optional] Nullable<uint32_t> v1, [Optional] Nullable<uint32_t> v2, [Optional] Nullable<uint32_t> v3, [Optional] Nullable<uint32_t> v4, [Optional] Nullable<uint32_t> v5) {
 
  252      return (
HR)m_client->sendKeyEvent(keyEventId, v1.GetValueOrDefault(0), v2.GetValueOrDefault(0), v3.GetValueOrDefault(0), v4.GetValueOrDefault(0), v5.GetValueOrDefault(0));
 
 
  256    HR sendKeyEvent(String ^keyEventName, [Optional] Nullable<uint32_t> v1, [Optional] Nullable<uint32_t> v2, [Optional] Nullable<uint32_t> v3, [Optional] Nullable<uint32_t> v4, [Optional] Nullable<uint32_t> v5) {
 
  257      return (
HR)m_client->sendKeyEvent(marshal_as<std::string>(keyEventName), v1.GetValueOrDefault(0), v2.GetValueOrDefault(0), v3.GetValueOrDefault(0), v4.GetValueOrDefault(0), v5.GetValueOrDefault(0));
 
 
  262      pin_ptr<UInt32> pui = &puiCustomEventId;
 
  263      return (
HR)m_client->registerCustomKeyEvent(marshal_as<std::string>(customEventName), pui, useLegacyTransmit.GetValueOrDefault(
false));
 
 
  267      return (
HR)m_client->registerCustomKeyEvent(marshal_as<std::string>(customEventName), 
nullptr, useLegacyTransmit.GetValueOrDefault(
false));
 
 
  273    HR removeCustomKeyEvent(String ^customEventName) { 
return (
HR)m_client->removeCustomKeyEvent(marshal_as<std::string>(customEventName)); }
 
  280    HR list(LookupItemType itemsType) { 
return (
HR)m_client->list((WSE::LookupItemType)itemsType); }
 
  282    HR lookup(LookupItemType itemType, String ^itemName, [Out] Int32 %piResult)
 
  284      pin_ptr<Int32> pi = &piResult;
 
  285      return (
HR)m_client->lookup((WSE::LookupItemType)itemType, marshal_as<std::string>(itemName), pi);
 
 
  298      const HRESULT hr = m_client->sendCommandWithResponse(command, &resp, (timeout.HasValue ? timeout.Value : 0));
 
  299      response = gcnew 
Command(resp);
 
 
  308    LogLevel 
logLevel(LogFacility facility, LogSource source) {
 
 
  312    void setLogLevel(LogLevel level, LogFacility facility, LogSource source) {
 
 
  322    Private ^d = 
nullptr;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
HR executeCalculatorCode(String^ code, CalcResultType resultType, [Out] double % pfResult, [Out] String^ % psResult)
Execute calculator code with both numeric and string results.
 
uint32_t serverVersion()
Returns version number of the WASimModule server, if known. The version is populated after a successf...
 
HR removeDataRequest(const uint32_t requestId)
See WASimClient::removeDataRequest().
 
HR getLocalVariable(String ^ variableName, String ^ unitName, [Out] double % pfResult)
See WASimClient::getLocalVariable().
 
HR getVariable(VariableRequest ^ var, [Out] double % pfResult)
Get the value of a variable with a numeric result type. This is the most typical use case since most ...
 
HR sendCommand(Command ^ command)
See WASimClient::sendCommand().
 
delegate void ResponseDelegate(Command ^)
Event delegate for all Command structures received from server (OnResponseReceived).
 
delegate void ListResultsDelegate(ListResult ^)
Event delegate for delivering list results, eg. of local variables sent from Server (OnListResults).
 
HR setOrCreateLocalVariable(String ^ variableName, String ^ unitName, const double value)
See WASimClient::setOrCreateLocalVariable().
 
void Dispose()
This class implements a Disposable type object and should be disposed-of appropriately by calling cli...
 
bool isConnected()
Returns true if connected to WASimModule server.
 
bool isInitialized()
Returns true if connected to the Simulator (SimConnect).
 
array< UInt32 > ^ dataRequestIdsList()
See WASimClient::dataRequestIdsList().
 
ClientStatus status()
Get current connection status of this client.
 
HR connectSimulator([Optional] Nullable< uint32_t > timeout)
Connect to the Simulator engine on a local connection.
 
HR setVariable(VariableRequest ^ var, const double value)
See WASimClient::setVariable(const VariableRequest &, double).
 
HR executeCalculatorCode(String^ code, CalcResultType resultType, [Out] double % pfResult)
Execute calculator code with a numeric result type.
 
HR saveDataRequestAsync(DataRequest ^ request)
See WASimClient::saveDataRequest() as used with async = true
 
HR setVariable(VariableRequest ^ var, String ^ stringValue)
See WASimClient::setVariable(const VariableRequest &, const std::string &).
 
int networkConfigurationId()
See WASimClient::networkConfigurationId().
 
HR removeCustomKeyEvent(UInt32 eventId)
See WASimClient::removeCustomKeyEvent(uint32_t).
 
delegate void LogDelegate(LogRecord ^, LogSource)
Event delegate for log entries (from both Client and Server) (OnLogRecordReceived).
 
DataRequestRecord ^ dataRequest(uint32_t requestId)
See WASimClient::dataRequest().
 
HR getOrCreateLocalVariable(String ^ variableName, double defaultValue, [Out] double % pfResult)
 
HR setDataRequestsPaused(bool paused)
See WASimClient::setDataRequestsPaused().
 
HR sendCommandWithResponse(Command ^ command, [Out] Command^ % response, [Optional] Nullable< uint32_t > timeout)
See WASimClient::sendCommandWithResponse().
 
HR executeCalculatorCode(String^ code, CalcResultType resultType, [Out] String^ % psResult)
Execute calculator code with a string result type.
 
HR connectServer([Optional] Nullable< uint32_t > timeout)
See WASimClient::connectServer().
 
HR getLocalVariable(String ^ variableName, [Out] double % pfResult)
See WASimClient::getLocalVariable().
 
array< DataRequestRecord ^> ^ dataRequests()
See WASimClient::dataRequests().
 
void setLogLevel(LogLevel level, LogFacility facility, LogSource source)
See WASimClient::setLogLevel().
 
HR connectSimulator(int networkConfigId, [Optional] Nullable< uint32_t > timeout)
Connect to the Simulator engine using a specific network configuration ID from a SimConnect....
 
HR setLocalVariable(String ^ variableName, const double value)
See WASimClient::setLocalVariable().
 
void setDefaultTimeout(uint32_t ms)
See WASimClient::setDefaultTimeout().
 
void disconnectServer()
See WASimClient::disconnectServer().
 
ListResultsDelegate^ OnListResults
Delivers list results after a successful WASimClient.list() command.
 
HR list(LookupItemType itemsType)
See WASimClient::list().
 
RegisteredEvent ^ registeredEvent(uint32_t eventId)
See WASimClient::registeredEvent().
 
uint32_t pingServer([Optional] Nullable< uint32_t > timeout)
See WASimClient::pingServer().
 
WASimClient(UInt32 clientId)
Construct a new client with the given ID. The ID must be unique among any other possible clients and ...
 
HR registerCustomKeyEvent(String ^ customEventName, [Optional] Nullable< bool > useLegacyTransmit)
See WASimClient::registerCustomKeyEvent(). This method overload doesn't provide the generated event I...
 
CommandResultDelegate^ OnCommandResult
This event is triggered whenever any response to a Command is returned from the Server....
 
ResponseDelegate^ OnResponseReceived
This event is triggered whenever any Command is received from the server. This is typically Ack or Na...
 
void disconnectSimulator()
See WASimClient::disconnectSimulator().
 
HR registerCustomKeyEvent(String ^ customEventName, [Out] UInt32 % puiCustomEventId, [Optional] Nullable< bool > useLegacyTransmit)
See WASimClient::registerCustomKeyEvent();.
 
HR saveDataRequest(DataRequest ^ request)
See WASimClient::saveDataRequest() as used with async = false
 
HR setLocalVariable(String ^ variableName, String ^ unitName, const double value)
Get the value of a variable with a numeric result type. This is the most typical use case since most ...
 
LogDelegate^ OnLogRecordReceived
Log records delivered from Client and/or Server.
 
HR lookup(LookupItemType itemType, String ^ itemName, [Out] Int32 % piResult)
See WASimClient::lookup().
 
HR setSimVarVariable(String ^ variableName, uint8_t index, String ^ stringValue)
See WASimClient::setSimVarVariable(const std::string &, uint8_t, const std::string &).
 
HR setSimVarVariable(String ^ variableName, String ^ unitName, const double value)
See WASimClient::setSimVarVariable(const std::string &, const std::string &, double).
 
uint32_t defaultTimeout()
See WASimClient::defaultTimeout().
 
HR removeCustomKeyEvent(String ^ customEventName)
See WASimClient::removeCustomKeyEvent(const std::string&).
 
LogLevel logLevel(LogFacility facility, LogSource source)
See WASimClient::logLevel().
 
HR executeCalculatorCode(String^ code)
Execute calculator code without result.
 
HR sendKeyEvent(uint32_t keyEventId, [Optional] Nullable< uint32_t > v1, [Optional] Nullable< uint32_t > v2, [Optional] Nullable< uint32_t > v3, [Optional] Nullable< uint32_t > v4, [Optional] Nullable< uint32_t > v5)
See WASimClient::sendKeyEvent(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t) const.
 
HR setSimVarVariable(String ^ variableName, uint8_t index, String ^ unitName, const double value)
See WASimClient::setSimVarVariable(const std::string &, uint8_t, const std::string &,...
 
HR setSimVarVariable(String ^ variableName, String ^ stringValue)
See WASimClient::setSimVarVariable(const std::string &, const std::string &).
 
HR removeEvent(uint32_t eventId)
See WASimClient::removeEvent().
 
ClientEventDelegate^ OnClientEvent
WASimClient events like connection and disconnection.
 
HR registerEvent(RegisteredEvent ^ eventData)
See WASimClient::registerEvent().
 
delegate void DataDelegate(DataRequestRecord ^)
Event delegate for subscription result data (OnDataReceived).
 
uint32_t clientVersion()
Returns version number of the WASimClient.
 
HR updateDataRequest(uint32_t requestId)
See WASimClient::updateDataRequest().
 
HR setOrCreateLocalVariable(String ^ variableName, const double value)
See WASimClient::setOrCreateLocalVariable().
 
HR transmitEvent(uint32_t eventId)
See WASimClient::transmitEvent().
 
DataDelegate^ OnDataReceived
Delivers data value subscription updates as they arrive from the Server.
 
delegate void CommandResultDelegate(Command ^)
Event delegate for command responses returned from server (OnCommandResult).
 
array< RegisteredEvent ^> ^ registeredEvents()
See WASimClient::registeredEvents().
 
void setNetworkConfigurationId(int configId)
See WASimClient::setNetworkConfigurationId().
 
delegate void ClientEventDelegate(ClientEvent ^)
Event delegate for Client events (OnClientEvent)
 
HR sendKeyEvent(String ^ keyEventName, [Optional] Nullable< uint32_t > v1, [Optional] Nullable< uint32_t > v2, [Optional] Nullable< uint32_t > v3, [Optional] Nullable< uint32_t > v4, [Optional] Nullable< uint32_t > v5)
See WASimClient::sendKeyEvent(const std::string&, uint32_t, uint32_t, uint32_t, uint32_t,...
 
WASimCommander Client implementation. Handles all aspects of communication with the WASimCommander Se...
 
WASimCommander::CLI::Client namespace. Implementation of the C++ WASimClient as a C++/CLI ....
 
WASimCommander::CLI::Enums namespace. C++/CLI specific definitions only. See documentation for WASimC...
 
HR
Method return status values; HRESULT "alias".
 
WASimCommander::CLI::Structs namespace. CLI/.NET versions of WASimCommander API and Client data struc...
 
LogSource
Log entry source, Client or Server.
 
Client Event data, delivered via callback.
 
Command data structure. The member contents depend on the command type as described in each command t...
 
Structure for value update subscription requests.
 
DataRequestRecord inherits and extends WASimCommander::CLI::Structs::DataRequest with data pertinent ...
 
Structure for delivering list results, eg. of local variables sent from Server.
 
Structure to hold data for registered (reusable) calculator events. Used to submit events with WASimC...
 
Structure for using with WASimClient::getVariable() and WASimClient::setVariable() to specify informa...
 
Command data structure. The member contents depend on the command type as described in each command t...