Agrarsense
ROSHandler.h
Go to the documentation of this file.
1// Copyright (c) 2023 FrostBit Software Lab at the Lapland University of Applied Sciences
2//
3// This work is licensed under the terms of the MIT license.
4// For a copy, see <https://opensource.org/licenses/MIT>.
5
6#pragma once
7
8#include "CoreMinimal.h"
9#include "UObject/Object.h"
10#include "Engine/EngineTypes.h"
11#include "GenericPlatform/GenericPlatformProcess.h"
12
13#include "ROSState.h"
14#include "ROSHandler.generated.h"
15
20
26UCLASS()
27class AGRARSENSE_API UROSHandler : public UObject
28{
29 GENERATED_BODY()
30
31public:
32
36 void Setup(bool RosIsConnected);
37
41 UFUNCTION(BlueprintCallable)
42 void LaunchROSBridge();
43
47 UFUNCTION(BlueprintCallable)
48 void StopROSBridge();
49
53 UFUNCTION(BlueprintCallable)
54 void RestartROSBridge();
55
60 UFUNCTION(BlueprintCallable)
61 bool IsROSConnected()
62 {
63 return ROSConnected;
64 }
65
70 UFUNCTION(BlueprintCallable)
71 EROSState GetROSState()
72 {
73 return ROSState;
74 }
75
80 UPROPERTY(BlueprintAssignable)
81 FROSDelegate_ROState OnROSStateChanged;
82
83private:
84
85 UFUNCTION()
86 void OnROSBridgeChanged(EROSState newRosState);
87
88 EROSState ROSState = EROSState::Disconnected;
89
90 FProcHandle ROSProcessHandle;
91
92 FProcHandle ROSBridgeHandle;
93
94 bool ROSConnected = false;
95
96};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FROSDelegate_ROState, EROSState, rosState)
EROSState
Definition: ROSState.h:16