/* * Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #include #include #include #include #include #include #include #include #include #include using namespace Aws::Client; using namespace Aws::Kinesis; #ifndef RETURN_CODE_MASK #define RETURN_CODE_MASK (0xff) /* Process exit code is in range (0, 255) */ #endif #ifndef UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE #define UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE (0xf0) #endif constexpr char kNodeName[] = "kinesis_video_streamer"; int shutdown(Aws::SDKOptions options, int return_code) { AWS_LOG_INFO(__func__, "Shutting down Kinesis Video Node..."); Aws::Utils::Logging::ShutdownAWSLogging(); Aws::ShutdownAPI(options); return return_code & RETURN_CODE_MASK; } int main(int argc, char * argv[]) { int return_code = UNKNOWN_ERROR_KINESIS_VIDEO_EXIT_CODE; ros::init(argc, argv, kNodeName); StreamerNode streamer("~"); Aws::Utils::Logging::InitializeAWSLogging( Aws::MakeShared(kNodeName)); Aws::SDKOptions options; Aws::InitAPI(options); KinesisManagerStatus status = streamer.Initialize(); if (!KINESIS_MANAGER_STATUS_SUCCEEDED(status)) { return shutdown(options, status); } status = streamer.InitializeStreamSubscriptions(); if (!KINESIS_MANAGER_STATUS_SUCCEEDED(status)) { return shutdown(options, status); } AWS_LOG_INFO(__func__, "Starting Kinesis Video Node..."); streamer.Spin(); return shutdown(options, return_code); }