#include "pv/mainwindow.hpp"
#ifdef ANDROID
#include <libsigrokandroidutils/libsigrokandroidutils.h>
+#include "android/assetreader.hpp"
#include "android/loghandler.hpp"
#endif
#ifdef ANDROID
srau_init_environment();
pv::AndroidLogHandler::install_callbacks();
+ pv::AndroidAssetReader asset_reader;
#endif
// Parse arguments
while (1) {
static const struct option long_options[] = {
- {"help", no_argument, 0, 'h'},
- {"version", no_argument, 0, 'V'},
- {"loglevel", required_argument, 0, 'l'},
- {"input-file", required_argument, 0, 'i'},
- {"input-format", required_argument, 0, 'I'},
- {0, 0, 0, 0}
+ {"help", no_argument, nullptr, 'h'},
+ {"version", no_argument, nullptr, 'V'},
+ {"loglevel", required_argument, nullptr, 'l'},
+ {"input-file", required_argument, nullptr, 'i'},
+ {"input-format", required_argument, nullptr, 'I'},
+ {nullptr, 0, nullptr, 0}
};
const int c = getopt_long(argc, argv,
}
}
- if (argc != optind) {
- fprintf(stderr, "Unexpected argument: %s\n", argv[optind]);
+ if (argc - optind > 1) {
+ fprintf(stderr, "Only one file can be opened.\n");
return 1;
+ } else if (argc - optind == 1) {
+ open_file = argv[argc - 1];
}
// Initialise libsigrok
context = sigrok::Context::create();
-
+#ifdef ANDROID
+ context->set_resource_reader(&asset_reader);
+#endif
do {
#ifdef ENABLE_DECODE
w.show();
#ifdef ENABLE_SIGNALS
- if(SignalHandler::prepare_signals()) {
+ if (SignalHandler::prepare_signals()) {
SignalHandler *const handler =
new SignalHandler(&w);
QObject::connect(handler,
// Run the application
ret = a.exec();
- } catch(std::exception e) {
+ } catch (std::exception e) {
qDebug() << e.what();
}