Skip to content

Commit

Permalink
fix some problems and remove some useless code
Browse files Browse the repository at this point in the history
It is successfully built on armv7 platform and can run
Add the shooting result back to the client, and calculate the histogram after exposure
Add some useful functions and APIs
But there are still problems with the results returned by the connected device
  • Loading branch information
AstroAir committed Feb 10, 2021
1 parent 7865084 commit 7ec265d
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 192 deletions.
29 changes: 13 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@ project(airserver VERSION 1.0)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(PLATFORM x64)
set(MODE DEBUG)

configure_file(config.h.in config.h)

add_executable(airserver src/main.cpp)

set(PLATFORM armv7)
set(MODE DEBUG)
message("-- Building on the ${PLATFORM} platform")
message("-- Building mode is ${MODE}")

add_executable(airserver src/main.cpp)

#设置Websocketpp库
option(HAS_WEBSOCKET "Using Websocketpp Library" ON)
if(HAS_WEBSOCKET)
Expand All @@ -40,9 +39,8 @@ if(HAS_WEBSOCKET)
add_library(LIBWEBSOCKET src/wsserver.cpp)
target_link_libraries(airserver PUBLIC LIBWEBSOCKET)
else()
message("-- Could not found websocketpp library.Use local version!")
target_include_directories(airserver PUBLIC "${PROJECT_SOURCE_DIR}/include/websocketpp")
#add_custom_command(COMMAND sudo cp -r include/websocketpp /usr/include)
message("-- Could not found websocketpp library.Try to build it!")
add_custom_command(COMMAND sudo apt install libwebsocketpp-dev -y)
endif()
else()
message("Please check setting,websocketpp is one of the main library!")
Expand Down Expand Up @@ -120,26 +118,25 @@ if(HAS_JSONCPP)
message("-- Found JsonCpp library in ${PATH_JSONCPP}")
target_link_libraries(airserver PUBLIC libjsoncpp.so)
else()
message("-- Could not found ASI camera library.Use local version!")
target_include_directories(airserver PUBLIC "${PROJECT_SOURCE_DIR}/include/json")
set(LOCAL_JSONCPP lib/json)
link_directories(${LOCAL_JSONCPP})
target_link_libraries(airserver PUBLIC libjsoncpp.so)
message("-- Could not found ASI camera library.Try to build it!")
add_custom_command(COMMAND sudo apt install libjsoncpp-dev -y)
endif()
else()
message("Please check setting,jsoncpp is one of the main library!")
endif()

target_link_libraries(airserver PUBLIC libASICamera2.so)
target_link_libraries(airserver PUBLIC libqhyccd.so)
target_link_libraries(airserver PUBLIC libcfitsio.so)
#链接动态库
target_link_libraries(airserver PUBLIC libASICamera2.so) #ASI相机
target_link_libraries(airserver PUBLIC libqhyccd.so) #QHY相机
target_link_libraries(airserver PUBLIC libcfitsio.so) #CFitsIO
target_link_libraries(airserver PUBLIC libpthread.so)
target_link_libraries(airserver PUBLIC libnova.so)
target_link_libraries(airserver PUBLIC libusb-1.0.so)
target_link_libraries(airserver PUBLIC libopencv_highgui.so)
target_link_libraries(airserver PUBLIC libopencv_imgproc.so)
target_link_libraries(airserver PUBLIC libopencv_imgcodecs.so)
target_link_libraries(airserver PUBLIC libopencv_core.so)
target_link_libraries(airserver PUBLIC libboost_system.so)

target_include_directories(airserver PUBLIC
"${PROJECT_BINARY_DIR}/src"
Expand Down
12 changes: 6 additions & 6 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define server_VERSION_MAJOR @server_VERSION_MAJOR@
#define server_VERSION_MINOR @server_VERSION_MINOR@
#define HAS_WEBSOCKET @server_HAS_WEBSOCKET@
#define HAS_JSONCPP @server_HAS_JSONCPP@
#define HAS_NOVA @server_HAS_NOVA@
#define HAS_ASI @server_HAS_ASI@
#define VERSION_MAJOR @airserver_VERSION_MAJOR@
#define VERSION_MINOR @airserver_VERSION_MINOR@
#define HAS_WEBSOCKET @airserver_HAS_WEBSOCKET@
#define HAS_JSONCPP @airserver_HAS_JSONCPP@
#define HAS_NOVA @airserver_HAS_NOVA@
#define HAS_ASI @airserver_HAS_ASI@
2 changes: 0 additions & 2 deletions src/air-asi/asi_ccd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ Description:ZWO camera driver
#include "../logger.h"
#include "../opencv.h"

#include "string.h"

namespace AstroAir
{
/*
Expand Down
7 changes: 2 additions & 5 deletions src/air-asi/asi_ccd.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,12 @@ Description:ZWO camera driver
#include "../wsserver.h"
#include "../libasi/ASICamera2.h"

#include <condition_variable>
#include <mutex>
#include <thread>
#include <atomic>
#include <chrono>
#include <vector>

#include "fitsio.h"
#include "fitsio2.h"
#include <string.h>
#include <fitsio.h>

#define MAXDEVICENUM 5

Expand Down
23 changes: 22 additions & 1 deletion src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ Description:Log system of astroair server
**************************************************/

#include <string>
#include <fstream>
#include <thread>
#include <cstring>
#include <dirent.h>
#include <string.h>

#include "logger.h"

Expand Down Expand Up @@ -179,5 +181,24 @@ namespace AstroAir
t->minute = p->tm_min;
t->second = p->tm_sec;
return t;
}

std::vector<std::string> split(const std::string& str, const std::string& delim)
{
std::vector<std::string> res;
if("" == str) return res;
//先将要切割的字符串从string类型转换为char*类型
char * strs = new char[str.length() + 1] ; //不要忘了
strcpy(strs, str.c_str());
char * d = new char[delim.length() + 1];
strcpy(d, delim.c_str());
char *p = strtok(strs, d);
while(p)
{
std::string s = p; //分割得到的字符串转换为string类型
res.push_back(s); //存入结果数组
p = strtok(NULL, d);
}
return res;
}
}
5 changes: 4 additions & 1 deletion src/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ Description:Log system of astroair server
#include <cstdarg>
#include <time.h>
#include <sys/time.h>
#include <vector>
#include <string>

#ifdef WINDOWS
#include <windows.h>
Expand All @@ -60,7 +62,6 @@ typedef struct {

namespace AstroAir
{
/*日志输出*/
/*在终端输出*/
void IDLog(const char *fmt, ...);
/*输出服务器Debug日志*/
Expand All @@ -75,6 +76,8 @@ namespace AstroAir
bool setSystemTime(TIME *_time);
/*获取本地系统时间*/
TIME* getSystemLocalTime();
/*获取制定目录制定后缀的文件*/
std::vector<std::string> split(const std::string& str, const std::string& delim);
}

#endif
Loading

0 comments on commit 7ec265d

Please sign in to comment.