我应该覆盖CtrlC信号并用它来打印信息.它不应该结束该计划.
到目前为止发生的事情是,当CtrlC按下它时会打印消息,但结束程序.
当我问我的教授他告诉我这样做时:你需要让信号处理程序不要继续处理信号.现在,信号由您的代码处理,然后转到父处理程序.
有没有我应该添加的方法或者我需要在某个地方移动信号安装程序?
到目前为止这是我的代码:
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <signal.h>
#include "Input.h"
#include "CircleBuff.h"
//void handler_function(int signal_id);
void catch_int(int sig_num){
//reset the signal handler again to catch_int, for next time
signal(SIGINT, catch_int);
//print message
printf("Print History");
fflush(stdout);
}
void printHistory(CircleBuff hist){
cout << "Complete History:\n" << endl;
hist.print();
cout << endl;
}
int main(int argc, char** argv){
struct sigaction signal_action; /* define table */
signal_action.sa_handler = catch_int; /* insert …Run Code Online (Sandbox Code Playgroud) 我正在尝试编译/运行在运行Ubuntu的BeagleBone Black上使用BlueCove库的程序.但是,我在运行时不断收到此错误:
Native Library bluecove_arm not available
javax.bluetooth.BluetoothStateException: BlueCove library bluecove not available
at com.intel.bluetooth.BlueCoveImpl.loadNativeLibraries(BlueCoveImpl.java:381)
at com.intel.bluetooth.BlueCoveImpl.detectStack(BlueCoveImpl.java:429)
at com.intel.bluetooth.BlueCoveImpl.access$500(BlueCoveImpl.java:65)
at com.intel.bluetooth.BlueCoveImpl$1.run(BlueCoveImpl.java:1020)
at java.security.AccessController.doPrivileged(Native Method)
at com.intel.bluetooth.BlueCoveImpl.detectStackPrivileged(BlueCoveImpl.java:1018)
at com.intel.bluetooth.BlueCoveImpl.getBluetoothStack(BlueCoveImpl.java:1011)
at javax.bluetooth.LocalDevice.getLocalDeviceInstance(LocalDevice.java:75)
at javax.bluetooth.LocalDevice.getLocalDevice(LocalDevice.java:95)
at edit.rit.ce.whud.DataServer.bluetoothHandler(DataServer.java:16)
at edit.rit.ce.whud.GUI.main(GUI.java:153)
Run Code Online (Sandbox Code Playgroud)
我知道这不是代码的问题,因为我可以在运行Mint的x64位Linux计算机上运行带有BlueCove库的代码(基于Ubuntu).我在网上搜索了几个解决方案,找不到解决我问题的解决方案.我已经使用这种方法为ARM重新编译了bluecove-gpl-2.1.0库
http://www.raspberrypi.org/forums/viewtopic.php?f=81&t=58758
并尝试通过终端和NetBeans IDE编译/运行代码.
我需要做一些其他步骤来完成这项工作吗?为什么即使在我为ARM重新编译它之后仍然无法使用Bluecove库?
我对 XAML 或绑定不太熟悉,但我一直在每个 GUI 元素上设置 AutomationID。不幸的是,我找不到在ComboBox.
以下是在 XAML 中声明 ComboBox 的方式。
<ComboBox AutomationProperties.AutomationId="DialogRODB_TypeComboBox"
Height="23"
Margin="80,64,27,0"
VerticalAlignment="Top"
SelectedValue="{Binding Message.Move.Type}"
ItemsSource="{Binding Source={StaticResource MoveType}}" />
Run Code Online (Sandbox Code Playgroud)
在一个单独的类中,这是创建组合框中项目的地方。
public enum MoveType
{
[StringValue("INBOUND")] Inbound,
[StringValue("OUTBOUND")] Outbound
}
Run Code Online (Sandbox Code Playgroud)
我无法真正提供更多代码,但我可以尝试回答任何问题。