Fawkes API
Fawkes Development Version
image-rest-api.h
1
2
/***************************************************************************
3
* image-rest-api.h - Image REST API
4
*
5
* Created: Sun Apr 8 19:07:16 2018 +0200
6
* Copyright 2006-2018 Tim Niemueller [www.niemueller.de]
7
****************************************************************************/
8
9
/* This program is free software; you can redistribute it and/or modify
10
* it under the terms of the GNU General Public License as published by
11
* the Free Software Foundation; either version 2 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Library General Public License for more details.
18
*
19
* Read the full text in the LICENSE.GPL file in the doc directory.
20
*/
21
22
#pragma once
23
24
#include "model/ImageInfo.h"
25
26
#include <aspect/blackboard.h>
27
#include <aspect/clock.h>
28
#include <aspect/configurable.h>
29
#include <aspect/logging.h>
30
#include <aspect/thread_producer.h>
31
#include <aspect/webview.h>
32
#include <core/threading/thread.h>
33
#include <webview/rest_api.h>
34
#include <webview/rest_array.h>
35
36
#include <map>
37
#include <string>
38
#include <utility>
39
40
namespace
fawkes
{
41
class
WebviewJpegStreamProducer;
42
}
43
44
class
ImageRestApi
:
public
fawkes::Thread
,
45
public
fawkes::ClockAspect
,
46
public
fawkes::ConfigurableAspect
,
47
public
fawkes::LoggingAspect
,
48
public
fawkes::BlackBoardAspect
,
49
public
fawkes::ThreadProducerAspect
,
50
public
fawkes::WebviewAspect
51
{
52
public
:
53
ImageRestApi
();
54
~ImageRestApi
();
55
56
virtual
void
init
();
57
virtual
void
loop
();
58
virtual
void
finalize
();
59
60
private
:
61
WebviewRestArray<ImageInfo>
cb_list_images();
62
63
std::shared_ptr<fawkes::WebviewJpegStreamProducer> get_stream(
const
std::string &image_id);
64
65
std::unique_ptr<fawkes::WebReply> cb_get_image(
fawkes::WebviewRestParams
¶ms);
66
67
private
:
68
fawkes::WebviewRestApi
* rest_api_;
69
std::map<std::string, std::shared_ptr<fawkes::WebviewJpegStreamProducer>> streams_;
70
};
ImageRestApi::finalize
virtual void finalize()
Finalize the thread.
Definition:
image-rest-api.cpp:61
fawkes::ThreadProducerAspect
Definition:
thread_producer.h:38
ImageRestApi::~ImageRestApi
~ImageRestApi()
Destructor.
Definition:
image-rest-api.cpp:44
ImageRestApi::init
virtual void init()
Initialize the thread.
Definition:
image-rest-api.cpp:49
ImageRestApi::ImageRestApi
ImageRestApi()
Constructor.
Definition:
image-rest-api.cpp:39
fawkes::BlackBoardAspect
Definition:
blackboard.h:38
fawkes
fawkes::LoggingAspect
Definition:
logging.h:38
WebviewRestArray
Container to return array via REST.
Definition:
rest_array.h:35
ImageRestApi::loop
virtual void loop()
Code to execute in the thread.
Definition:
image-rest-api.cpp:72
fawkes::WebviewRestParams
REST parameters to pass to handlers.
Definition:
rest_api.h:129
fawkes::WebviewAspect
Definition:
webview.h:42
ImageRestApi
Definition:
image-rest-api.h:44
fawkes::WebviewRestApi
Definition:
rest_api.h:225
fawkes::Thread
Definition:
thread.h:45
fawkes::ConfigurableAspect
Definition:
configurable.h:38
fawkes::ClockAspect
Definition:
clock.h:40
src
plugins
webview
image-rest-api
image-rest-api.h
Generated by
1.8.17