alb_curl_helper.h
Go to the documentation of this file.
1 #ifndef _ALB_CURL_HELPER_H
2 #define _ALB_CURL_HELPER_H
3 
4 // curl headers
5 #include <curl/curl.h>
6 
7 // Standard headers
8 #include <string>
9 
10 // Local headers
11 #include "outsight_alb_driver/AlbConfig.h"
12 #include "outsight_alb_driver/AlbFile.h"
13 
16  public:
19  Restart = 0,
22  };
23 
25  enum processing_config_e { Get = 0, Put };
26 
29  Download = 0,
32  };
33 
34  public:
35  AlbCurlHelper(const std::string &ip_address);
36  ~AlbCurlHelper(void);
37 
39  const std::string getErrorMessage(void) const;
40 
45  bool executeProcessing(const processing_service_e service);
46 
52  bool isProcessingRunning(bool &running);
53 
58  bool executeProcessingConfig(const processing_config_e &service,
59  outsight_alb_driver::AlbConfig::Request &request);
60 
65  bool executeProcessingZones(std::string &zones);
66 
71  bool executeStorage(const storage_service_e service, outsight_alb_driver::AlbFile::Request &request);
72 
73  private:
78  bool initCurl(void);
79 
81  void defineBaseCommand(const std::string &alb_command);
82 
87  bool defineProcessingConfig(const processing_config_e &service,
88  outsight_alb_driver::AlbConfig::Request &request);
89 
94  bool defineStorageCommand(const storage_service_e service, outsight_alb_driver::AlbFile::Request &request);
95 
100  bool executeCurlCommand(const std::string &command);
101 
106  bool exportData(const std::string &data, const std::string &output_path,
107  const std::string &print_text = std::string("Print data:"));
108 
110  const std::string readData(const std::string &filepath);
111 
113  bool defineStorageListCommand(const outsight_alb_driver::AlbFile::Request &request);
114 
115  protected:
116  CURL *curl;
117  struct curl_slist *chunk;
119 
120  std::string curl_address;
121  std::string callback_data;
122  std::string error_message;
123 
124  FILE *file;
125 };
126 
127 #endif // _ALB_CURL_HELPER_H
AlbCurlHelper::server_response
long server_response
Definition: alb_curl_helper.h:118
AlbCurlHelper::chunk
struct curl_slist * chunk
Definition: alb_curl_helper.h:117
AlbCurlHelper::AlbCurlHelper
AlbCurlHelper(const std::string &ip_address)
Definition: alb_curl_helper.cpp:51
AlbCurlHelper::Get
@ Get
Definition: alb_curl_helper.h:25
AlbCurlHelper::storage_service_e
storage_service_e
Storage services.
Definition: alb_curl_helper.h:28
AlbCurlHelper::curl
CURL * curl
Definition: alb_curl_helper.h:116
AlbCurlHelper::error_message
std::string error_message
Definition: alb_curl_helper.h:122
AlbCurlHelper::curl_address
std::string curl_address
Definition: alb_curl_helper.h:120
AlbCurlHelper::initCurl
bool initCurl(void)
Initialize the curl command.
Definition: alb_curl_helper.cpp:196
AlbCurlHelper::Stop
@ Stop
Definition: alb_curl_helper.h:20
AlbCurlHelper::executeCurlCommand
bool executeCurlCommand(const std::string &command)
Execute the curl command.
Definition: alb_curl_helper.cpp:295
AlbCurlHelper
Class to handle the curl ALB requests.
Definition: alb_curl_helper.h:15
AlbCurlHelper::file
FILE * file
Definition: alb_curl_helper.h:124
AlbCurlHelper::getErrorMessage
const std::string getErrorMessage(void) const
Get the error message.
Definition: alb_curl_helper.cpp:70
AlbCurlHelper::executeProcessingConfig
bool executeProcessingConfig(const processing_config_e &service, outsight_alb_driver::AlbConfig::Request &request)
Execute the processing command for the configuration.
Definition: alb_curl_helper.cpp:117
AlbCurlHelper::processing_config_e
processing_config_e
Processing configuration services.
Definition: alb_curl_helper.h:25
AlbCurlHelper::defineProcessingConfig
bool defineProcessingConfig(const processing_config_e &service, outsight_alb_driver::AlbConfig::Request &request)
Define the processing configuration command.
Definition: alb_curl_helper.cpp:220
AlbCurlHelper::defineStorageListCommand
bool defineStorageListCommand(const outsight_alb_driver::AlbFile::Request &request)
Define the command to list storage files.
Definition: alb_curl_helper.cpp:366
AlbCurlHelper::executeStorage
bool executeStorage(const storage_service_e service, outsight_alb_driver::AlbFile::Request &request)
Execute the storage command.
Definition: alb_curl_helper.cpp:166
AlbCurlHelper::defineStorageCommand
bool defineStorageCommand(const storage_service_e service, outsight_alb_driver::AlbFile::Request &request)
Define the storage command.
Definition: alb_curl_helper.cpp:246
AlbCurlHelper::executeProcessing
bool executeProcessing(const processing_service_e service)
Execute the processing command.
Definition: alb_curl_helper.cpp:75
AlbCurlHelper::processing_service_e
processing_service_e
Processing services of the ALB.
Definition: alb_curl_helper.h:18
AlbCurlHelper::exportData
bool exportData(const std::string &data, const std::string &output_path, const std::string &print_text=std::string("Print data:"))
Export the data to the output filepath.
Definition: alb_curl_helper.cpp:319
AlbCurlHelper::defineBaseCommand
void defineBaseCommand(const std::string &alb_command)
Define base curl command for the ALB.
Definition: alb_curl_helper.cpp:206
AlbCurlHelper::Restart
@ Restart
Definition: alb_curl_helper.h:19
AlbCurlHelper::callback_data
std::string callback_data
Definition: alb_curl_helper.h:121
AlbCurlHelper::executeProcessingZones
bool executeProcessingZones(std::string &zones)
Execute the processing command for the zones.
Definition: alb_curl_helper.cpp:145
AlbCurlHelper::Put
@ Put
Definition: alb_curl_helper.h:25
AlbCurlHelper::List
@ List
Definition: alb_curl_helper.h:31
AlbCurlHelper::~AlbCurlHelper
~AlbCurlHelper(void)
Definition: alb_curl_helper.cpp:59
AlbCurlHelper::Upload
@ Upload
Definition: alb_curl_helper.h:30
AlbCurlHelper::readData
const std::string readData(const std::string &filepath)
Read data from the input filepath.
Definition: alb_curl_helper.cpp:339
AlbCurlHelper::Download
@ Download
Definition: alb_curl_helper.h:29
AlbCurlHelper::Status
@ Status
Definition: alb_curl_helper.h:21
AlbCurlHelper::isProcessingRunning
bool isProcessingRunning(bool &running)
Check if processing is running.
Definition: alb_curl_helper.cpp:94


outsight_alb_driver
Author(s): Outsight
autogenerated on Thu Oct 13 2022 02:21:45