Main Page
Namespaces
Classes
Files
File List
File Members
src
main.cpp
Go to the documentation of this file.
1
/*
2
* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License").
5
* You may not use this file except in compliance with the License.
6
* A copy of the License is located at
7
*
8
* http://aws.amazon.com/apache2.0
9
*
10
* or in the "license" file accompanying this file. This file is distributed
11
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
* express or implied. See the License for the specific language governing
13
* permissions and limitations under the License.
14
*/
15
#include <aws/core/Aws.h>
16
#include <aws/core/utils/logging/LogMacros.h>
17
#include <
aws_common/sdk_utils/aws_error.h
>
18
#include <
aws_common/sdk_utils/client_configuration_provider.h
>
19
#include <
aws_ros1_common/sdk_utils/logging/aws_ros_logger.h
>
20
#include <
aws_ros1_common/sdk_utils/ros1_node_parameter_reader.h
>
21
#include <
kinesis_video_streamer/ros_stream_subscription_installer.h
>
22
#include <
kinesis_video_streamer/streamer.h
>
23
#include <
kinesis_video_streamer/subscriber_callbacks.h
>
24
#include <
ros/ros.h
>
25
26
using namespace
Aws::Client
;
27
using namespace
Aws::Kinesis
;
28
29
30
#ifndef RETURN_CODE_MASK
31
#define RETURN_CODE_MASK (0xff)
/* Process exit code is in range (0, 255) */
32
#endif
33
34
#ifndef UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE
35
#define UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE (0xf0)
36
#endif
37
38
constexpr
char
kNodeName
[] =
"kinesis_video_streamer"
;
39
40
int
shutdown
(Aws::SDKOptions options,
int
return_code) {
41
AWS_LOG_INFO(__func__,
"Shutting down Kinesis Video Node..."
);
42
Aws::Utils::Logging::ShutdownAWSLogging();
43
Aws::ShutdownAPI(options);
44
return
return_code &
RETURN_CODE_MASK
;
45
}
46
47
int
main
(
int
argc,
char
* argv[])
48
{
49
int
return_code =
UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE
;
50
51
ros::init
(argc, argv,
kNodeName
);
52
StreamerNode
streamer(
"~"
);
53
54
Aws::Utils::Logging::InitializeAWSLogging(
55
Aws::MakeShared<Aws::Utils::Logging::AWSROSLogger>(
kNodeName
));
56
Aws::SDKOptions options;
57
Aws::InitAPI(options);
58
59
KinesisManagerStatus
status = streamer.
Initialize
();
60
if
(!
KINESIS_MANAGER_STATUS_SUCCEEDED
(status)) {
61
return
shutdown
(options, status);
62
}
63
64
status = streamer.
InitializeStreamSubscriptions
();
65
if
(!
KINESIS_MANAGER_STATUS_SUCCEEDED
(status)) {
66
return
shutdown
(options, status);
67
}
68
69
AWS_LOG_INFO(__func__,
"Starting Kinesis Video Node..."
);
70
streamer.
Spin
();
71
72
return
shutdown
(options, return_code);
73
}
ros1_node_parameter_reader.h
ros_stream_subscription_installer.h
Aws::Kinesis::StreamerNode::Spin
void Spin()
Definition:
streamer.cpp:109
KinesisManagerStatus
enum Aws::Kinesis::kinesis_manager_status_e KinesisManagerStatus
Aws::Kinesis
Aws::Client
ros::init
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
KINESIS_MANAGER_STATUS_SUCCEEDED
#define KINESIS_MANAGER_STATUS_SUCCEEDED(status)
Aws::Kinesis::StreamerNode::Initialize
KinesisManagerStatus Initialize()
Definition:
streamer.cpp:64
UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE
#define UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE
Definition:
main.cpp:35
shutdown
int shutdown(Aws::SDKOptions options, int return_code)
Definition:
main.cpp:40
Aws::Kinesis::StreamerNode::InitializeStreamSubscriptions
KinesisManagerStatus InitializeStreamSubscriptions()
Definition:
streamer.cpp:93
Aws::Kinesis::StreamerNode
Definition:
streamer.h:32
RETURN_CODE_MASK
#define RETURN_CODE_MASK
Definition:
main.cpp:31
ros.h
aws_error.h
client_configuration_provider.h
aws_ros_logger.h
kNodeName
constexpr char kNodeName[]
Definition:
main.cpp:38
streamer.h
main
int main(int argc, char *argv[])
Definition:
main.cpp:47
subscriber_callbacks.h
kinesis_video_streamer
Author(s): AWS RoboMaker
autogenerated on Fri Mar 5 2021 03:29:15