aboutsummaryrefslogtreecommitdiff
path: root/pw_system/init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'pw_system/init.cc')
-rw-r--r--pw_system/init.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/pw_system/init.cc b/pw_system/init.cc
index 4196115d3..96d5dad39 100644
--- a/pw_system/init.cc
+++ b/pw_system/init.cc
@@ -26,6 +26,18 @@
#include "pw_system_private/log.h"
#include "pw_thread/detached_thread.h"
+#if PW_SYSTEM_ENABLE_TRANSFER_SERVICE
+#include "pw_system/transfer_service.h"
+#endif // PW_SYSTEM_ENABLE_TRANSFER_SERVICE
+
+#if PW_SYSTEM_ENABLE_TRACE_SERVICE
+#include "pw_system/file_service.h"
+#include "pw_system/trace_service.h"
+#include "pw_trace/trace.h"
+#endif // PW_SYSTEM_ENABLE_TRACE_SERVICE
+
+#include "pw_system/file_manager.h"
+
#if PW_SYSTEM_ENABLE_THREAD_SNAPSHOT_SERVICE
#include "pw_system/thread_snapshot_service.h"
#endif // PW_SYSTEM_ENABLE_THREAD_SNAPSHOT_SERVICE
@@ -38,6 +50,12 @@ metric::MetricService metric_service(metric::global_metrics,
rpc::EchoService echo_service;
void InitImpl() {
+#if PW_SYSTEM_ENABLE_TRACE_SERVICE
+ // tracing is off by default, requring a user to enable it through
+ // the trace service
+ PW_TRACE_SET_ENABLED(false);
+#endif
+
PW_LOG_INFO("System init");
// Setup logging.
@@ -52,6 +70,16 @@ void InitImpl() {
GetRpcServer().RegisterService(echo_service);
GetRpcServer().RegisterService(GetLogService());
GetRpcServer().RegisterService(metric_service);
+
+#if PW_SYSTEM_ENABLE_TRANSFER_SERVICE
+ RegisterTransferService(GetRpcServer());
+#endif // PW_SYSTEM_ENABLE_TRANSFER_SERVICE
+
+#if PW_SYSTEM_ENABLE_TRACE_SERVICE
+ RegisterFileService(GetRpcServer());
+ RegisterTraceService(GetRpcServer(), FileManager::kTraceTransferHandlerId);
+#endif // PW_SYSTEM_ENABLE_TRACE_SERVICE
+
#if PW_SYSTEM_ENABLE_THREAD_SNAPSHOT_SERVICE
RegisterThreadSnapshotService(GetRpcServer());
#endif // PW_SYSTEM_ENABLE_THREAD_SNAPSHOT_SERVICE
@@ -61,6 +89,11 @@ void InitImpl() {
thread::DetachedThread(system::LogThreadOptions(), GetLogThread());
thread::DetachedThread(system::RpcThreadOptions(), GetRpcDispatchThread());
+#if PW_SYSTEM_ENABLE_TRANSFER_SERVICE
+ thread::DetachedThread(system::TransferThreadOptions(), GetTransferThread());
+ InitTransferService();
+#endif // PW_SYSTEM_ENABLE_TRANSFER_SERVICE
+
GetWorkQueue().CheckPushWork(UserAppInit);
}