本文整理汇总了C#中CommandMessenger.ReceivedCommand类的典型用法代码示例。如果您正苦于以下问题:C# ReceivedCommand类的具体用法?C# ReceivedCommand怎么用?C# ReceivedCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReceivedCommand类属于CommandMessenger命名空间,在下文中一共展示了ReceivedCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPlotDataPoint
// Callback function that plots a data point for the current temperature, the goal temperature,
// the heater steer value and the Pulse Width Modulated (PWM) value.
private void OnPlotDataPoint(ReceivedCommand arguments)
{
var time = arguments.ReadBinFloatArg();
var currTemp = arguments.ReadBinFloatArg();
var goalTemp = arguments.ReadBinFloatArg();
var heaterValue = arguments.ReadBinFloatArg();
var heaterPwm = arguments.ReadBinBoolArg();
_chartForm.UpdateGraph(time, currTemp, goalTemp, heaterValue, heaterPwm);
}
示例2: InvokeCallBack
/// <summary> Helper function to Invoke or directly call callback function. </summary>
/// <param name="messengerCallbackFunction"> The messenger callback function. </param>
/// <param name="command"> The command. </param>
private void InvokeCallBack(MessengerCallbackFunction messengerCallbackFunction, ReceivedCommand command)
{
if (messengerCallbackFunction != null)
{
if (_controlToInvokeOn != null && _controlToInvokeOn.InvokeRequired)
{
//Asynchronously call on UI thread
_controlToInvokeOn.Invoke(new MessengerCallbackFunction(messengerCallbackFunction), (object) command);
}
else
{
//Directly call
messengerCallbackFunction(command);
}
}
}
示例3: OnReceiveSeries
// Callback function To receive the plain text float series from the Arduino
void OnReceiveSeries(ReceivedCommand arguments)
{
if (_receivedItemsCount % (SeriesLength / 10) == 0)
Common.WriteLine(_receivedItemsCount+ " Received value: " + arguments.ReadFloatArg());
if (_receivedItemsCount == 0)
{
// Received first value, start stopwatch
_beginTime = Millis;
}
_receivedItemsCount++;
_receivedBytesCount += CountBytesInCommand(arguments, false);
}
示例4: OnUnknownCommand
// ------------------ C A L L B A C K S ---------------------
// Called when a received command has no attached function.
void OnUnknownCommand(ReceivedCommand arguments)
{
Console.WriteLine("Command without attached callback received");
}
示例5: HandleMessage
/// <summary> Handle message. </summary>
/// <param name="receivedCommand"> The received command. </param>
public void HandleMessage(ReceivedCommand receivedCommand)
{
MessengerCallbackFunction callback = null;
//var commandId = -1;
//ReceivedCommand receivedCommand;
if (receivedCommand.Ok)
{
//receivedCommand = new ReceivedCommand(commandString);
if (_callbackList.ContainsKey(receivedCommand.CommandId))
{
callback = _callbackList[receivedCommand.CommandId];
}
else
{
if (_defaultCallback != null) callback = _defaultCallback;
}
}
else
{
// Empty command
receivedCommand = new ReceivedCommand();
}
InvokeCallBack(callback, receivedCommand);
}
示例6: UnknownCommand
private void UnknownCommand(ReceivedCommand args)
{
throw new NotSupportedException(Properties.Resources.UnknownCommand);
}
示例7: InvokeCallBack
/// <summary> Helper function to Invoke or directly call callback function. </summary>
/// <param name="messengerCallbackFunction"> The messenger callback function. </param>
/// <param name="command"> The command. </param>
private void InvokeCallBack(MessengerCallbackFunction messengerCallbackFunction, ReceivedCommand command)
{
if (messengerCallbackFunction == null || (ControlToInvokeOn != null && ControlToInvokeOn.IsDisposed)) return;
if (ControlToInvokeOn != null)
{
//Asynchronously call on UI thread
ControlToInvokeOn.BeginInvoke(new MessengerCallbackFunction(messengerCallbackFunction), (object)command);
}
else
{
//Directly call
messengerCallbackFunction(command);
}
}
示例8: OnUnknownCommand
private void OnUnknownCommand(ReceivedCommand receivedCommand)
{
Debug.WriteLine("Unknown command");
OnErrorEvent("Error > Unknown command");
}
示例9: OnWatchdog
private void OnWatchdog(ReceivedCommand receivedCommand)
{
Debug.WriteLine(String.Format("Watchdog > {0}", receivedCommand.CommandString()));
}
示例10: OnAcknowledge
private void OnAcknowledge(ReceivedCommand receivedCommand)
{
Debug.WriteLine(receivedCommand.CommandString());
//var a = receivedCommand.ReadInt16Arg();
//var b = receivedCommand.ReadBoolArg();
//Debug.WriteLine(String.Format("channel number: {0}, status {1}", a,b));
}
示例11: OnError
private void OnError(ReceivedCommand receivedCommand)
{
Debug.WriteLine(String.Format("Error > {0}", receivedCommand.CommandString()));
OnErrorEvent(String.Format("Error > {0}", receivedCommand.CommandString()));
}
示例12: OnButton1
void OnButton1(ReceivedCommand arguments)
{
//Thread.Sleep(1000);
Debug.Log("Arduino Button1: ");
// test = arguments.ReadInt32Arg();
// Debug.Log(test);
// var cmd_return = new SendCommand((int)Command.SetLed);
// _cmdMessenger.SendCommand(cmd_return);
}
示例13: OnUnknownCommand
void OnUnknownCommand(ReceivedCommand arguments)
{
Debug.Log("Command without attached callback received");
}
示例14: InvokeCallBack
/// <summary> Helper function to Invoke or directly call callback function. </summary>
/// <param name="messengerCallbackFunction"> The messenger callback function. </param>
/// <param name="command"> The command. </param>
private void InvokeCallBack(MessengerCallbackFunction messengerCallbackFunction, ReceivedCommand command)
{
if (messengerCallbackFunction == null) return;
//Directly call
messengerCallbackFunction(command);
}
示例15: OnAcknowledge
// Callback function that prints that the Arduino has acknowledged
void OnAcknowledge(ReceivedCommand arguments)
{
Console.WriteLine(@" Arduino is ready");
}