本文整理汇总了C#中CommandMessenger.ReceivedCommand类的典型用法代码示例。如果您正苦于以下问题:C# ReceivedCommand类的具体用法?C# ReceivedCommand怎么用?C# ReceivedCommand使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ReceivedCommand类属于CommandMessenger命名空间,在下文中一共展示了ReceivedCommand类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:nkiest,项目名称:Arduino-Libraries,代码行数:12,代码来源:TemperatureControl.cs
示例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);
}
}
}
开发者ID:nuclearcanary,项目名称:Arduino-Libraries,代码行数:19,代码来源:CmdMessenger.cs
示例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);
}
开发者ID:nkiest,项目名称:Arduino-Libraries,代码行数:14,代码来源:TransferSpeed.cs
示例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");
}
开发者ID:c37-cae,项目名称:T-Bone,代码行数:6,代码来源:SendAndReceiveBinaryArguments.cs
示例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);
}
开发者ID:nuclearcanary,项目名称:Arduino-Libraries,代码行数:26,代码来源:CmdMessenger.cs
示例6: UnknownCommand
private void UnknownCommand(ReceivedCommand args)
{
throw new NotSupportedException(Properties.Resources.UnknownCommand);
}
开发者ID:tostiheld,项目名称:portfolio,代码行数:4,代码来源:Commander.cs
示例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);
}
}
开发者ID:DiLRandI,项目名称:Arduino-CmdMessenger,代码行数:18,代码来源:CmdMessenger.cs
示例8: OnUnknownCommand
private void OnUnknownCommand(ReceivedCommand receivedCommand)
{
Debug.WriteLine("Unknown command");
OnErrorEvent("Error > Unknown command");
}
开发者ID:zigorrom,项目名称:MeasurementChannelSwitch,代码行数:5,代码来源:ChannelSwitch.cs
示例9: OnWatchdog
private void OnWatchdog(ReceivedCommand receivedCommand)
{
Debug.WriteLine(String.Format("Watchdog > {0}", receivedCommand.CommandString()));
}
开发者ID:zigorrom,项目名称:MeasurementChannelSwitch,代码行数:4,代码来源:ChannelSwitch.cs
示例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));
}
开发者ID:zigorrom,项目名称:MeasurementChannelSwitch,代码行数:7,代码来源:ChannelSwitch.cs
示例11: OnError
private void OnError(ReceivedCommand receivedCommand)
{
Debug.WriteLine(String.Format("Error > {0}", receivedCommand.CommandString()));
OnErrorEvent(String.Format("Error > {0}", receivedCommand.CommandString()));
}
开发者ID:zigorrom,项目名称:MeasurementChannelSwitch,代码行数:5,代码来源:ChannelSwitch.cs
示例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);
}
开发者ID:Michaelwolf95,项目名称:ArduinoProject,代码行数:11,代码来源:SandR_mono_ui.cs
示例13: OnUnknownCommand
void OnUnknownCommand(ReceivedCommand arguments)
{
Debug.Log("Command without attached callback received");
}
开发者ID:Michaelwolf95,项目名称:ArduinoProject,代码行数:4,代码来源:SandR_mono_ui.cs
示例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);
}
开发者ID:Vrijdagonline,项目名称:petduino-connect,代码行数:10,代码来源:CmdMessenger.cs
示例15: OnAcknowledge
// Callback function that prints that the Arduino has acknowledged
void OnAcknowledge(ReceivedCommand arguments)
{
Console.WriteLine(@" Arduino is ready");
}
开发者ID:vikramt,项目名称:Arduino,代码行数:5,代码来源:ArduinoController.cs
示例16: HandleMessage
/// <summary> Handle message. </summary>
/// <param name="receivedCommand"> The received command. </param>
public void HandleMessage(ReceivedCommand receivedCommand)
{
CurrentReceivedLine = receivedCommand.rawString;
// Send message that a new line has been received and is due to be processed
InvokeEvent(NewLineReceived);
MessengerCallbackFunction callback = null;
if (receivedCommand.Ok)
{
//receivedCommand = new ReceivedCommand(commandString);
if (_callbackList.ContainsKey(receivedCommand.CmdId))
{
callback = _callbackList[receivedCommand.CmdId];
}
else
{
if (_defaultCallback != null) callback = _defaultCallback;
}
}
else
{
// Empty command
receivedCommand = new ReceivedCommand();
}
InvokeCallBack(callback, receivedCommand);
}
开发者ID:vikramt,项目名称:Arduino,代码行数:28,代码来源:CmdMessenger.cs
示例17: OnError
// Callback function that prints that the Arduino has experienced an error
void OnError(ReceivedCommand arguments)
{
Console.WriteLine(@"Arduino has experienced an error");
}
开发者ID:vikramt,项目名称:Arduino,代码行数:5,代码来源:ArduinoController.cs
示例18: BlockedTillReply
/// <summary> Blocks until acknowlegdement reply has been received. </summary>
/// <param name="ackCmdId"> acknowledgement command ID </param>
/// <param name="timeout"> Timeout on acknowlegde command. </param>
/// <param name="clearQueueState"></param>
/// <returns> . </returns>
private ReceivedCommand BlockedTillReply(int ackCmdId, int timeout, ClearQueue clearQueueState)
{
// Disable invoking command callbacks
_receiveCommandQueue.ThreadRunState = CommandQueue.ThreadRunStates.Stop;
var start = TimeUtils.Millis;
var time = start;
var acknowledgeCommand = new ReceivedCommand();
while ((time - start < timeout) && !acknowledgeCommand.Ok)
{
time = TimeUtils.Millis;
acknowledgeCommand = CheckForAcknowledge(ackCmdId, clearQueueState);
}
// Re-enable invoking command callbacks
_receiveCommandQueue.ThreadRunState = CommandQueue.ThreadRunStates.Start;
return acknowledgeCommand;
}
开发者ID:vikramt,项目名称:Arduino,代码行数:23,代码来源:CmdMessenger.cs
示例19: HandleMessage
/// <summary> Handle message. </summary>
/// <param name="receivedCommand"> The received command. </param>
private void HandleMessage(ReceivedCommand receivedCommand)
{
MessengerCallbackFunction callback = null;
if (receivedCommand.Ok)
{
if (_callbackList.ContainsKey(receivedCommand.CmdId))
{
callback = _callbackList[receivedCommand.CmdId];
}
else
{
if (_defaultCallback != null) callback = _defaultCallback;
}
}
else
{
// Empty command
receivedCommand = new ReceivedCommand { CommunicationManager = _communicationManager };
}
InvokeCallBack(callback, receivedCommand);
}
开发者ID:DiLRandI,项目名称:Arduino-CmdMessenger,代码行数:25,代码来源:CmdMessenger.cs
示例20: TestSendCommandWithAcknowledgementByArduinoFinished
public void TestSendCommandWithAcknowledgementByArduinoFinished(ReceivedCommand command)
{
var result = command.ReadBoolArg();
if (!result)
{
Common.TestNotOk("Incorrect response");
}
_acknowledgementByEmbeddedFinished = true;
}
开发者ID:DiLRandI,项目名称:Arduino-CmdMessenger,代码行数:9,代码来源:Acknowledge.cs
注:本文中的CommandMessenger.ReceivedCommand类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论