collect all common functions into separate library; add simple client example

This commit is contained in:
Edward Emelianov 2024-01-24 17:19:11 +03:00
parent 3113d9754d
commit a5926861bc
29 changed files with 2013 additions and 1194 deletions

View File

@ -29,11 +29,11 @@
#include <usefull_macros.h> #include <usefull_macros.h>
#include "basestructs.h" #include "ccdcapture.h"
//#include "omp.h" //#include "omp.h"
extern Camera camera; extern cc_Camera camera;
static int ncameras = 0; static int ncameras = 0;
static int isopened = FALSE; static int isopened = FALSE;
static int osw = 0; // overscan width static int osw = 0; // overscan width
@ -156,15 +156,15 @@ static int modelname(char *buf, int bufsz){
return TRUE; return TRUE;
} }
static int shutter(shutter_op cmd){ static int shutter(cc_shutter_op cmd){
int op = (cmd == SHUTTER_OPEN) ? 1 : 0; int op = (cmd == SHUTTER_OPEN) ? 1 : 0;
ApnGlueOpenShutter(op); ApnGlueOpenShutter(op);
return TRUE; return TRUE;
} }
static int geometrylimits(frameformat *l, frameformat *s){ static int geometrylimits(cc_frameformat *l, cc_frameformat *s){
if(l) *l = camera.array; if(l) *l = camera.array;
if(s) *s = (frameformat){.w = 1, .h = 1, .xoff = 1, .yoff = 1}; if(s) *s = (cc_frameformat){.w = 1, .h = 1, .xoff = 1, .yoff = 1};
return TRUE; return TRUE;
} }
@ -173,7 +173,7 @@ static int sett(float t){
return TRUE; return TRUE;
} }
static int setfanspd(fan_speed s){ static int setfanspd(cc_fan_speed s){
ApnGlueSetFan((int) s); ApnGlueSetFan((int) s);
return TRUE; return TRUE;
} }
@ -200,7 +200,7 @@ static int setfastspeed(int fast){
return TRUE; return TRUE;
} }
static int setgeometry(frameformat *f){ static int setgeometry(cc_frameformat *f){
if(!f) return FALSE; if(!f) return FALSE;
if(f->xoff > camera.field.w - 1) f->xoff = camera.field.w - 1; if(f->xoff > camera.field.w - 1) f->xoff = camera.field.w - 1;
if(f->yoff > camera.field.h - 1) f->yoff = camera.field.h - 1; if(f->yoff > camera.field.h - 1) f->yoff = camera.field.h - 1;
@ -287,7 +287,7 @@ static int getbin(int *h, int *v){
return TRUE; return TRUE;
} }
static int pollcapt(capture_status *st, float *remain){ static int pollcapt(cc_capture_status *st, float *remain){
if(st) *st = CAPTURE_PROCESS; if(st) *st = CAPTURE_PROCESS;
if(ApnGlueExpDone()){ if(ApnGlueExpDone()){
if(st) *st = CAPTURE_READY; if(st) *st = CAPTURE_READY;
@ -312,7 +312,7 @@ static int pollcapt(capture_status *st, float *remain){
return TRUE; return TRUE;
} }
static int capture(IMG *ima){ static int capture(cc_IMG *ima){
FNAME(); FNAME();
if(!ima || !ima->data) return FALSE; if(!ima || !ima->data) return FALSE;
DBG("ApnGlueReadPixels(%dx%d=%d)", imW, imH, imW * imH); DBG("ApnGlueReadPixels(%dx%d=%d)", imW, imH, imW * imH);
@ -334,7 +334,7 @@ static int ipfalse(_U_ int *i){ return FALSE; }
/* /*
* Global objects: camera, focuser and wheel * Global objects: camera, focuser and wheel
*/ */
Camera camera = { cc_Camera camera = {
.check = ndev, .check = ndev,
.close = disconnect, .close = disconnect,
.pollcapture = pollcapt, .pollcapture = pollcapt,

View File

@ -22,11 +22,11 @@
#include <string.h> #include <string.h>
#include <usefull_macros.h> #include <usefull_macros.h>
#include "basestructs.h" #include "ccdcapture.h"
#include "omp.h" #include "omp.h"
//#include "socket.h" // timestamp //#include "socket.h" // timestamp
extern Camera camera; extern cc_Camera camera;
static PYLON_DEVICE_HANDLE hDev; static PYLON_DEVICE_HANDLE hDev;
static int isopened = FALSE, is16bit = FALSE; static int isopened = FALSE, is16bit = FALSE;
@ -247,7 +247,7 @@ static int getgeom(){
return TRUE; return TRUE;
} }
static int geometrylimits(frameformat *max, frameformat *step){ static int geometrylimits(cc_frameformat *max, cc_frameformat *step){
FNAME(); FNAME();
if(!isopened || !max || !step) return FALSE; if(!isopened || !max || !step) return FALSE;
int64_values i; int64_values i;
@ -329,13 +329,13 @@ static int setbitdepth(int depth){
} }
// stub function: the capture process is blocking // stub function: the capture process is blocking
static int pollcapt(capture_status *st, float *remain){ static int pollcapt(cc_capture_status *st, float *remain){
if(st) *st = CAPTURE_READY; if(st) *st = CAPTURE_READY;
if(remain) *remain = 0.f; if(remain) *remain = 0.f;
return TRUE; return TRUE;
} }
static int capture(IMG *ima){ static int capture(cc_IMG *ima){
FNAME(); FNAME();
//double __t0 = dtime(); //double __t0 = dtime();
if(!ima || !ima->data || !imgBuf || !isopened) return FALSE; if(!ima || !ima->data || !imgBuf || !isopened) return FALSE;
@ -424,7 +424,7 @@ static int setgain(float e){
return TRUE; return TRUE;
} }
static int changeformat(frameformat *fmt){ static int changeformat(cc_frameformat *fmt){
FNAME(); FNAME();
if(!isopened) return FALSE; if(!isopened) return FALSE;
if(!getbin(NULL, NULL)){curhbin = 1; curvbin = 1;} if(!getbin(NULL, NULL)){curhbin = 1; curvbin = 1;}
@ -484,10 +484,10 @@ static int gett(float *t){
return TRUE; return TRUE;
} }
static int setfanspd(_U_ fan_speed s){ static int setfanspd(_U_ cc_fan_speed s){
return FALSE; return FALSE;
} }
static int shutter(_U_ shutter_op cmd){ static int shutter(_U_ cc_shutter_op cmd){
return FALSE; return FALSE;
} }
@ -501,7 +501,7 @@ static void vstub(){ return ;}
/* /*
* Global objects: camera, focuser and wheel * Global objects: camera, focuser and wheel
*/ */
Camera camera = { cc_Camera camera = {
.check = connect, .check = connect,
.close = disconnect, .close = disconnect,
.pollcapture = pollcapt, .pollcapture = pollcapt,

View File

@ -1,12 +1,16 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
set(PROJ ccd_capture) set(PROJ ccd_capture)
set(PROJLIB ccdcapture)
set(MAJOR_VERSION "1") set(MAJOR_VERSION "1")
set(MID_VERSION "1") set(MID_VERSION "2")
set(MINOR_VERSION "1") set(MINOR_VERSION "0")
set(LIBSRC ccdcapture.c)
set(SOURCES main.c cmdlnopts.c ccdfunc.c server.c client.c)
set(LIBHEADER "ccdcapture.h")
set(VERSION "${MAJOR_VERSION}.${MID_VERSION}.${MINOR_VERSION}") set(VERSION "${MAJOR_VERSION}.${MID_VERSION}.${MINOR_VERSION}")
project(${PROJ} VERSION ${VERSION} LANGUAGES C) project(${PROJ} VERSION ${VERSION} LANGUAGES C)
message("VER: ${VERSION}") message("VER: ${VERSION}")
# list of options # list of options
@ -18,9 +22,10 @@ option(BASLER "Add support of BASLER cameras" OFF)
option(HIKROBOT "Add support of HIKROBOT cameras" OFF) option(HIKROBOT "Add support of HIKROBOT cameras" OFF)
option(FLYCAP "Add support of Grasshopper FlyCap cameras" OFF) option(FLYCAP "Add support of Grasshopper FlyCap cameras" OFF)
option(APOGEE "Add support of Apogee cameras" OFF) option(APOGEE "Add support of Apogee cameras" OFF)
option(EXAMPLES "Some examples" OFF)
# default flags # default flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wextra -std=gnu99") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W -Wextra")
# change wrong behaviour with install prefix # change wrong behaviour with install prefix
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local") if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND CMAKE_INSTALL_PREFIX MATCHES "/usr/local")
@ -29,7 +34,7 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND CMAKE_INSTALL_PREFIX MATCHES
endif() endif()
message("Install dir prefix: ${CMAKE_INSTALL_PREFIX}") message("Install dir prefix: ${CMAKE_INSTALL_PREFIX}")
if(NOT DEFINED LOCALEDIR) if(NOT DEFINED LOCALEDIR)
if(DEFINED DEBUG AND DEBUG STREQUAL "yes") if(DEBUG)
set(LOCALEDIR ${CMAKE_CURRENT_SOURCE_DIR}/locale) set(LOCALEDIR ${CMAKE_CURRENT_SOURCE_DIR}/locale)
else() else()
set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale) set(LOCALEDIR ${CMAKE_INSTALL_PREFIX}/share/locale)
@ -43,7 +48,6 @@ add_definitions(-D_XOPEN_SOURCE=1234 -D_DEFAULT_SOURCE -D_GNU_SOURCE -DLOCALEDIR
set(CMAKE_COLOR_MAKEFILE ON) set(CMAKE_COLOR_MAKEFILE ON)
set(SOURCES main.c cmdlnopts.c ccdfunc.c socket.c server.c client.c)
# cmake -DDEBUG=yes -> debugging # cmake -DDEBUG=yes -> debugging
if(DEBUG) if(DEBUG)
@ -62,6 +66,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_package(CFITSIO REQUIRED) find_package(CFITSIO REQUIRED)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)
pkg_check_modules(${PROJ} REQUIRED usefull_macros) pkg_check_modules(${PROJ} REQUIRED usefull_macros)
pkg_check_modules(${PROJLIB} REQUIRED usefull_macros)
include(FindOpenMP) include(FindOpenMP)
if(OPENMP_FOUND) if(OPENMP_FOUND)
@ -101,6 +106,9 @@ endif()
if(APOGEE) if(APOGEE)
add_subdirectory(APOGEE_cameras) add_subdirectory(APOGEE_cameras)
endif() endif()
if(EXAMPLES)
add_subdirectory(examples)
endif()
# directory should contain dir locale/ru for gettext translations # directory should contain dir locale/ru for gettext translations
set(LCPATH ${CMAKE_SOURCE_DIR}/locale/ru) set(LCPATH ${CMAKE_SOURCE_DIR}/locale/ru)
@ -110,15 +118,25 @@ set(PO_FILE ${LCPATH}/messages.po)
set(MO_FILE ${LCPATH}/LC_MESSAGES/${PROJ}.mo) set(MO_FILE ${LCPATH}/LC_MESSAGES/${PROJ}.mo)
set(RU_FILE ${LCPATH}/ru.po) set(RU_FILE ${LCPATH}/ru.po)
# exe file # exe & lib files
add_library(${PROJLIB} SHARED ${LIBSRC})
add_executable(${PROJ} ${SOURCES} ${PO_FILE} ${MO_FILE}) add_executable(${PROJ} ${SOURCES} ${PO_FILE} ${MO_FILE})
target_link_libraries(${PROJ} ${CFITSIO_LIBRARIES} ${X11_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${${PROJ}_LIBRARIES} -lm ${CMAKE_DL_LIBS}) target_link_libraries(${PROJ} ${CFITSIO_LIBRARIES} ${X11_LIBRARIES} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ${${PROJ}_LIBRARIES} -lm ${CMAKE_DL_LIBS} ${PROJLIB})
target_link_libraries(${PROJLIB} ${${PROJLIB}_LIBRARIES})
include_directories(${${PROJ}_INCLUDE_DIRS} .) include_directories(${${PROJ}_INCLUDE_DIRS} .)
link_directories(${${PROJ}_LIBRARY_DIRS} ) link_directories(${${PROJ}_LIBRARY_DIRS} )
set(PCFILE "${CMAKE_BINARY_DIR}/${PROJLIB}.pc")
configure_file("${PROJLIB}.pc.in" ${PCFILE} @ONLY)
set_target_properties(${PROJLIB} PROPERTIES VERSION ${VERSION})
set_target_properties(${PROJLIB} PROPERTIES PUBLIC_HEADER ${LIBHEADER})
# Installation of the program # Installation of the program
install(FILES ${MO_FILE} DESTINATION "share/locale/ru/LC_MESSAGES") install(FILES ${MO_FILE} DESTINATION "share/locale/ru/LC_MESSAGES")
install(TARGETS ${PROJ} DESTINATION "bin") install(TARGETS ${PROJ} DESTINATION "bin")
install(TARGETS ${PROJLIB} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES ${PCFILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
find_package(Gettext REQUIRED) find_package(Gettext REQUIRED)
find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext) find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)

View File

@ -25,12 +25,12 @@
#include <unistd.h> #include <unistd.h>
#include <usefull_macros.h> #include <usefull_macros.h>
#include "basestructs.h" #include "ccdcapture.h"
#include "omp.h" #include "omp.h"
extern Camera camera; extern cc_Camera camera;
extern Focuser focuser; extern cc_Focuser focuser;
extern Wheel wheel; extern cc_Wheel wheel;
static const int filtermax = 5; static const int filtermax = 5;
static const float focmaxpos = 10.; static const float focmaxpos = 10.;
@ -38,11 +38,11 @@ static int curhbin = 1, curvbin = 1;
static int filterpos = 0; static int filterpos = 0;
static float focuserpos = 1., brightness = 1., gain = 0.; static float focuserpos = 1., brightness = 1., gain = 0.;
static float camtemp = -30., exptime = 0.; static float camtemp = -30., exptime = 0.;
static capture_status capstat = CAPTURE_NO; static cc_capture_status capstat = CAPTURE_NO;
static double texpstart = 0.; static double texpstart = 0.;
static uint8_t bitpix = 16; // bit depth: 8 or 16 static uint8_t bitpix = 16; // bit depth: 8 or 16
static int campoll(capture_status *st, float *remain){ static int campoll(cc_capture_status *st, float *remain){
if(capstat != CAPTURE_PROCESS){ if(capstat != CAPTURE_PROCESS){
if(st) *st = capstat; if(st) *st = capstat;
if(remain) *remain = 0.; if(remain) *remain = 0.;
@ -66,7 +66,7 @@ static int startexp(){
return TRUE; return TRUE;
} }
static int camcapt(IMG *ima){ static int camcapt(cc_IMG *ima){
static int n = 0; static int n = 0;
if(!ima || !ima->data) return FALSE; if(!ima || !ima->data) return FALSE;
#ifdef EBUG #ifdef EBUG
@ -163,11 +163,11 @@ static int camsetbin(int h, int v){
return TRUE; return TRUE;
} }
static int camshutter(_U_ shutter_op s){ static int camshutter(_U_ cc_shutter_op s){
return TRUE; return TRUE;
} }
static int camsetgeom(frameformat *f){ static int camsetgeom(cc_frameformat *f){
if(!f) return FALSE; if(!f) return FALSE;
camera.geometry = *f; camera.geometry = *f;
return TRUE; return TRUE;
@ -183,9 +183,9 @@ static int camgmg(float *mg){
return TRUE; return TRUE;
} }
static int camggl(frameformat *max, frameformat *step){ static int camggl(cc_frameformat *max, cc_frameformat *step){
if(max) *max = camera.array; if(max) *max = camera.array;
if(step) *step = (frameformat){1,1,1,1}; if(step) *step = (cc_frameformat){1,1,1,1};
return TRUE; return TRUE;
} }
@ -200,7 +200,7 @@ static int camgetio(int *io){
return TRUE; return TRUE;
} }
static int camfan(_U_ fan_speed spd){return TRUE;} static int camfan(_U_ cc_fan_speed spd){return TRUE;}
static int focsetpos(_U_ int a, float n){ static int focsetpos(_U_ int a, float n){
if(n < 0. || n > focmaxpos) return FALSE; if(n < 0. || n > focmaxpos) return FALSE;
@ -267,7 +267,7 @@ static int istub(_U_ int N){return TRUE;}
/* /*
* Global objects: camera, focuser and wheel * Global objects: camera, focuser and wheel
*/ */
__attribute__ ((visibility("default"))) Camera camera = { __attribute__ ((visibility("default"))) cc_Camera camera = {
.check = stub, .check = stub,
.Ndevices = 1, .Ndevices = 1,
.close = vstub, .close = vstub,
@ -305,12 +305,12 @@ __attribute__ ((visibility("default"))) Camera camera = {
.getio = camgetio, .getio = camgetio,
.pixX = 10., .pixX = 10.,
.pixY = 10., .pixY = 10.,
.field = (frameformat){.h = 1024, .w = 1024, .xoff = 10, .yoff = 10}, .field = (cc_frameformat){.h = 1024, .w = 1024, .xoff = 10, .yoff = 10},
.array = (frameformat){.h = 1050, .w = 1050, .xoff = 0, .yoff = 0}, .array = (cc_frameformat){.h = 1050, .w = 1050, .xoff = 0, .yoff = 0},
.geometry = {0}, .geometry = {0},
}; };
__attribute__ ((visibility("default"))) Focuser focuser = { __attribute__ ((visibility("default"))) cc_Focuser focuser = {
.check = stub, .check = stub,
.Ndevices = 1, .Ndevices = 1,
.close = vstub, .close = vstub,
@ -326,7 +326,7 @@ __attribute__ ((visibility("default"))) Focuser focuser = {
.getMinPos = focmp, .getMinPos = focmp,
}; };
__attribute__ ((visibility("default"))) Wheel wheel = { __attribute__ ((visibility("default"))) cc_Wheel wheel = {
.check = stub, .check = stub,
.Ndevices = 1, .Ndevices = 1,
.close = vstub, .close = vstub,

View File

@ -21,11 +21,11 @@
#include <string.h> #include <string.h>
#include <usefull_macros.h> #include <usefull_macros.h>
#include "basestructs.h" #include "ccdcapture.h"
extern Camera camera; extern cc_Camera camera;
extern Focuser focuser; extern cc_Focuser focuser;
extern Wheel wheel; extern cc_Wheel wheel;
#define LIBVERSIZ 1024 #define LIBVERSIZ 1024
@ -63,7 +63,7 @@ static char camname[BUFSIZ] = {0}, whlname[BUFSIZ], focname[BUFSIZ];
static long fli_err, tmpl; static long fli_err, tmpl;
static cam_t *camz = NULL, *whlz = NULL, *focz = NULL; static cam_t *camz = NULL, *whlz = NULL, *focz = NULL;
static flidev_t camdev = -1, whldev = -1, focdev = -1; static flidev_t camdev = -1, whldev = -1, focdev = -1;
static capture_status capStatus = CAPTURE_NO; static cc_capture_status capStatus = CAPTURE_NO;
static int curhbin = 1, curvbin = 1; static int curhbin = 1, curvbin = 1;
static long filterpos = -1, filtermax = -1; // filter position static long filterpos = -1, filtermax = -1; // filter position
static long focuserpos = -1, focmaxpos = -1; // focuser position static long focuserpos = -1, focmaxpos = -1; // focuser position
@ -135,7 +135,7 @@ static int fli_findCCD(){
return FALSE; return FALSE;
} }
for(int i = 0; i < camera.Ndevices; i++){ for(int i = 0; i < camera.Ndevices; i++){
DBG("Camera '%s', domain %s", camz[i].name, camz[i].dname); DBG("cc_Camera '%s', domain %s", camz[i].name, camz[i].dname);
} }
} }
return TRUE; return TRUE;
@ -174,19 +174,19 @@ static int fli_setActiceCam(int n){
TRYFUNC(FLIGetVisibleArea, camdev, &x0, &y0, &x1, &y1); TRYFUNC(FLIGetVisibleArea, camdev, &x0, &y0, &x1, &y1);
if(!fli_err){ if(!fli_err){
DBG("Field of view: (%ld, %ld)(%ld, %ld)", x0, y0, x1, y1); DBG("Field of view: (%ld, %ld)(%ld, %ld)", x0, y0, x1, y1);
camera.field = (frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0}; camera.field = (cc_frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0};
} }
TRYFUNC(FLIGetArrayArea, camdev, &x0, &y0, &x1, &y1); TRYFUNC(FLIGetArrayArea, camdev, &x0, &y0, &x1, &y1);
if(!fli_err){ if(!fli_err){
DBG("Array field: (%ld, %ld)(%ld, %ld)", x0, y0, x1, y1); DBG("Array field: (%ld, %ld)(%ld, %ld)", x0, y0, x1, y1);
camera.array = (frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0}; camera.array = (cc_frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0};
} }
return TRUE; return TRUE;
} }
static int fli_geomlimits(frameformat *l, frameformat *s){ static int fli_geomlimits(cc_frameformat *l, cc_frameformat *s){
if(l) *l = camera.array; if(l) *l = camera.array;
if(s) *s = (frameformat){.w = 1, .h = 1, .xoff = 1, .yoff = 1}; if(s) *s = (cc_frameformat){.w = 1, .h = 1, .xoff = 1, .yoff = 1};
return TRUE; return TRUE;
} }
@ -203,7 +203,7 @@ static int fli_findFocuser(){
return FALSE; return FALSE;
} }
for(int i = 0; i < focuser.Ndevices; i++){ for(int i = 0; i < focuser.Ndevices; i++){
DBG("Focuser '%s', domain %s", focz[i].name, focz[i].dname); DBG("cc_Focuser '%s', domain %s", focz[i].name, focz[i].dname);
} }
} }
return TRUE; return TRUE;
@ -237,7 +237,7 @@ static int fli_setActiceFocuser(int n){
DBG("Not found"); DBG("Not found");
return FALSE; return FALSE;
} }
DBG("Focuser: %s", focname); DBG("cc_Focuser: %s", focname);
#ifdef EBUG #ifdef EBUG
TRYFUNC(FLIGetHWRevision, focdev, &tmpl); TRYFUNC(FLIGetHWRevision, focdev, &tmpl);
if(!fli_err) DBG("HW revision: %ld", tmpl); if(!fli_err) DBG("HW revision: %ld", tmpl);
@ -315,7 +315,7 @@ static int fli_findWheel(){
return FALSE; return FALSE;
} }
for(int i = 0; i < wheel.Ndevices; i++){ for(int i = 0; i < wheel.Ndevices; i++){
DBG("Wheel '%s', domain %s", whlz[i].name, whlz[i].dname); DBG("cc_Wheel '%s', domain %s", whlz[i].name, whlz[i].dname);
} }
return TRUE; return TRUE;
} }
@ -350,7 +350,7 @@ static int fli_setActiceWheel(int n){
return FALSE; return FALSE;
} }
TRYFUNC(FLIGetModel, whldev, whlname, BUFSIZ); TRYFUNC(FLIGetModel, whldev, whlname, BUFSIZ);
DBG("Wheel: %s", whlname); DBG("cc_Wheel: %s", whlname);
#ifdef EBUG #ifdef EBUG
TRYFUNC(FLIGetHWRevision, whldev, &tmpl); TRYFUNC(FLIGetHWRevision, whldev, &tmpl);
if(!fli_err) DBG("HW revision: %ld", tmpl); if(!fli_err) DBG("HW revision: %ld", tmpl);
@ -422,7 +422,7 @@ static int fli_startexp(){
return TRUE; return TRUE;
} }
static int fli_pollcapt(capture_status *st, float *remain){ static int fli_pollcapt(cc_capture_status *st, float *remain){
static int errctr = 0; static int errctr = 0;
if(capStatus == CAPTURE_READY){ if(capStatus == CAPTURE_READY){
DBG("Capture ends"); DBG("Capture ends");
@ -460,7 +460,7 @@ retn:
return TRUE; return TRUE;
} }
static int fli_capt(IMG *ima){ static int fli_capt(cc_IMG *ima){
if(!ima || !ima->data) return FALSE; if(!ima || !ima->data) return FALSE;
for(int row = 0; row < ima->h; row++){ for(int row = 0; row < ima->h; row++){
void *ptr = (void*)((is16bit) ? ((uint16_t*)ima->data) + row * ima->w : ((uint8_t*)ima->data) + row * ima->w); void *ptr = (void*)((is16bit) ? ((uint16_t*)ima->data) + row * ima->w : ((uint8_t*)ima->data) + row * ima->w);
@ -492,7 +492,7 @@ static int fli_getbin(int *h, int *v){
return TRUE; return TRUE;
} }
static int fli_setgeometry(frameformat *f){ static int fli_setgeometry(cc_frameformat *f){
if(!f) return FALSE; if(!f) return FALSE;
TRYFUNC(FLISetImageArea, camdev, f->xoff, f->yoff, TRYFUNC(FLISetImageArea, camdev, f->xoff, f->yoff,
f->xoff + f->w/curhbin, f->yoff + f->h/curvbin); f->xoff + f->w/curhbin, f->yoff + f->h/curvbin);
@ -560,7 +560,7 @@ static void fli_cancel(){
TRYFUNC(FLIEndExposure, camdev); TRYFUNC(FLIEndExposure, camdev);
} }
static int fli_shutter(shutter_op cmd){ static int fli_shutter(cc_shutter_op cmd){
flishutter_t shtr = FLI_SHUTTER_CLOSE; flishutter_t shtr = FLI_SHUTTER_CLOSE;
switch(cmd){ switch(cmd){
case SHUTTER_OPEN: case SHUTTER_OPEN:
@ -633,7 +633,7 @@ static int fli_setfastspeed(int fast){
return TRUE; return TRUE;
} }
static int fli_setfanspd(fan_speed s){ static int fli_setfanspd(cc_fan_speed s){
long sp = (s == FAN_OFF) ? FLI_FAN_SPEED_OFF : FLI_FAN_SPEED_ON; long sp = (s == FAN_OFF) ? FLI_FAN_SPEED_OFF : FLI_FAN_SPEED_ON;
TRYFUNC(FLISetFanSpeed, camdev, sp); TRYFUNC(FLISetFanSpeed, camdev, sp);
if(fli_err) return FALSE; if(fli_err) return FALSE;
@ -667,7 +667,7 @@ static int fli_fpfalse(_U_ float *f){ return FALSE; }
/* /*
* Global objects: camera, focuser and wheel * Global objects: camera, focuser and wheel
*/ */
__attribute__ ((visibility("default"))) Camera camera = { __attribute__ ((visibility("default"))) cc_Camera camera = {
.check = fli_findCCD, .check = fli_findCCD,
.close = fli_closecam, .close = fli_closecam,
.pollcapture = fli_pollcapt, .pollcapture = fli_pollcapt,
@ -703,7 +703,7 @@ __attribute__ ((visibility("default"))) Camera camera = {
.getio = fli_getio, .getio = fli_getio,
}; };
__attribute__ ((visibility("default"))) Focuser focuser = { __attribute__ ((visibility("default"))) cc_Focuser focuser = {
.check = fli_findFocuser, .check = fli_findFocuser,
.setDevNo = fli_setActiceFocuser, .setDevNo = fli_setActiceFocuser,
.close = fli_closefocuser, .close = fli_closefocuser,
@ -716,7 +716,7 @@ __attribute__ ((visibility("default"))) Focuser focuser = {
.setAbsPos = fli_fgoto, .setAbsPos = fli_fgoto,
}; };
__attribute__ ((visibility("default"))) Wheel wheel = { __attribute__ ((visibility("default"))) cc_Wheel wheel = {
.check = fli_findWheel, .check = fli_findWheel,
.setDevNo = fli_setActiceWheel, .setDevNo = fli_setActiceWheel,
.close = fli_closewheel, .close = fli_closewheel,

View File

@ -24,10 +24,10 @@
#include <string.h> #include <string.h>
#include <usefull_macros.h> #include <usefull_macros.h>
#include "basestructs.h" #include "ccdcapture.h"
#include "omp.h" #include "omp.h"
extern Camera camera; extern cc_Camera camera;
static fc2Context context; static fc2Context context;
static fc2PGRGuid guid; static fc2PGRGuid guid;
@ -176,7 +176,7 @@ static int getbin(int *binh, int *binv){
return TRUE; return TRUE;
} }
static int getformat(frameformat *fmt){ static int getformat(cc_frameformat *fmt){
if(!fmt) return FALSE; if(!fmt) return FALSE;
unsigned int packsz; float pc; unsigned int packsz; float pc;
fc2Format7ImageSettings f7; fc2Format7ImageSettings f7;
@ -209,7 +209,7 @@ static int getgeom(){
return TRUE; return TRUE;
} }
static int geometrylimits(frameformat *max, frameformat *step){ static int geometrylimits(cc_frameformat *max, cc_frameformat *step){
FNAME(); FNAME();
if(!isopened || !max || !step) return FALSE; if(!isopened || !max || !step) return FALSE;
fc2Format7Info f = {.mode = FC2_MODE_0}; fc2Format7Info f = {.mode = FC2_MODE_0};
@ -247,7 +247,7 @@ static int setdevno(int N){
} }
// stub function: the capture process is blocking // stub function: the capture process is blocking
static int pollcapt(capture_status *st, float *remain){ static int pollcapt(cc_capture_status *st, float *remain){
if(st) *st = CAPTURE_READY; if(st) *st = CAPTURE_READY;
if(remain) *remain = 0.f; if(remain) *remain = 0.f;
return TRUE; return TRUE;
@ -287,7 +287,7 @@ rtn:
return ret; return ret;
} }
static int capture(IMG *ima){ static int capture(cc_IMG *ima){
FNAME(); FNAME();
if(canceled) return FALSE; if(canceled) return FALSE;
if(!ima || !ima->data || !isopened) return FALSE; if(!ima || !ima->data || !isopened) return FALSE;
@ -368,7 +368,7 @@ static int setgain(float e){
return TRUE; return TRUE;
} }
static int changeformat(frameformat *fmt){ static int changeformat(cc_frameformat *fmt){
FNAME(); FNAME();
if(!isopened) return FALSE; if(!isopened) return FALSE;
DBG("set geom %dx%d (off: %dx%d)", fmt->w, fmt->h, fmt->xoff, fmt->yoff); DBG("set geom %dx%d (off: %dx%d)", fmt->w, fmt->h, fmt->xoff, fmt->yoff);
@ -390,7 +390,7 @@ static int changeformat(frameformat *fmt){
} }
static int setbitdepth(int i){ static int setbitdepth(int i){
frameformat fmt; cc_frameformat fmt;
if(!getformat(&fmt)) return FALSE; if(!getformat(&fmt)) return FALSE;
int o16bit = is16bit; int o16bit = is16bit;
if(i == 0) is16bit = FALSE; // 8 bit if(i == 0) is16bit = FALSE; // 8 bit
@ -428,10 +428,10 @@ static int gett(float *t){
return getfloat(FC2_TEMPERATURE, t); return getfloat(FC2_TEMPERATURE, t);
} }
static int setfanspd(_U_ fan_speed s){ static int setfanspd(_U_ cc_fan_speed s){
return FALSE; return FALSE;
} }
static int shutter(_U_ shutter_op cmd){ static int shutter(_U_ cc_shutter_op cmd){
return FALSE; return FALSE;
} }
@ -450,7 +450,7 @@ static int ipfalse(_U_ int *i){ return FALSE; }
/* /*
* Global objects: camera, focuser and wheel * Global objects: camera, focuser and wheel
*/ */
Camera camera = { cc_Camera camera = {
.check = connect, .check = connect,
.close = disconnect, .close = disconnect,
.pollcapture = pollcapt, .pollcapture = pollcapt,

View File

@ -22,20 +22,20 @@
#include <string.h> #include <string.h>
#include <usefull_macros.h> #include <usefull_macros.h>
#include "basestructs.h" #include "ccdcapture.h"
#include "omp.h" #include "omp.h"
#ifndef FLT_EPSILON #ifndef FLT_EPSILON
#define FLT_EPSILON 1.19209290E-07F #define FLT_EPSILON 1.19209290E-07F
#endif #endif
extern Camera camera; extern cc_Camera camera;
static MV_CC_DEVICE_INFO_LIST stDeviceList; static MV_CC_DEVICE_INFO_LIST stDeviceList;
static void *handle = NULL; static void *handle = NULL;
static char camname[BUFSIZ] = {0}; static char camname[BUFSIZ] = {0};
//static long cam_err, tmpl; //static long cam_err, tmpl;
static capture_status capStatus = CAPTURE_NO; static cc_capture_status capStatus = CAPTURE_NO;
static int curhbin = 1, curvbin = 1; static int curhbin = 1, curvbin = 1;
static double starttime = 0.; // time when exposure started static double starttime = 0.; // time when exposure started
static float exptime = 0.; // exposition time (in seconds) static float exptime = 0.; // exposition time (in seconds)
@ -383,9 +383,9 @@ static int cam_setActiceCam(int n){
return TRUE; return TRUE;
} }
static int cam_geomlimits(frameformat *l, frameformat *s){ static int cam_geomlimits(cc_frameformat *l, cc_frameformat *s){
if(l) *l = camera.array; if(l) *l = camera.array;
if(s) *s = (frameformat){.w = 1, .h = 1, .xoff = 1, .yoff = 1}; if(s) *s = (cc_frameformat){.w = 1, .h = 1, .xoff = 1, .yoff = 1};
return TRUE; return TRUE;
} }
@ -400,7 +400,7 @@ static int cam_startexp(){
return TRUE; return TRUE;
} }
static int cam_pollcapt(capture_status *st, float *remain){ static int cam_pollcapt(cc_capture_status *st, float *remain){
if(!handle || !pdata) return FALSE; if(!handle || !pdata) return FALSE;
DBG("capStatus = %d", capStatus); DBG("capStatus = %d", capStatus);
if(capStatus == CAPTURE_READY){ if(capStatus == CAPTURE_READY){
@ -442,7 +442,7 @@ retn:
return TRUE; return TRUE;
} }
static int cam_capt(IMG *ima){ static int cam_capt(cc_IMG *ima){
if(!handle || !pdata) return FALSE; if(!handle || !pdata) return FALSE;
if(!ima || !ima->data) return FALSE; if(!ima || !ima->data) return FALSE;
MVCC_ENUMVALUE EnumValue; MVCC_ENUMVALUE EnumValue;
@ -473,7 +473,7 @@ static int cam_modelname(char *buf, int bufsz){
return TRUE; return TRUE;
} }
static int cam_setgeometry(frameformat *f){ static int cam_setgeometry(cc_frameformat *f){
FNAME(); FNAME();
if(!f || !handle) return FALSE; if(!f || !handle) return FALSE;
DBG("getbin"); DBG("getbin");
@ -519,7 +519,7 @@ static void cam_cancel(){
TRY(StopGrabbing); TRY(StopGrabbing);
} }
static int cam_shutter(_U_ shutter_op cmd){ static int cam_shutter(_U_ cc_shutter_op cmd){
return FALSE; return FALSE;
} }
@ -560,7 +560,7 @@ static int cam_setbitdepth(int i){
return TRUE; return TRUE;
} }
static int cam_setfanspd(_U_ fan_speed s){ static int cam_setfanspd(_U_ cc_fan_speed s){
return FALSE; return FALSE;
} }
@ -572,7 +572,7 @@ static int cam_ipfalse(_U_ int *i){ return FALSE; }
/* /*
* Global objects: camera, focuser and wheel * Global objects: camera, focuser and wheel
*/ */
Camera camera = { cc_Camera camera = {
.check = cam_findCCD, .check = cam_findCCD,
.close = cam_closecam, .close = cam_closecam,
.pollcapture = cam_pollcapt, .pollcapture = cam_pollcapt,

View File

@ -26,11 +26,11 @@
#include <usefull_macros.h> #include <usefull_macros.h>
#include <ASICamera2.h> #include <ASICamera2.h>
#include "basestructs.h" #include "ccdcapture.h"
extern Camera camera; extern cc_Camera camera;
extern Focuser focuser; extern cc_Focuser focuser;
extern Wheel wheel; extern cc_Wheel wheel;
// remove all these after removing stubs! // remove all these after removing stubs!
// VVV // VVV
@ -82,7 +82,7 @@ static int asi_checkcam(){
return FALSE; return FALSE;
} }
static int campoll(capture_status *st, float *remain){ static int campoll(cc_capture_status *st, float *remain){
if(!st) return FALSE; if(!st) return FALSE;
ASI_EXPOSURE_STATUS s; ASI_EXPOSURE_STATUS s;
if(ASI_SUCCESS != ASIGetExpStatus(caminfo.CameraID, &s)){ if(ASI_SUCCESS != ASIGetExpStatus(caminfo.CameraID, &s)){
@ -112,7 +112,7 @@ static int campoll(capture_status *st, float *remain){
return TRUE; return TRUE;
} }
static int camcapt(IMG *ima){ static int camcapt(cc_IMG *ima){
if(!ima || !ima->data) return FALSE; if(!ima || !ima->data) return FALSE;
unsigned char *d = (unsigned char *)ima->data; unsigned char *d = (unsigned char *)ima->data;
long image_size = ima->h * ima->w * 2; long image_size = ima->h * ima->w * 2;
@ -160,7 +160,7 @@ static int setdevno(int n){
if(n > camera.Ndevices - 1 || n < 0) return FALSE; if(n > camera.Ndevices - 1 || n < 0) return FALSE;
asi_closecam(); asi_closecam();
if(ASI_SUCCESS != ASIGetCameraProperty(&caminfo, n)) return FALSE; if(ASI_SUCCESS != ASIGetCameraProperty(&caminfo, n)) return FALSE;
DBG("Camera #%d, name: %s, ID: %d", n, caminfo.Name, caminfo.CameraID); DBG("cc_Camera #%d, name: %s, ID: %d", n, caminfo.Name, caminfo.CameraID);
DBG("WxH: %ldx%ld, %s", caminfo.MaxWidth, caminfo.MaxHeight, caminfo.IsColorCam == ASI_TRUE ? "color" : "monochrome"); DBG("WxH: %ldx%ld, %s", caminfo.MaxWidth, caminfo.MaxHeight, caminfo.IsColorCam == ASI_TRUE ? "color" : "monochrome");
DBG("Pixel size: %1.1f mkm; gain: %1.2f e/ADU", caminfo.PixelSize, caminfo.ElecPerADU); DBG("Pixel size: %1.1f mkm; gain: %1.2f e/ADU", caminfo.PixelSize, caminfo.ElecPerADU);
int *sup = caminfo.SupportedBins; int *sup = caminfo.SupportedBins;
@ -168,7 +168,7 @@ static int setdevno(int n){
extrvalues.maxbin = *sup++; extrvalues.maxbin = *sup++;
} }
camera.pixX = camera.pixY = (float)caminfo.PixelSize / 1e6; // um -> m camera.pixX = camera.pixY = (float)caminfo.PixelSize / 1e6; // um -> m
camera.array = (frameformat){.w = caminfo.MaxWidth, .h = caminfo.MaxHeight, .xoff = 0, .yoff = 0}; camera.array = (cc_frameformat){.w = caminfo.MaxWidth, .h = caminfo.MaxHeight, .xoff = 0, .yoff = 0};
camera.field = camera.array; // initial setup (will update later) camera.field = camera.array; // initial setup (will update later)
if(ASI_SUCCESS != ASIOpenCamera(caminfo.CameraID)){ if(ASI_SUCCESS != ASIOpenCamera(caminfo.CameraID)){
WARNX("Can't open device for camera %s", caminfo.Name); WARNX("Can't open device for camera %s", caminfo.Name);
@ -332,13 +332,13 @@ static int camsetbin(int h, int v){
} }
// unsupported, but return TRUE if have mechanical shutter // unsupported, but return TRUE if have mechanical shutter
static int camshutter(_U_ shutter_op s){ static int camshutter(_U_ cc_shutter_op s){
if(!caminfo.MechanicalShutter) return FALSE; if(!caminfo.MechanicalShutter) return FALSE;
return TRUE; return TRUE;
} }
// set ROI // set ROI
static int camsetgeom(frameformat *f){ // w,h, xoff, yoff static int camsetgeom(cc_frameformat *f){ // w,h, xoff, yoff
if(!f) return FALSE; if(!f) return FALSE;
int imtype; int imtype;
DBG("w: %g, h: %g, bin: %d", (double)f->w / curbin, (double)f->h / curbin, curbin); DBG("w: %g, h: %g, bin: %d", (double)f->w / curbin, (double)f->h / curbin, curbin);
@ -375,10 +375,10 @@ static int camgmg(float *mg){ // get max gain
return TRUE; return TRUE;
} }
static int camggl(frameformat *max, frameformat *step){ // get geometry limits static int camggl(cc_frameformat *max, cc_frameformat *step){ // get geometry limits
DBG("array: %dx%d, off: %dx%d", camera.array.w, camera.array.h, camera.array.xoff, camera.array.yoff); DBG("array: %dx%d, off: %dx%d", camera.array.w, camera.array.h, camera.array.xoff, camera.array.yoff);
if(max) *max = camera.array; if(max) *max = camera.array;
if(step) *step = (frameformat){1,1,1,1}; if(step) *step = (cc_frameformat){1,1,1,1};
return TRUE; return TRUE;
} }
@ -405,7 +405,7 @@ static int camgetio(_U_ int *io){ // not supported
return FALSE; return FALSE;
} }
static int camfan(_U_ fan_speed spd){ // not supported, just turn it on/off static int camfan(_U_ cc_fan_speed spd){ // not supported, just turn it on/off
switch(spd){ switch(spd){
case FAN_OFF: case FAN_OFF:
if(!zwo_setfloat(0., ASI_FAN_ON)){ if(!zwo_setfloat(0., ASI_FAN_ON)){
@ -490,7 +490,7 @@ static int istub(_U_ int N){
/* /*
* Global objects: camera, focuser and wheel * Global objects: camera, focuser and wheel
*/ */
__attribute__ ((visibility("default"))) Camera camera = { __attribute__ ((visibility("default"))) cc_Camera camera = {
.check = asi_checkcam, .check = asi_checkcam,
.close = asi_closecam, .close = asi_closecam,
.pollcapture = campoll, .pollcapture = campoll,
@ -526,7 +526,7 @@ __attribute__ ((visibility("default"))) Camera camera = {
.getio = camgetio, .getio = camgetio,
}; };
__attribute__ ((visibility("default"))) Focuser focuser = { __attribute__ ((visibility("default"))) cc_Focuser focuser = {
.check = stub, .check = stub,
.close = vstub, .close = vstub,
// setters: // setters:
@ -541,7 +541,7 @@ __attribute__ ((visibility("default"))) Focuser focuser = {
.getMinPos = focmp, .getMinPos = focmp,
}; };
__attribute__ ((visibility("default"))) Wheel wheel = { __attribute__ ((visibility("default"))) cc_Wheel wheel = {
.check = stub, .check = stub,
.close = vstub, .close = vstub,
// setters // setters

View File

@ -1,146 +0,0 @@
/*
* This file is part of the CCD_Capture project.
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdint.h>
#include <stdlib.h> // for size_t
// magic to mark our SHM
#define SHM_MAGIC (0xdeadbeef)
// base image parameters - sent by socket and stored in shared memory
typedef struct __attribute__((packed, aligned(4))){
uint32_t MAGICK; // magick (DEADBEEF) - to mark our shm
double timestamp; // timestamp of image taken
uint8_t bitpix; // bits per pixel (8 or 16)
int w, h; // image size
uint16_t max, min; // min/max values
float avr, std; // statistics
size_t bytelen; // size of image in bytes
size_t imnumber; // counter of images captured from server's start
void *data; // pointer to data (next byte after this struct) - only for server
/* `data` is uint8_t or uint16_t depending on `bitpix` */
} IMG;
// format of single frame
typedef struct{
int w; int h; // width & height
int xoff; int yoff; // X and Y offset
} frameformat;
typedef enum{
SHUTTER_OPEN, // open shutter now
SHUTTER_CLOSE, // close shutter now
SHUTTER_OPENATLOW, // ext. expose control @low
SHUTTER_OPENATHIGH, // -//- @high
SHUTTER_AMOUNT, // amount of entries
} shutter_op;
typedef enum{
CAPTURE_NO, // no capture initiated
CAPTURE_PROCESS, // in progress
CAPTURE_CANTSTART, // can't start
CAPTURE_ABORTED, // some error - aborted
CAPTURE_READY, // ready - user can read image
} capture_status;
typedef enum{
FAN_OFF,
FAN_LOW,
FAN_MID,
FAN_HIGH,
} fan_speed;
// all setters and getters of Camera, Focuser and Wheel should return TRUE if success or FALSE if failed or unsupported
// camera
typedef struct{
int (*check)(); // check if the device is available, connect and init
int Ndevices; // amount of devices found
void (*close)(); // disconnect & close device
int (*startexposition)(); // start exposition
int (*pollcapture)(capture_status *st, float *remain);// get `st` - status of capture process, `remain` - time remain (s); @return FALSE if error (exp aborted), TRUE while no errors
int (*capture)(IMG *ima); // capture an image, struct `ima` should be prepared before
void (*cancel)(); // cancel exposition
// setters:
int (*setDevNo)(int n); // set active device number
int (*setbrightness)(float b);
int (*setexp)(float e);
int (*setgain)(float g);
int (*setT)(float t);
int (*setbin)(int binh, int binv); // binning
int (*setnflushes)(int N); // flushes amount
int (*shuttercmd)(shutter_op s); // work with shutter
int (*confio)(int s); // configure IO-port
int (*setio)(int s); // set IO-port to given state
int (*setframetype)(int l); // set frametype: 1 - light, 0 - dark
int (*setbitdepth)(int h); // set bit depth : 1 - high (16 bit), 0 - low (8 bit)
int (*setfastspeed)(int s); // set readout speed: 1 - fast, 0 - low
// geometry (if TRUE, all args are changed to suitable values)
int (*setgeometry)(frameformat *fmt); // set geometry in UNBINNED coordinates
int (*setfanspeed)(fan_speed spd); // set fan speed
// getters:
int (*getbitpix)(uint8_t *bp); // get bit depth in bits per pixel (8, 12, 16 etc)
int (*getbrightness)(float *b);// get brightnes level
int (*getModelName)(char *n, int l);// string with model name (l - length of n in bytes)
int (*getgain)(float *g); // get gain value
int (*getmaxgain)(float *g);// get max available gain value
// get limits of geometry: maximal values and steps
int (*getgeomlimits)(frameformat *max, frameformat *step);
int (*getTcold)(float *t); // cold-side T
int (*getThot)(float *t); // hot-side T
int (*getTbody)(float *t); // body T
int (*getbin)(int *binh, int *binv);
int (*getio)(int *s); // get IO-port state
float pixX, pixY; // pixel size in um
frameformat field; // max field of view
frameformat array; // array format
frameformat geometry; // current geometry settings (as in setgeometry)
} Camera;
// focuser
typedef struct{
int (*check)(); // check if the device is available
int Ndevices;
void (*close)();
// setters:
int (*setDevNo)(int n); // set active device number
int (*setAbsPos)(int async, float n);// set absolute position (in millimeters!!!)
int (*home)(int async); // home device
// getters:
int (*getModelName)(char *n, int l);// string with model name (l - length of n in bytes)
int (*getTbody)(float *t); // body T
int (*getPos)(float *p); // current position number (starting from zero)
int (*getMaxPos)(float *p); // max position
int (*getMinPos)(float *p); // min position
} Focuser;
// wheel
typedef struct{
int (*check)(); // check if the device is available
int Ndevices;
void (*close)();
// setters:
int (*setDevNo)(int n); // set active device number
int (*setPos)(int n); // set absolute position (starting from 0)
// getters:
int (*getModelName)(char *n, int l);// string with model name (l - length of n in bytes)
int (*getTbody)(float *t); // body T
int (*getPos)(int *p); // current position number (starting from zero)
int (*getMaxPos)(int *p); // amount of positions
} Wheel;

View File

@ -17,6 +17,7 @@
*/ */
#include <ctype.h> // isspace #include <ctype.h> // isspace
#include <dlfcn.h> // dlopen/close
#include <fcntl.h> #include <fcntl.h>
#include <netdb.h> #include <netdb.h>
#include <stdio.h> #include <stdio.h>
@ -38,15 +39,17 @@
double __t0 = 0.; double __t0 = 0.;
#endif #endif
static int ntries = 2; // amount of tries to send messages controlling the answer
/** /**
* @brief open_socket - create socket and open it * @brief cc_open_socket - create socket and open it
* @param isserver - TRUE for server, FALSE for client * @param isserver - TRUE for server, FALSE for client
* @param path - UNIX-socket path or local INET socket port * @param path - UNIX-socket path or local INET socket port
* @param isnet - 1/2 for INET socket (1 - localhost, 2 - network), 0 for UNIX * @param isnet - 1/2 for INET socket (1 - localhost, 2 - network), 0 for UNIX
* @return socket FD or -1 if failed * @return socket FD or -1 if failed
*/ */
int open_socket(int isserver, char *path, int isnet){ int cc_open_socket(int isserver, char *path, int isnet){
//DBG("isserver=%d, path=%s, isnet=%d", isserver, path, isnet); DBG("isserver=%d, path=%s, isnet=%d", isserver, path, isnet);
if(!path) return 1; if(!path) return 1;
//DBG("path/port: %s", path); //DBG("path/port: %s", path);
int sock = -1; int sock = -1;
@ -59,10 +62,11 @@ int open_socket(int isserver, char *path, int isnet){
hints.ai_flags = AI_PASSIVE; hints.ai_flags = AI_PASSIVE;
const char *node = (isnet == 2) ? NULL : "127.0.0.1"; const char *node = (isnet == 2) ? NULL : "127.0.0.1";
if(getaddrinfo(node, path, &hints, &res) != 0){ if(getaddrinfo(node, path, &hints, &res) != 0){
ERR("getaddrinfo"); WARN("getaddrinfo");
return -1;
} }
}else{ }else{
//DBG("UNIX socket"); DBG("UNIX socket");
char apath[128]; char apath[128];
if(*path == 0){ if(*path == 0){
DBG("convert name"); DBG("convert name");
@ -73,6 +77,7 @@ int open_socket(int isserver, char *path, int isnet){
apath[0] = 0; apath[0] = 0;
strncpy(apath+1, path+2, 126); strncpy(apath+1, path+2, 126);
}else strcpy(apath, path); }else strcpy(apath, path);
//unlink(apath);
unaddr.sun_family = AF_UNIX; unaddr.sun_family = AF_UNIX;
hints.ai_addr = (struct sockaddr*) &unaddr; hints.ai_addr = (struct sockaddr*) &unaddr;
hints.ai_addrlen = sizeof(unaddr); hints.ai_addrlen = sizeof(unaddr);
@ -122,47 +127,8 @@ int open_socket(int isserver, char *path, int isnet){
return sock; return sock;
} }
/** // send data through the socket
* @brief start_socket - create socket and run client or server int cc_senddata(int fd, void *data, size_t l){
* @param isserver - TRUE for server, FALSE for client
* @return 0 if OK
*/
int start_socket(int isserver){
char *path = NULL;
int isnet = 0;
if(GP->path) path = GP->path;
else if(GP->port){ path = GP->port; isnet = 1; }
else ERRX("Point network port or UNIX-socket path");
int sock = open_socket(isserver, path, isnet), imsock = -1;
if(sock < 0){
LOGERR("Can't open socket");
ERRX("start_socket(): can't open socket");
}
if(isserver){
imsock = open_socket(TRUE, GP->imageport, 2); // image socket should be networked
server(sock, imsock);
}else{
#ifdef IMAGEVIEW
if(GP->showimage){
if(!GP->viewer && GP->exptime < 0.00001) ERRX("Need exposition time!");
init_grab_sock(sock);
viewer(sockcaptured); // start viewer with socket client parser
DBG("done");
}else
#endif
client(sock);
}
DBG("Close socket");
close(sock);
if(isserver){
close(imsock);
signals(0);
}
return 0;
}
// send image data to client
int senddata(int fd, void *data, size_t l){
DBG("fd=%d, l=%zd", fd, l); DBG("fd=%d, l=%zd", fd, l);
if(fd < 1 || !data || l < 1) return TRUE; // empty message if(fd < 1 || !data || l < 1) return TRUE; // empty message
DBG("send new data (size=%zd) to fd %d", l, fd); DBG("send new data (size=%zd) to fd %d", l, fd);
@ -174,13 +140,16 @@ int senddata(int fd, void *data, size_t l){
return FALSE; return FALSE;
} }
DBG("success"); DBG("success");
if(globlog) LOGDBG("SEND image (size=%d) to fd %d", l, fd); if(globlog) LOGDBG("SEND data (size=%d) to fd %d", l, fd);
return TRUE; return TRUE;
} }
// simple wrapper over write: add missed newline and log data // simple wrapper over write: add missed newline and log data
int sendmessage(int fd, const char *msg, int l){ int cc_sendmessage(int fd, const char *msg, int l){
FNAME();
if(fd < 1 || !msg || l < 1) return TRUE; // empty message if(fd < 1 || !msg || l < 1) return TRUE; // empty message
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; // thread safe
pthread_mutex_lock(&mutex);
static char *tmpbuf = NULL; static char *tmpbuf = NULL;
static int buflen = 0; static int buflen = 0;
if(l + 1 > buflen){ if(l + 1 > buflen){
@ -193,6 +162,7 @@ int sendmessage(int fd, const char *msg, int l){
if(l != send(fd, tmpbuf, l, MSG_NOSIGNAL)){ if(l != send(fd, tmpbuf, l, MSG_NOSIGNAL)){
WARN("write()"); WARN("write()");
LOGWARN("write()"); LOGWARN("write()");
pthread_mutex_unlock(&mutex);
return FALSE; return FALSE;
}else{ }else{
//DBG("success"); //DBG("success");
@ -201,35 +171,51 @@ int sendmessage(int fd, const char *msg, int l){
LOGDBG("SEND '%s'", tmpbuf); LOGDBG("SEND '%s'", tmpbuf);
} }
} }
pthread_mutex_unlock(&mutex);
return TRUE; return TRUE;
} }
int sendstrmessage(int fd, const char *msg){ int cc_sendstrmessage(int fd, const char *msg){
if(fd < 1 || !msg) return FALSE; FNAME();
if(fd < 1 || !msg) return TRUE; // empty message
int l = strlen(msg); int l = strlen(msg);
return sendmessage(fd, msg, l); return cc_sendmessage(fd, msg, l);
} }
// text messages for `hresult` // text messages for `cc_hresult`
static const char *resmessages[] = { // WARNING! You should initialize ABSOLUTELY ALL members of `cc_hresult` or some pointers would give segfault
static const char *resmessages[RESULT_NUM] = {
[RESULT_OK] = "OK", [RESULT_OK] = "OK",
[RESULT_BUSY] = "BUSY", [RESULT_BUSY] = "BUSY",
[RESULT_FAIL] = "FAIL", [RESULT_FAIL] = "FAIL",
[RESULT_BADKEY] = "BADKEY",
[RESULT_BADVAL] = "BADVAL", [RESULT_BADVAL] = "BADVAL",
[RESULT_SILENCE] = "", [RESULT_BADKEY] = "BADKEY",
// [RESULT_SILENCE] = NULL, // nothing to send
// [RESULT_DISCONNECTED] = NULL, // not to send
}; };
const char *hresult2str(hresult r){ const char *cc_hresult2str(cc_hresult r){
/*red("ALL results:\n");
for(cc_hresult res = 0; res < RESULT_NUM; ++res){
printf("%d: %s\n", res, resmessages[res]);
}*/
if(r < 0 || r >= RESULT_NUM) return "BADRESULT"; if(r < 0 || r >= RESULT_NUM) return "BADRESULT";
return resmessages[r]; return resmessages[r];
} }
cc_hresult cc_str2hresult(const char *str){
for(cc_hresult res = 0; res < RESULT_NUM; ++res){
if(!resmessages[res]) continue;
if(0 == strcmp(resmessages[res], str)) return res;
}
return RESULT_NUM; // didn't find
}
/** /**
* @brief get_keyval - get value of `key = val` * @brief cc_get_keyval - get value of `key = val`
* @param keyval (io) - pair `key = val`, return `key` * @param keyval (io) - pair `key = val`, return `key`
* @return `val` * @return `val`
*/ */
char *get_keyval(char *keyval){ char *cc_get_keyval(char *keyval){
//DBG("Got string %s", keyval); //DBG("Got string %s", keyval);
// remove starting spaces in key // remove starting spaces in key
while(isspace(*keyval)) ++keyval; while(isspace(*keyval)) ++keyval;
@ -253,7 +239,7 @@ char *get_keyval(char *keyval){
* @param fd - file descriptor * @param fd - file descriptor
* @return 0 in case of timeout, 1 in case of fd have data, -1 if error * @return 0 in case of timeout, 1 in case of fd have data, -1 if error
*/ */
int canberead(int fd){ int cc_canberead(int fd){
fd_set fds; fd_set fds;
struct timeval timeout; struct timeval timeout;
timeout.tv_sec = 0; timeout.tv_sec = 0;
@ -279,19 +265,56 @@ int canberead(int fd){
} }
/** /**
* @brief getshm - get shared memory segment for image * @brief cc_setNtries, cc_getNtries - ntries setter and getter
* @param n - new amount of tries
* @return cc_setNtries returns TRUE if succeed, cc_getNtries returns current ntries value
*/
int cc_setNtries(int n){
if(n > 1000 || n < 1) return FALSE;
ntries = n;
return TRUE;
}
int cc_getNtries(){return ntries;}
static cc_hresult sendstrN(int fd, const char *str){
for(int i = 0; i < ntries; ++i){
if(!cc_sendstrmessage(fd, str)) continue;
double t0 = dtime();
while(dtime() - t0 < CC_ANSWER_TIMEOUT){
// TODO: continue the code
}
}
return FALSE;
}
/**
* @brief cc_sendint - send integer value over socket (make 2 tries)
* @param fd - socket fd
* @param cmd - setter
* @param val - value
* @return answer received
*/
cc_hresult cc_sendint(int fd, const char *cmd, int val){
#define BBUFS (63)
char buf[BBUFS+1];
snprintf(buf, BBUFS, "%s=%d\n", cmd, val);
return sendstrN(fd, buf);
}
/**
* @brief cc_getshm - get shared memory segment for image
* @param imsize - size of image data (in bytes): if !=0 allocate as server, else - as client (readonly) * @param imsize - size of image data (in bytes): if !=0 allocate as server, else - as client (readonly)
* @return pointer to shared memory region or NULL if failed * @return pointer to shared memory region or NULL if failed
*/ */
IMG *getshm(key_t key, size_t imsize){ cc_IMG *cc_getshm(key_t key, size_t imsize){
size_t shmsize = sizeof(IMG) + imsize; size_t shmsize = sizeof(cc_IMG) + imsize;
shmsize = 1024 * (1 + shmsize / 1024); shmsize = 1024 * (1 + shmsize / 1024);
DBG("Allocate %zd bytes in shared memory", shmsize); DBG("Allocate %zd bytes in shared memory", shmsize);
int shmid = -1; int shmid = -1;
int flags = (imsize) ? IPC_CREAT | 0666 : 0; int flags = (imsize) ? IPC_CREAT | 0666 : 0;
shmid = shmget(key, 0, flags); shmid = shmget(key, 0, flags);
if(shmid < 0){ if(shmid < 0 && imsize == 0){ // no SHM segment for client
if(imsize) WARN("Can't get shared memory segment %d", key); // suppress warnings for client WARN("Can't get shared memory segment %d", key);
return NULL; return NULL;
} }
if(imsize){ // check if segment exists and its size equal to needs if(imsize){ // check if segment exists and its size equal to needs
@ -307,21 +330,146 @@ IMG *getshm(key_t key, size_t imsize){
} }
} }
flags = (imsize) ? 0 : SHM_RDONLY; // client opens memory in readonly mode flags = (imsize) ? 0 : SHM_RDONLY; // client opens memory in readonly mode
IMG *ptr = shmat(shmid, NULL, flags); cc_IMG *ptr = shmat(shmid, NULL, flags);
if(ptr == (void*)-1){ if(ptr == (void*)-1){
if(imsize) WARN("Can't attach SHM segment %d", key); if(imsize) WARN("Can't attach SHM segment %d", key);
return NULL; return NULL;
} }
if(!imsize){ if(!imsize){
if(ptr->MAGICK != SHM_MAGIC){ if(ptr->MAGICK != CC_SHM_MAGIC){
WARNX("Shared memory %d isn't belongs to image server", key); WARNX("Shared memory %d isn't belongs to image server", key);
shmdt(ptr); shmdt(ptr);
return NULL; return NULL;
} }
return ptr; return ptr;
} }
bzero(ptr, sizeof(IMG)); bzero(ptr, sizeof(cc_IMG));
ptr->data = (void*)((uint8_t*)ptr + sizeof(IMG)); ptr->data = (void*)((uint8_t*)ptr + sizeof(cc_IMG));
ptr->MAGICK = SHM_MAGIC; ptr->MAGICK = CC_SHM_MAGIC;
return ptr; return ptr;
} }
// find plugin
static void *open_plugin(const char *name){
DBG("try to open lib %s", name);
void* dlh = dlopen(name, RTLD_NOLOAD); // library may be already opened
if(!dlh){
DBG("Not loaded - load");
dlh = dlopen(name, RTLD_NOW);
}
if(!dlh){
WARNX(_("Can't find plugin %s: %s"), name, dlerror());
return NULL;
}
return dlh;
}
cc_Focuser *open_focuser(const char *pluginname){
FNAME();
void* dlh = open_plugin(pluginname);
if(!dlh) return NULL;
cc_Focuser* f = (cc_Focuser*) dlsym(dlh, "focuser");
if(!f){
WARNX(_("Can't find focuser in plugin %s: %s"), pluginname, dlerror());
return NULL;
}
return f;
}
cc_Camera *open_camera(const char *pluginname){
FNAME();
void* dlh = open_plugin(pluginname);
if(!dlh) return NULL;
cc_Camera *c = (cc_Camera*) dlsym(dlh, "camera");
if(!c){
WARNX(_("Can't find camera in plugin %s: %s"), pluginname, dlerror());
return NULL;
}
return c;
}
cc_Wheel *open_wheel(const char *pluginname){
FNAME();
void* dlh = open_plugin(pluginname);
if(!dlh) return NULL;
cc_Wheel *w = (cc_Wheel*) dlsym(dlh, "wheel");
if(!w){
WARNX(_("Can't find wheel in plugin %s: %s"), pluginname, dlerror());
return NULL;
}
return w;
}
/**
* @brief cc_getNbytes - calculate amount of bytes to store bitpix (1/2)
* @param image - image
* @return 1 for bitpix<8 or 2
*/
int cc_getNbytes(cc_IMG *image){
int n = (image->bitpix + 7) / 8;
if(n < 1) n = 1;
if(n > 2) n = 2;
return n;
}
cc_charbuff *cc_bufnew(size_t size){
DBG("Allocate new buffer with size %zd", size);
cc_charbuff *b = MALLOC(cc_charbuff, 1);
b->bufsize = size;
b->buf = MALLOC(char, size);
return b;
}
void cc_bufdel(cc_charbuff **buf){
FREE((*buf)->buf);
FREE(*buf);
}
/**
* @brief cc_read2buf - try to read next data portion from POLLED socket
* @param fd - socket fd to read from
* @param buf - buffer to read
* @return FALSE in case of buffer overflow or client disconnect, TRUE if got 0..n bytes of data
*/
int cc_read2buf(int fd, cc_charbuff *buf){
int ret = FALSE;
if(!buf) return FALSE;
pthread_mutex_lock(&buf->mutex);
if(!buf->buf || buf->buflen >= buf->bufsize) goto ret;
size_t maxlen = buf->bufsize - buf->buflen;
ssize_t rd = read(fd, buf->buf + buf->buflen, maxlen);
if(rd <= 0) goto ret;
DBG("got %zd bytes", rd);
if(rd) buf->buflen += rd;
ret = TRUE;
ret:
pthread_mutex_unlock(&buf->mutex);
return ret;
}
/**
* @brief cc_getline - read '\n'-terminated string from `b` and substitute '\n' by 0
* @param b - input charbuf
* @param str (allocated outside) - string-receiver
* @param len - length of `str` (including terminating zero)
* @return amount of bytes read
*/
size_t cc_getline(cc_charbuff *b, char *str, size_t len){
if(!b) return 0;
size_t idx = 0;
pthread_mutex_lock(&b->mutex);
if(!b->buf) goto ret;
--len; // for terminating zero
char *ptr = b->buf;
for(; idx < b->buflen; ++idx) if(*ptr++ == '\n') break;
if(idx == b->buflen) goto ret;
size_t minlen = (len > idx) ? idx : len; // prevent `str` overflow
memcpy(str, b->buf, minlen);
str[minlen] = 0;
if(++idx < b->buflen){ // move rest of data in buffer to beginning
memmove(b->buf, b->buf+idx, b->buflen-idx);
b->buflen -= idx;
}else b->buflen = 0;
ret:
pthread_mutex_unlock(&b->mutex);
return idx;
}

283
ccdcapture.h Normal file
View File

@ -0,0 +1,283 @@
/*
* This file is part of the CCD_Capture project.
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <pthread.h>
#include <stdint.h>
#include <stdlib.h> // for size_t
// magic to mark our SHM
#define CC_SHM_MAGIC (0xdeadbeef)
// base image parameters - sent by socket and stored in shared memory
typedef struct __attribute__((packed, aligned(4))){
uint32_t MAGICK; // magick (DEADBEEF) - to mark our shm
double timestamp; // timestamp of image taken
uint8_t bitpix; // bits per pixel (8 or 16)
int w, h; // image size
uint16_t max, min; // min/max values
float avr, std; // statistics
size_t bytelen; // size of image in bytes
size_t imnumber; // counter of images captured from server's start
void *data; // pointer to data (next byte after this struct) - only for server
/* `data` is uint8_t or uint16_t depending on `bitpix` */
} cc_IMG;
// format of single frame
typedef struct{
int w; int h; // width & height
int xoff; int yoff; // X and Y offset
} cc_frameformat;
typedef enum{
SHUTTER_OPEN, // open shutter now
SHUTTER_CLOSE, // close shutter now
SHUTTER_OPENATLOW, // ext. expose control @low
SHUTTER_OPENATHIGH, // -//- @high
SHUTTER_AMOUNT, // amount of entries
} cc_shutter_op;
typedef enum{
CAPTURE_NO, // no capture initiated
CAPTURE_PROCESS, // in progress
CAPTURE_CANTSTART, // can't start
CAPTURE_ABORTED, // some error - aborted
CAPTURE_READY, // ready - user can read image
} cc_capture_status;
typedef enum{
FAN_OFF,
FAN_LOW,
FAN_MID,
FAN_HIGH,
} cc_fan_speed;
// all setters and getters of Camera, Focuser and cc_Wheel should return TRUE if success or FALSE if failed or unsupported
// camera
typedef struct{
int (*check)(); // check if the device is available, connect and init
int Ndevices; // amount of devices found
void (*close)(); // disconnect & close device
int (*startexposition)(); // start exposition
int (*pollcapture)(cc_capture_status *st, float *remain);// get `st` - status of capture process, `remain` - time remain (s); @return FALSE if error (exp aborted), TRUE while no errors
int (*capture)(cc_IMG *ima); // capture an image, struct `ima` should be prepared before
void (*cancel)(); // cancel exposition
// setters:
int (*setDevNo)(int n); // set active device number
int (*setbrightness)(float b);
int (*setexp)(float e);
int (*setgain)(float g);
int (*setT)(float t);
int (*setbin)(int binh, int binv); // binning
int (*setnflushes)(int N); // flushes amount
int (*shuttercmd)(cc_shutter_op s); // work with shutter
int (*confio)(int s); // configure IO-port
int (*setio)(int s); // set IO-port to given state
int (*setframetype)(int l); // set frametype: 1 - light, 0 - dark
int (*setbitdepth)(int h); // set bit depth : 1 - high (16 bit), 0 - low (8 bit)
int (*setfastspeed)(int s); // set readout speed: 1 - fast, 0 - low
// geometry (if TRUE, all args are changed to suitable values)
int (*setgeometry)(cc_frameformat *fmt); // set geometry in UNBINNED coordinates
int (*setfanspeed)(cc_fan_speed spd); // set fan speed
// getters:
int (*getbitpix)(uint8_t *bp); // get bit depth in bits per pixel (8, 12, 16 etc)
int (*getbrightness)(float *b);// get brightnes level
int (*getModelName)(char *n, int l);// string with model name (l - length of n in bytes)
int (*getgain)(float *g); // get gain value
int (*getmaxgain)(float *g);// get max available gain value
// get limits of geometry: maximal values and steps
int (*getgeomlimits)(cc_frameformat *max, cc_frameformat *step);
int (*getTcold)(float *t); // cold-side T
int (*getThot)(float *t); // hot-side T
int (*getTbody)(float *t); // body T
int (*getbin)(int *binh, int *binv);
int (*getio)(int *s); // get IO-port state
float pixX, pixY; // pixel size in um
cc_frameformat field; // max field of view
cc_frameformat array; // array format
cc_frameformat geometry; // current geometry settings (as in setgeometry)
} cc_Camera;
// focuser
typedef struct{
int (*check)(); // check if the device is available
int Ndevices;
void (*close)();
// setters:
int (*setDevNo)(int n); // set active device number
int (*setAbsPos)(int async, float n);// set absolute position (in millimeters!!!)
int (*home)(int async); // home device
// getters:
int (*getModelName)(char *n, int l);// string with model name (l - length of n in bytes)
int (*getTbody)(float *t); // body T
int (*getPos)(float *p); // current position number (starting from zero)
int (*getMaxPos)(float *p); // max position
int (*getMinPos)(float *p); // min position
} cc_Focuser;
// wheel
typedef struct{
int (*check)(); // check if the device is available
int Ndevices;
void (*close)();
// setters:
int (*setDevNo)(int n); // set active device number
int (*setPos)(int n); // set absolute position (starting from 0)
// getters:
int (*getModelName)(char *n, int l);// string with model name (l - length of n in bytes)
int (*getTbody)(float *t); // body T
int (*getPos)(int *p); // current position number (starting from zero)
int (*getMaxPos)(int *p); // amount of positions
} cc_Wheel;
cc_Focuser *open_focuser(const char *pluginname);
cc_Camera *open_camera(const char *pluginname);
cc_Wheel *open_wheel(const char *pluginname);
int cc_getNbytes(cc_IMG *image);
/****** Content of old socket.h ******/
// max & min TCP socket port number
#define CC_PORTN_MAX (65535)
#define CC_PORTN_MIN (1024)
// Max amount of connections
#define CC_MAXCLIENTS (30)
// wait for mutex locking
#define CC_BUSY_TIMEOUT (1.0)
// waiting for answer timeout
#define CC_ANSWER_TIMEOUT (0.01)
// wait for exposition ends (between subsequent check calls)
#define CC_WAIT_TIMEOUT (2.0)
// client will disconnect after this time from last server message
#define CC_CLIENT_TIMEOUT (3.0)
typedef enum{
RESULT_OK, // 0: all OK
RESULT_BUSY, // 1: camera busy and no setters can be done
RESULT_FAIL, // 2: failed running command
RESULT_BADVAL, // 3: bad key's value
RESULT_BADKEY, // 4: bad key
RESULT_SILENCE, // 5: send nothing to client
RESULT_DISCONNECTED,// 6: client disconnected
RESULT_NUM
} cc_hresult;
const char *cc_hresult2str(cc_hresult r);
cc_hresult cc_str2hresult(const char *str);
int cc_setNtries(int n);
int cc_getNtries();
// fd - socket fd to send private messages, key, val - key and its value
typedef cc_hresult (*cc_mesghandler)(int fd, const char *key, const char *val);
typedef struct{
cc_hresult (*chkfunction)(char *val); // function to check device is ready
cc_mesghandler handler; // handler function
const char *key; // keyword
} cc_handleritem;
int cc_open_socket(int isserver, char *path, int isnet);
int cc_senddata(int fd, void *data, size_t l);
int cc_sendmessage(int fd, const char *msg, int l);
int cc_sendstrmessage(int fd, const char *msg);
char *cc_get_keyval(char *keyval);
cc_IMG *cc_getshm(key_t key, size_t imsize);
int cc_canberead(int fd);
cc_hresult cc_sendint(int fd, const char *cmd, int val);
/****** Content of old server.h ******/
typedef enum{
CAMERA_IDLE, // idle state, client send this to cancel capture
CAMERA_CAPTURE, // capturing frame, client send this to start capture
CAMERA_FRAMERDY, // frame ready to be saved
CAMERA_ERROR // can't do exposition
} cc_camera_state;
// common information about everything
#define CC_CMD_INFO "info"
#define CC_CMD_HELP "help"
// restart server
#define CC_CMD_RESTART "restartTheServer"
// get image size in pixels
#define CC_CMD_IMWIDTH "imwidth"
#define CC_CMD_IMHEIGHT "imheight"
// get shared memory key
#define CC_CMD_SHMEMKEY "shmemkey"
// CCD/CMOS
#define CC_CMD_CAMLIST "camlist"
#define CC_CMD_CAMDEVNO "camdevno"
#define CC_CMD_EXPOSITION "exptime"
#define CC_CMD_LASTFNAME "lastfilename"
#define CC_CMD_FILENAME "filename"
#define CC_CMD_FILENAMEPREFIX "filenameprefix"
// rewrite=1 will rewrite files, =0 - not (only for `filename`)
#define CC_CMD_REWRITE "rewrite"
#define CC_CMD_HBIN "hbin"
#define CC_CMD_VBIN "vbin"
#define CC_CMD_CAMTEMPER "tcold"
#define CC_CMD_CAMFANSPD "ccdfanspeed"
#define CC_CMD_SHUTTER "shutter"
#define CC_CMD_CONFIO "confio"
#define CC_CMD_IO "io"
#define CC_CMD_GAIN "gain"
#define CC_CMD_BRIGHTNESS "brightness"
#define CC_CMD_FRAMEFORMAT "format"
#define CC_CMD_FRAMEMAX "maxformat"
#define CC_CMD_NFLUSHES "nflushes"
// expstate=CAMERA_CAPTURE will start exposition, CAMERA_IDLE - cancel
#define CC_CMD_EXPSTATE "expstate"
#define CC_CMD_TREMAIN "tremain"
#define CC_CMD_8BIT "8bit"
#define CC_CMD_FASTSPD "fastspeed"
#define CC_CMD_DARK "dark"
#define CC_CMD_INFTY "infty"
// FITS file keywords
#define CC_CMD_AUTHOR "author"
#define CC_CMD_INSTRUMENT "instrument"
#define CC_CMD_OBSERVER "observer"
#define CC_CMD_OBJECT "object"
#define CC_CMD_PROGRAM "program"
#define CC_CMD_OBJTYPE "objtype"
#define CC_CMD_HEADERFILES "headerfiles"
// focuser
#define CC_CMD_FOCLIST "foclist"
#define CC_CMD_FDEVNO "focdevno"
#define CC_CMD_FGOTO "focpos"
// wheel
#define CC_CMD_WLIST "wlist"
#define CC_CMD_WDEVNO "wdevno"
#define CC_CMD_WPOS "wpos"
typedef struct{
char* buf; // databuffer
size_t bufsize; // size of `buf`
size_t buflen; // current buffer length
pthread_mutex_t mutex; // mutex for atomic data access
} cc_charbuff;
cc_charbuff *cc_bufnew(size_t size);
void cc_bufdel(cc_charbuff **buf);
int cc_read2buf(int fd, cc_charbuff *buf);
size_t cc_getline(cc_charbuff *b, char *str, size_t len);

10
ccdcapture.pc.in Normal file
View File

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: @PROJLIB@
Description: ccd_capture client library
Version: @VERSION@
Libs: -L${libdir} -l@PROJLIB@
Cflags: -I${includedir}

181
ccdfunc.c
View File

@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <dlfcn.h> // dlopen/close
#include <fitsio.h> #include <fitsio.h>
#include <math.h> #include <math.h>
#include <signal.h> // pthread_kill #include <signal.h> // pthread_kill
@ -34,9 +33,9 @@
#endif #endif
#include "omp.h" #include "omp.h"
Camera *camera = NULL; cc_Camera *camera = NULL;
Focuser *focuser = NULL; cc_Focuser *focuser = NULL;
Wheel *wheel = NULL; cc_Wheel *wheel = NULL;
static int fitserror = 0; static int fitserror = 0;
@ -56,52 +55,6 @@ do{ int status = 0; \
#define TMBUFSIZ 40 #define TMBUFSIZ 40
// find plugin
static void *open_plugin(const char *name){
DBG("try to open lib %s", name);
void* dlh = dlopen(name, RTLD_NOLOAD); // library may be already opened
if(!dlh) dlh = dlopen(name, RTLD_NOW);
if(!dlh){
WARNX(_("Can't find plugin %s: %s"), name, dlerror());
return NULL;
}
return dlh;
}
static void *init_focuser(const char *pluginname){
FNAME();
void* dlh = open_plugin(pluginname);
if(!dlh) return NULL;
focuser = (Focuser*) dlsym(dlh, "focuser");
if(!focuser){
WARNX(_("Can't find focuser in plugin %s: %s"), pluginname, dlerror());
return NULL;
}
return dlh;
}
static void *init_camera(const char *pluginname){
FNAME();
void* dlh = open_plugin(pluginname);
if(!dlh) return NULL;
camera = (Camera*) dlsym(dlh, "camera");
if(!camera){
WARNX(_("Can't find camera in plugin %s: %s"), pluginname, dlerror());
return NULL;
}
return dlh;
}
static void *init_wheel(const char *pluginname){
FNAME();
void* dlh = open_plugin(pluginname);
if(!dlh) return NULL;
wheel = (Wheel*) dlsym(dlh, "wheel");
if(!wheel){
WARNX(_("Can't find wheel in plugin %s: %s"), pluginname, dlerror());
return NULL;
}
return dlh;
}
/* /*
static size_t curtime(char *s_time){ // current date/time static size_t curtime(char *s_time){ // current date/time
time_t tm = time(NULL); time_t tm = time(NULL);
@ -178,7 +131,7 @@ static void addrec(fitsfile *f, char *filename){
// save FITS file `img` into GP->outfile or GP->outfileprefix_XXXX.fits // save FITS file `img` into GP->outfile or GP->outfileprefix_XXXX.fits
// if outp != NULL, put into it strdup() of last file name // if outp != NULL, put into it strdup() of last file name
// return FALSE if failed // return FALSE if failed
int saveFITS(IMG *img, char **outp){ int saveFITS(cc_IMG *img, char **outp){
int ret = FALSE; int ret = FALSE;
if(!camera){ if(!camera){
LOGERR("Can't save image: no camera device"); LOGERR("Can't save image: no camera device");
@ -225,7 +178,7 @@ int saveFITS(IMG *img, char **outp){
fitserror = 0; fitserror = 0;
TRYFITS(fits_create_file, &fp, fnam); TRYFITS(fits_create_file, &fp, fnam);
if(fitserror) goto cloerr; if(fitserror) goto cloerr;
int nbytes = getNbytes(img); int nbytes = cc_getNbytes(img);
if(nbytes == 1) TRYFITS(fits_create_img, fp, BYTE_IMG, 2, naxes); if(nbytes == 1) TRYFITS(fits_create_img, fp, BYTE_IMG, 2, naxes);
else TRYFITS(fits_create_img, fp, USHORT_IMG, 2, naxes); else TRYFITS(fits_create_img, fp, USHORT_IMG, 2, naxes);
if(fitserror) goto cloerr; if(fitserror) goto cloerr;
@ -374,7 +327,7 @@ cloerr:
return ret; return ret;
} }
static void stat8(IMG *image){ static void stat8(cc_IMG *image){
double sum = 0., sum2 = 0.; double sum = 0., sum2 = 0.;
size_t size = image->w * image->h; size_t size = image->w * image->h;
uint8_t max = 0, min = UINT8_MAX; uint8_t max = 0, min = UINT8_MAX;
@ -406,7 +359,7 @@ static void stat8(IMG *image){
image->std = sqrt(fabs(sum2/sz - avr*avr)); image->std = sqrt(fabs(sum2/sz - avr*avr));
image->max = max; image->min = min; image->max = max; image->min = min;
} }
static void stat16(IMG *image){ static void stat16(cc_IMG *image){
double sum = 0., sum2 = 0.; double sum = 0., sum2 = 0.;
size_t size = image->w * image->h; size_t size = image->w * image->h;
uint16_t max = 0, min = UINT16_MAX; uint16_t max = 0, min = UINT16_MAX;
@ -440,7 +393,7 @@ static void stat16(IMG *image){
} }
void calculate_stat(IMG *image){ void calculate_stat(cc_IMG *image){
int nbytes = ((7 + image->bitpix) / 8); int nbytes = ((7 + image->bitpix) / 8);
if(nbytes == 1) stat8(image); if(nbytes == 1) stat8(image);
else stat16(image); else stat16(image);
@ -451,20 +404,20 @@ void calculate_stat(IMG *image){
} }
} }
int startFocuser(void **dlh){ cc_Focuser *startFocuser(){
if(!GP->focuserdev && !GP->commondev){ if(!GP->focuserdev && !GP->commondev){
verbose(3, _("Focuser device not pointed")); verbose(3, _("Focuser device not pointed"));
return FALSE; return NULL;
}else{ }else{
char *plugin = GP->commondev ? GP->commondev : GP->focuserdev; char *plugin = GP->commondev ? GP->commondev : GP->focuserdev;
if(!(*dlh = init_focuser(plugin))) return FALSE; if(!(focuser = open_focuser(plugin))) return NULL;
} }
if(!focuser->check()){ if(!focuser->check()){
verbose(3, _("No focusers found")); verbose(3, _("No focusers found"));
focuser = NULL; focuser = NULL;
return FALSE; return NULL;
} }
return TRUE; return focuser;
} }
void focclose(){ void focclose(){
@ -542,20 +495,20 @@ retn:
focclose(); focclose();
} }
int startWheel(void **dlh){ cc_Wheel *startWheel(){
if(!GP->wheeldev && !GP->commondev){ if(!GP->wheeldev && !GP->commondev){
verbose(3, _("Wheel device not pointed")); verbose(3, _("cc_Wheel device not pointed"));
return FALSE; return NULL;
}else{ }else{
char *plugin = GP->commondev ? GP->commondev : GP->wheeldev; char *plugin = GP->commondev ? GP->commondev : GP->wheeldev;
if(!(*dlh = init_wheel(plugin))) return FALSE; if(!(wheel = open_wheel(plugin))) return NULL;
} }
if(!wheel->check()){ if(!wheel->check()){
verbose(3, _("No wheels found")); verbose(3, _("No wheels found"));
wheel = NULL; wheel = NULL;
return FALSE; return NULL;
} }
return TRUE; return wheel;
} }
void closewheel(){ void closewheel(){
@ -591,7 +544,7 @@ void wheels(){
} }
char buf[BUFSIZ]; char buf[BUFSIZ];
if(wheel->getModelName(buf, BUFSIZ)){ if(wheel->getModelName(buf, BUFSIZ)){
verbose(2, "Wheel model: %s", buf); verbose(2, "cc_Wheel model: %s", buf);
} }
float t; float t;
if(wheel->getTbody(&t)){ if(wheel->getTbody(&t)){
@ -609,7 +562,7 @@ void wheels(){
pos = GP->setwheel; pos = GP->setwheel;
if(pos == -1) goto retn; // no wheel commands if(pos == -1) goto retn; // no wheel commands
if(pos < 0 || pos > maxpos){ if(pos < 0 || pos > maxpos){
WARNX(_("Wheel position should be from 0 to %d"), maxpos); WARNX(_("cc_Wheel position should be from 0 to %d"), maxpos);
goto retn; goto retn;
} }
if(!wheel->setPos(pos)) if(!wheel->setPos(pos))
@ -624,8 +577,8 @@ static void closeall(){
if(wheel){wheel->close(); wheel = NULL;} if(wheel){wheel->close(); wheel = NULL;}
}*/ }*/
static capture_status capt(){ static cc_capture_status capt(){
capture_status cs; cc_capture_status cs;
float tremain, tmpf; float tremain, tmpf;
while(camera->pollcapture(&cs, &tremain)){ while(camera->pollcapture(&cs, &tremain)){
if(cs != CAPTURE_PROCESS) break; if(cs != CAPTURE_PROCESS) break;
@ -643,20 +596,20 @@ static capture_status capt(){
return cs; return cs;
} }
int startCCD(void **dlh){ cc_Camera *startCCD(){
if(!GP->cameradev && !GP->commondev){ if(!GP->cameradev && !GP->commondev){
verbose(3, _("Camera device not pointed")); verbose(3, _("Camera device not pointed"));
return FALSE; return NULL;
}else{ }else{
char *plugin = GP->commondev ? GP->commondev : GP->cameradev; char *plugin = GP->commondev ? GP->commondev : GP->cameradev;
if(!(*dlh = init_camera(plugin))) return FALSE; if(!(camera = open_camera(plugin))) return NULL;
} }
if(!camera->check()){ if(!camera->check()){
verbose(3, _("No cameras found")); verbose(3, _("No cameras found"));
LOGWARN(_("No cameras found")); LOGWARN(_("No cameras found"));
return FALSE; return NULL;
} }
return TRUE; return camera;
} }
void closecam(){ void closecam(){
@ -692,7 +645,7 @@ int prepare_ccds(){
} }
if(GP->fanspeed > -1){ if(GP->fanspeed > -1){
if(GP->fanspeed > FAN_HIGH) GP->fanspeed = FAN_HIGH; if(GP->fanspeed > FAN_HIGH) GP->fanspeed = FAN_HIGH;
if(!camera->setfanspeed((fan_speed)GP->fanspeed)) if(!camera->setfanspeed((cc_fan_speed)GP->fanspeed))
WARNX(_("Can't set fan speed")); WARNX(_("Can't set fan speed"));
else verbose(0, _("Set fan speed to %d"), GP->fanspeed); else verbose(0, _("Set fan speed to %d"), GP->fanspeed);
} }
@ -724,7 +677,7 @@ int prepare_ccds(){
if(GP->shtr_cmd > -1 && GP->shtr_cmd < SHUTTER_AMOUNT){ if(GP->shtr_cmd > -1 && GP->shtr_cmd < SHUTTER_AMOUNT){
const char *str[] = {"open", "close", "expose @high", "expose @low"}; const char *str[] = {"open", "close", "expose @high", "expose @low"};
verbose(1, _("Shutter command: %s\n"), str[GP->shtr_cmd]); verbose(1, _("Shutter command: %s\n"), str[GP->shtr_cmd]);
if(!camera->shuttercmd((shutter_op)GP->shtr_cmd)) if(!camera->shuttercmd((cc_shutter_op)GP->shtr_cmd))
WARNX(_("Can't run shutter command %s (unsupported?)"), str[GP->shtr_cmd]); WARNX(_("Can't run shutter command %s (unsupported?)"), str[GP->shtr_cmd]);
} }
if(GP->confio > -1){ if(GP->confio > -1){
@ -774,7 +727,7 @@ int prepare_ccds(){
if(GP->X1 < GP->X0+1 || GP->X1 > x1) GP->X1 = x1; if(GP->X1 < GP->X0+1 || GP->X1 > x1) GP->X1 = x1;
if(GP->Y1 < GP->Y0+1 || GP->Y1 > y1) GP->Y1 = y1; if(GP->Y1 < GP->Y0+1 || GP->Y1 > y1) GP->Y1 = y1;
DBG("x1/x0: %d/%d", GP->X1, GP->X0); DBG("x1/x0: %d/%d", GP->X1, GP->X0);
frameformat fmt = {.w = GP->X1 - GP->X0, .h = GP->Y1 - GP->Y0, .xoff = GP->X0, .yoff = GP->Y0}; cc_frameformat fmt = {.w = GP->X1 - GP->X0, .h = GP->Y1 - GP->Y0, .xoff = GP->X0, .yoff = GP->Y0};
if(!camera->setgeometry(&fmt)) if(!camera->setgeometry(&fmt))
WARNX(_("Can't set given geometry")); WARNX(_("Can't set given geometry"));
verbose(3, "Geometry: off=%d/%d, wh=%d/%d", fmt.xoff, fmt.yoff, fmt.w, fmt.h); verbose(3, "Geometry: off=%d/%d, wh=%d/%d", fmt.xoff, fmt.yoff, fmt.w, fmt.h);
@ -809,13 +762,13 @@ retn:
*/ */
void ccds(){ void ccds(){
FNAME(); FNAME();
frameformat fmt = camera->geometry; cc_frameformat fmt = camera->geometry;
int raw_width = fmt.w / GP->hbin, raw_height = fmt.h / GP->vbin; int raw_width = fmt.w / GP->hbin, raw_height = fmt.h / GP->vbin;
DBG("w=%d, h=%d", raw_width, raw_height); DBG("w=%d, h=%d", raw_width, raw_height);
// allocate maximum available memory - for 16bit image // allocate maximum available memory - for 16bit image
uint16_t *img = MALLOC(uint16_t, raw_width * raw_height); uint16_t *img = MALLOC(uint16_t, raw_width * raw_height);
DBG("\n\nAllocated image 2x%dx%d=%d", raw_width, raw_height, 2 * raw_width * raw_height); DBG("\n\nAllocated image 2x%dx%d=%d", raw_width, raw_height, 2 * raw_width * raw_height);
IMG ima = {.data = img, .w = raw_width, .h = raw_height}; cc_IMG ima = {.data = img, .w = raw_width, .h = raw_height};
if(GP->nframes < 1) GP->nframes = 1; if(GP->nframes < 1) GP->nframes = 1;
for(int j = 0; j < GP->nframes; ++j){ for(int j = 0; j < GP->nframes; ++j){
TIMESTAMP("Start next cycle"); TIMESTAMP("Start next cycle");
@ -870,18 +823,6 @@ void camstop(){
} }
} }
/**
* @brief getNbytes - calculate amount of bytes to store bitpix (1/2)
* @param image - image
* @return 1 for bitpix<8 or 2
*/
int getNbytes(IMG *image){
int n = (image->bitpix + 7) / 8;
if(n < 1) n = 1;
if(n > 2) n = 2;
return n;
}
#ifdef IMAGEVIEW #ifdef IMAGEVIEW
#define NFRM (10) #define NFRM (10)
void framerate(){ void framerate(){
@ -902,7 +843,7 @@ static volatile int exitgrab = FALSE;
static volatile size_t lastgrabno = 0; static volatile size_t lastgrabno = 0;
static void *grabnext(void *arg){ static void *grabnext(void *arg){
FNAME(); FNAME();
IMG *ima = (IMG*) arg; cc_IMG *ima = (cc_IMG*) arg;
do{ do{
if(exitgrab) return NULL; if(exitgrab) return NULL;
TIMESTAMP("Start next exp"); TIMESTAMP("Start next exp");
@ -913,7 +854,7 @@ static void *grabnext(void *arg){
usleep(10000); usleep(10000);
continue; continue;
} }
capture_status cs = CAPTURE_ABORTED; cc_capture_status cs = CAPTURE_ABORTED;
TIMESTAMP("Poll"); TIMESTAMP("Poll");
while(camera->pollcapture(&cs, NULL)){ while(camera->pollcapture(&cs, NULL)){
if(cs != CAPTURE_PROCESS) break; if(cs != CAPTURE_PROCESS) break;
@ -933,10 +874,10 @@ static void *grabnext(void *arg){
/** /**
* @brief ccdcaptured - get new image data for viewer * @brief ccdcaptured - get new image data for viewer
* @param img - pointer to IMG* (if IMG* is NULL, will be allocated here) * @param img - pointer to cc_IMG* (if cc_IMG* is NULL, will be allocated here)
* @return TRUE if new image available * @return TRUE if new image available
*/ */
int ccdcaptured(IMG **imgptr){ int ccdcaptured(cc_IMG **imgptr){
if(!imgptr) return FALSE; if(!imgptr) return FALSE;
//TIMESTAMP("ccdcaptured() start"); //TIMESTAMP("ccdcaptured() start");
static pthread_t grabthread = 0; static pthread_t grabthread = 0;
@ -952,14 +893,14 @@ int ccdcaptured(IMG **imgptr){
DBG("OK"); DBG("OK");
return FALSE; return FALSE;
} }
frameformat fmt = camera->geometry; cc_frameformat fmt = camera->geometry;
int raw_width = fmt.w / GP->hbin, raw_height = fmt.h / GP->vbin; int raw_width = fmt.w / GP->hbin, raw_height = fmt.h / GP->vbin;
IMG *ima = NULL; cc_IMG *ima = NULL;
if(*imgptr && ((*imgptr)->w != raw_width || (*imgptr)->h != raw_height)) FREE(*imgptr); if(*imgptr && ((*imgptr)->w != raw_width || (*imgptr)->h != raw_height)) FREE(*imgptr);
if(!*imgptr){ if(!*imgptr){
uint16_t *img = MALLOC(uint16_t, raw_width * raw_height); uint16_t *img = MALLOC(uint16_t, raw_width * raw_height);
DBG("\n\nAllocated image 2x%dx%d=%d", raw_width, raw_height, 2 * raw_width * raw_height); DBG("\n\nAllocated image 2x%dx%d=%d", raw_width, raw_height, 2 * raw_width * raw_height);
ima = MALLOC(IMG, 1); ima = MALLOC(cc_IMG, 1);
ima->data = img; ima->data = img;
ima->w = raw_width; ima->w = raw_width;
ima->h = raw_height; ima->h = raw_height;
@ -987,3 +928,45 @@ int ccdcaptured(IMG **imgptr){
return FALSE; return FALSE;
} }
#endif #endif
// common part of client-server
#include "client.h"
#include "server.h"
/**
* @brief start_socket - create socket and run client or server
* @param isserver - TRUE for server, FALSE for client
* @return 0 if OK
*/
int start_socket(int isserver){
char *path = NULL;
int isnet = 0;
if(GP->path) path = GP->path;
else if(GP->port){ path = GP->port; isnet = 1; }
else ERRX("Point network port or UNIX-socket path");
int sock = cc_open_socket(isserver, path, isnet), imsock = -1;
if(sock < 0){
LOGERR("Can't open socket");
ERRX("start_socket(): can't open socket");
}
if(isserver){
imsock = cc_open_socket(TRUE, GP->imageport, 2); // image socket should be networked
server(sock, imsock);
}else{
#ifdef IMAGEVIEW
if(GP->showimage){
if(!GP->viewer && GP->exptime < 0.00001) ERRX("Need exposition time!");
init_grab_sock(sock);
viewer(sockcaptured); // start viewer with socket client parser
DBG("done");
}else
#endif
client(sock);
}
DBG("Close socket");
close(sock);
if(isserver){
close(imsock);
signals(0);
}
return 0;
}

View File

@ -17,30 +17,29 @@
*/ */
#pragma once #pragma once
#include "basestructs.h" #include "ccdcapture.h"
extern Camera *camera; extern cc_Camera *camera;
extern Focuser *focuser; extern cc_Focuser *focuser;
extern Wheel *wheel; extern cc_Wheel *wheel;
void calculate_stat(IMG *image); void calculate_stat(cc_IMG *image);
int saveFITS(IMG *img, char **outp); // for imageview module int saveFITS(cc_IMG *img, char **outp); // for imageview module
void focusers(); void focusers();
void wheels(); void wheels();
int prepare_ccds(); int prepare_ccds();
void ccds(); void ccds();
void camstop(); void camstop();
int getNbytes(IMG *image); cc_Camera *startCCD();
cc_Wheel *startWheel();
int startCCD(void **dlh); cc_Focuser *startFocuser();
int startWheel(void **dlh);
int startFocuser(void **dlh);
void focclose(); void focclose();
void closewheel(); void closewheel();
void closecam(); void closecam();
#ifdef IMAGEVIEW #ifdef IMAGEVIEW
void framerate(); void framerate();
int ccdcaptured(IMG **img); int ccdcaptured(cc_IMG **img);
#endif #endif
int start_socket(int isserver);

216
client.c
View File

@ -34,11 +34,11 @@
static char sendbuf[BUFSIZ]; static char sendbuf[BUFSIZ];
// send message and wait any answer // send message and wait any answer
#define SENDMSG(...) do{DBG("SENDMSG"); snprintf(sendbuf, BUFSIZ-1, __VA_ARGS__); verbose(2, "\t> %s", sendbuf); sendstrmessage(sock, sendbuf); while(getans(sock, NULL));} while(0) #define SENDMSG(...) do{DBG("SENDMSG"); snprintf(sendbuf, BUFSIZ-1, __VA_ARGS__); verbose(2, "\t> %s", sendbuf); cc_sendstrmessage(sock, sendbuf); while(getans(sock, NULL));} while(0)
// send message and wait answer starting with 'cmd' // send message and wait answer starting with 'cmd'
#define SENDMSGW(cmd, ...) do{DBG("SENDMSGW"); snprintf(sendbuf, BUFSIZ-1, cmd __VA_ARGS__); verbose(2, "\t> %s", sendbuf); sendstrmessage(sock, sendbuf);}while(!getans(sock, cmd)) #define SENDMSGW(cmd, ...) do{DBG("SENDMSGW"); snprintf(sendbuf, BUFSIZ-1, cmd __VA_ARGS__); verbose(2, "\t> %s", sendbuf); cc_sendstrmessage(sock, sendbuf);}while(!getans(sock, cmd))
// send command and wait for answer on it // send command and wait for answer on it
#define SENDCMDW(cmd) do{DBG("SENDCMDW"); strncpy(sendbuf, cmd, BUFSIZ-1); verbose(2, "\t> %s", sendbuf); sendstrmessage(sock, sendbuf);}while(!getans(sock, cmd)) #define SENDCMDW(cmd) do{DBG("SENDCMDW"); strncpy(sendbuf, cmd, BUFSIZ-1); verbose(2, "\t> %s", sendbuf); cc_sendstrmessage(sock, sendbuf);}while(!getans(sock, cmd))
static volatile atomic_int expstate = CAMERA_CAPTURE; static volatile atomic_int expstate = CAMERA_CAPTURE;
static int xm0,ym0,xm1,ym1; // max format static int xm0,ym0,xm1,ym1; // max format
static int xc0,yc0,xc1,yc1; // current format static int xc0,yc0,xc1,yc1; // current format
@ -46,77 +46,54 @@ static int xc0,yc0,xc1,yc1; // current format
#ifdef IMAGEVIEW #ifdef IMAGEVIEW
static volatile atomic_int grabno = 0, oldgrabno = 0; static volatile atomic_int grabno = 0, oldgrabno = 0;
// IPC key for shared memory // IPC key for shared memory
static IMG ima = {0}, *shmima = NULL; // ima - local storage, shmima - shm (if available) static cc_IMG ima = {0}, *shmima = NULL; // ima - local storage, shmima - shm (if available)
static size_t imbufsz = 0; // image buffer for allocated `ima` static size_t imbufsz = 0; // image buffer for allocated `ima`
static uint8_t *imbuf = NULL; static uint8_t *imbuf = NULL;
#endif #endif
static char *readmsg(int fd){ static char *readmsg(int fd){
static char buf[BUFSIZ] = {0}, line[BUFSIZ]; static cc_charbuff *buf = NULL;
int curlen = strlen(buf); static char line[BUFSIZ];
if(curlen == BUFSIZ-1) curlen = 0; // buffer overflow - clear old content if(!buf) buf = cc_bufnew(BUFSIZ);
ssize_t rd = 0; if(1 == cc_canberead(fd)){
if(1 == canberead(fd)){ if(cc_read2buf(fd, buf)){
rd = read(fd, buf + curlen, BUFSIZ-1 - curlen); size_t got = cc_getline(buf, line, BUFSIZ);
if(rd <= 0){ if(got >= BUFSIZ){
WARNX("Server disconnected"); DBG("Client fd=%d gave buffer overflow", fd);
signals(1); LOGMSG("SERVER client fd=%d buffer overflow", fd);
} }else if(got){
}
curlen += rd;
buf[curlen] = 0;
if(curlen == 0) return NULL;
//DBG("cur buffer: ----%s----", buf);
char *nl = strchr(buf, '\n');
if(!nl) return NULL;
*nl++ = 0;
strcpy(line, buf);
int rest = curlen - (int)(nl-buf);
if(rest > 0) memmove(buf, nl, rest+1);
else *buf = 0;
return line; return line;
} }
}else ERRX("Server disconnected");
}
return NULL;
}
// parser of CCD server messages; return TRUE to exit from polling cycle of `getans` (if receive 'FAIL', 'OK' or 'BUSY') // parser of CCD server messages; return TRUE to exit from polling cycle of `getans` (if receive 'FAIL', 'OK' or 'BUSY')
static int parseans(char *ans){ static int parseans(char *ans){
if(!ans) return FALSE; if(!ans) return FALSE;
//TIMESTAMP("parseans() begin"); //TIMESTAMP("parseans() begin");
//DBG("Parsing of '%s'", ans); //DBG("Parsing of '%s'", ans);
if(0 == strcmp(hresult2str(RESULT_BUSY), ans)){ if(0 == strcmp(cc_hresult2str(RESULT_BUSY), ans)){
WARNX("Server busy"); WARNX("Server busy");
return FALSE; return FALSE;
} }
if(0 == strcmp(hresult2str(RESULT_FAIL), ans)) return TRUE; if(0 == strcmp(cc_hresult2str(RESULT_FAIL), ans)) return TRUE;
if(0 == strcmp(hresult2str(RESULT_OK), ans)) return TRUE; if(0 == strcmp(cc_hresult2str(RESULT_OK), ans)) return TRUE;
char *val = get_keyval(ans); // now `ans` is a key and `val` its value char *val = cc_get_keyval(ans); // now `ans` is a key and `val` its value
if(0 == strcmp(CMD_EXPSTATE, ans)){ if(0 == strcmp(CC_CMD_EXPSTATE, ans)){
expstate = atoi(val); expstate = atoi(val);
DBG("Exposition state: %d", expstate); DBG("Exposition state: %d", expstate);
return TRUE; return TRUE;
}else if(0 == strcmp(CMD_FRAMEMAX, ans)){ }else if(0 == strcmp(CC_CMD_FRAMEMAX, ans)){
sscanf(val, "%d,%d,%d,%d", &xm0, &ym0, &xm1, &ym1); sscanf(val, "%d,%d,%d,%d", &xm0, &ym0, &xm1, &ym1);
DBG("Got maxformat: %d,%d,%d,%d", xm0, ym0, xm1, ym1); DBG("Got maxformat: %d,%d,%d,%d", xm0, ym0, xm1, ym1);
return TRUE; return TRUE;
}else if(0 == strcmp(CMD_FRAMEFORMAT, ans)){ }else if(0 == strcmp(CC_CMD_FRAMEFORMAT, ans)){
sscanf(val, "%d,%d,%d,%d", &xc0, &yc0, &xc1, &yc1); sscanf(val, "%d,%d,%d,%d", &xc0, &yc0, &xc1, &yc1);
DBG("Got current format: %d,%d,%d,%d", xc0, yc0, xc1, yc1); DBG("Got current format: %d,%d,%d,%d", xc0, yc0, xc1, yc1);
return TRUE; return TRUE;
}else if(0 == strcmp(CMD_INFTY, ans)) return TRUE; }else if(0 == strcmp(CC_CMD_INFTY, ans)) return TRUE;
/*
#ifdef IMAGEVIEW
else if(0 == strcmp(CMD_IMWIDTH, ans)){
ima.w = atoi(val);
DBG("Get width: %d", ima.w);
imdatalen = ima.w * ima.h * 2;
return TRUE;
}else if(0 == strcmp(CMD_IMHEIGHT, ans)){
ima.h = atoi(val);
DBG("Get height: %d", ima.h);
imdatalen = ima.w * ima.h * 2;
return TRUE;
}
#endif
*/
//TIMESTAMP("parseans() end"); //TIMESTAMP("parseans() end");
return FALSE; return FALSE;
} }
@ -126,13 +103,9 @@ static int parseans(char *ans){
static int getans(int sock, const char *msg){ static int getans(int sock, const char *msg){
double t0 = dtime(); double t0 = dtime();
char *ans = NULL; char *ans = NULL;
while(dtime() - t0 < ANSWER_TIMEOUT){ while(dtime() - t0 < CC_ANSWER_TIMEOUT){
char *s = readmsg(sock); char *s = readmsg(sock);
if(!s) continue; if(!s) continue;
/*if(!s){ // buffer is empty, return last message or wait for it
if(ans) return (msg ? FALSE : TRUE);
else continue;
}*/
t0 = dtime(); t0 = dtime();
ans = s; ans = s;
TIMESTAMP("Got from server: %s", ans); TIMESTAMP("Got from server: %s", ans);
@ -145,7 +118,7 @@ DBG("1 msg-> %s, ans -> %s", msg, ans);
break; break;
} }
} }
DBG("GETANS: %s, %s", ans, (dtime()-t0 > ANSWER_TIMEOUT) ? "timeout" : "got answer"); //DBG("GETANS: %s, %s", ans, (dtime()-t0 > CC_ANSWER_TIMEOUT) ? "timeout" : "got answer");
return ((ans) ? TRUE : FALSE); return ((ans) ? TRUE : FALSE);
} }
@ -154,22 +127,22 @@ DBG("1 msg-> %s, ans -> %s", msg, ans);
*/ */
static void send_headers(int sock){ static void send_headers(int sock){
// common information // common information
SENDMSG(CMD_INFO); SENDMSG(CC_CMD_INFO);
// focuser // focuser
if(GP->listdevices) SENDMSG(CMD_FOCLIST); if(GP->listdevices) SENDMSG(CC_CMD_FOCLIST);
if(GP->focdevno > -1) SENDMSG(CMD_FDEVNO "=%d", GP->focdevno); if(GP->focdevno > -1) SENDMSG(CC_CMD_FDEVNO "=%d", GP->focdevno);
if(!isnan(GP->gotopos)){ if(!isnan(GP->gotopos)){
SENDMSGW(CMD_FGOTO, "=%g", GP->gotopos); SENDMSGW(CC_CMD_FGOTO, "=%g", GP->gotopos);
} }
// wheel // wheel
if(GP->listdevices) SENDCMDW(CMD_WLIST); if(GP->listdevices) SENDCMDW(CC_CMD_WLIST);
if(GP->whldevno > -1) SENDMSGW(CMD_WDEVNO, "=%d", GP->whldevno); if(GP->whldevno > -1) SENDMSGW(CC_CMD_WDEVNO, "=%d", GP->whldevno);
if(GP->setwheel > -1) SENDMSGW(CMD_WPOS, "=%d", GP->setwheel); if(GP->setwheel > -1) SENDMSGW(CC_CMD_WPOS, "=%d", GP->setwheel);
DBG("nxt"); DBG("nxt");
// CCD/CMOS // CCD/CMOS
if(GP->X0 > INT_MIN || GP->Y0 > INT_MIN || GP->X1 > INT_MIN || GP->Y1 > INT_MIN){ // set format if(GP->X0 > INT_MIN || GP->Y0 > INT_MIN || GP->X1 > INT_MIN || GP->Y1 > INT_MIN){ // set format
SENDCMDW(CMD_FRAMEMAX); SENDCMDW(CC_CMD_FRAMEMAX);
SENDCMDW(CMD_FRAMEFORMAT); SENDCMDW(CC_CMD_FRAMEFORMAT);
// default values // default values
if(GP->X0 == INT_MIN) GP->X0 = xc0; if(GP->X0 == INT_MIN) GP->X0 = xc0;
if(GP->X1 == INT_MIN) GP->X1 = xc1; if(GP->X1 == INT_MIN) GP->X1 = xc1;
@ -183,47 +156,47 @@ static void send_headers(int sock){
if(GP->X1 < GP->X0+1 || GP->X1 > xm1) GP->X1 = xm1; if(GP->X1 < GP->X0+1 || GP->X1 > xm1) GP->X1 = xm1;
if(GP->Y1 < GP->Y0+1 || GP->Y1 > ym1) GP->Y1 = ym1; if(GP->Y1 < GP->Y0+1 || GP->Y1 > ym1) GP->Y1 = ym1;
DBG("set format: (%d,%d)x(%d,%d)", GP->X0,GP->X1,GP->Y0,GP->Y1); DBG("set format: (%d,%d)x(%d,%d)", GP->X0,GP->X1,GP->Y0,GP->Y1);
SENDMSGW(CMD_FRAMEFORMAT, "=%d,%d,%d,%d", GP->X0, GP->Y0, GP->X1, GP->Y1); SENDMSGW(CC_CMD_FRAMEFORMAT, "=%d,%d,%d,%d", GP->X0, GP->Y0, GP->X1, GP->Y1);
} }
if(GP->cancelexpose) SENDMSGW(CMD_EXPSTATE, "=%d", CAMERA_IDLE); if(GP->cancelexpose) SENDMSGW(CC_CMD_EXPSTATE, "=%d", CAMERA_IDLE);
if(GP->listdevices) SENDCMDW(CMD_CAMLIST); if(GP->listdevices) SENDCMDW(CC_CMD_CAMLIST);
if(GP->camdevno > -1) SENDMSGW(CMD_CAMDEVNO, "=%d", GP->camdevno); if(GP->camdevno > -1) SENDMSGW(CC_CMD_CAMDEVNO, "=%d", GP->camdevno);
if(GP->hbin) SENDMSGW(CMD_HBIN, "=%d", GP->hbin); if(GP->hbin) SENDMSGW(CC_CMD_HBIN, "=%d", GP->hbin);
if(GP->vbin) SENDMSGW(CMD_VBIN, "=%d", GP->vbin); if(GP->vbin) SENDMSGW(CC_CMD_VBIN, "=%d", GP->vbin);
if(!isnan(GP->temperature)) SENDMSGW(CMD_CAMTEMPER, "=%g", GP->temperature); if(!isnan(GP->temperature)) SENDMSGW(CC_CMD_CAMTEMPER, "=%g", GP->temperature);
if(GP->shtr_cmd > -1) SENDMSGW(CMD_SHUTTER, "=%d", GP->shtr_cmd); if(GP->shtr_cmd > -1) SENDMSGW(CC_CMD_SHUTTER, "=%d", GP->shtr_cmd);
if(GP->confio > -1) SENDMSGW(CMD_CONFIO, "=%d", GP->confio); if(GP->confio > -1) SENDMSGW(CC_CMD_CONFIO, "=%d", GP->confio);
if(GP->setio > -1) SENDMSGW(CMD_IO, "=%d", GP->setio);\ if(GP->setio > -1) SENDMSGW(CC_CMD_IO, "=%d", GP->setio);\
if(!isnan(GP->gain)) SENDMSGW(CMD_GAIN, "=%g", GP->gain); if(!isnan(GP->gain)) SENDMSGW(CC_CMD_GAIN, "=%g", GP->gain);
if(!isnan(GP->brightness)) SENDMSGW(CMD_BRIGHTNESS, "=%g", GP->brightness); if(!isnan(GP->brightness)) SENDMSGW(CC_CMD_BRIGHTNESS, "=%g", GP->brightness);
if(GP->nflushes > 0) SENDMSGW(CMD_NFLUSHES, "=%d", GP->nflushes); if(GP->nflushes > 0) SENDMSGW(CC_CMD_NFLUSHES, "=%d", GP->nflushes);
if(GP->exptime > -DBL_EPSILON){ // exposition and reading control: only if start of exposition if(GP->exptime > -DBL_EPSILON){ // exposition and reading control: only if start of exposition
if(GP->_8bit) SENDMSGW(CMD_8BIT, "=1"); if(GP->_8bit) SENDMSGW(CC_CMD_8BIT, "=1");
else SENDMSGW(CMD_8BIT, "=0"); else SENDMSGW(CC_CMD_8BIT, "=0");
if(GP->fast) SENDMSGW(CMD_FASTSPD, "=1"); if(GP->fast) SENDMSGW(CC_CMD_FASTSPD, "=1");
else SENDMSGW(CMD_FASTSPD, "=0"); else SENDMSGW(CC_CMD_FASTSPD, "=0");
if(GP->dark) SENDMSGW(CMD_DARK, "=1"); if(GP->dark) SENDMSGW(CC_CMD_DARK, "=1");
else SENDMSGW(CMD_DARK, "=0"); else SENDMSGW(CC_CMD_DARK, "=0");
} }
if(GP->outfile){ if(GP->outfile){
if(!*GP->outfile) SENDMSGW(CMD_FILENAME, "="); if(!*GP->outfile) SENDMSGW(CC_CMD_FILENAME, "=");
else SENDMSGW(CMD_FILENAME, "=%s", makeabspath(GP->outfile, FALSE)); else SENDMSGW(CC_CMD_FILENAME, "=%s", makeabspath(GP->outfile, FALSE));
if(GP->rewrite) SENDMSGW(CMD_REWRITE, "=1"); if(GP->rewrite) SENDMSGW(CC_CMD_REWRITE, "=1");
else SENDMSGW(CMD_REWRITE, "=0"); else SENDMSGW(CC_CMD_REWRITE, "=0");
} }
if(GP->outfileprefix){ if(GP->outfileprefix){
if(!*GP->outfileprefix) SENDMSGW(CMD_FILENAMEPREFIX, "="); if(!*GP->outfileprefix) SENDMSGW(CC_CMD_FILENAMEPREFIX, "=");
else SENDMSGW(CMD_FILENAMEPREFIX, "=%s", makeabspath(GP->outfileprefix, FALSE)); else SENDMSGW(CC_CMD_FILENAMEPREFIX, "=%s", makeabspath(GP->outfileprefix, FALSE));
} }
if(GP->exptime > -DBL_EPSILON) SENDMSGW(CMD_EXPOSITION, "=%g", GP->exptime); if(GP->exptime > -DBL_EPSILON) SENDMSGW(CC_CMD_EXPOSITION, "=%g", GP->exptime);
// FITS header keywords: // FITS header keywords:
#define CHKHDR(x, cmd) do{if(x) SENDMSG(cmd "=%s", x);}while(0) #define CHKHDR(x, cmd) do{if(x) SENDMSG(cmd "=%s", x);}while(0)
CHKHDR(GP->author, CMD_AUTHOR); CHKHDR(GP->author, CC_CMD_AUTHOR);
CHKHDR(GP->instrument, CMD_INSTRUMENT); CHKHDR(GP->instrument, CC_CMD_INSTRUMENT);
CHKHDR(GP->observers, CMD_OBSERVER); CHKHDR(GP->observers, CC_CMD_OBSERVER);
CHKHDR(GP->objname, CMD_OBJECT); CHKHDR(GP->objname, CC_CMD_OBJECT);
CHKHDR(GP->prog_id, CMD_PROGRAM); CHKHDR(GP->prog_id, CC_CMD_PROGRAM);
CHKHDR(GP->objtype, CMD_OBJTYPE); CHKHDR(GP->objtype, CC_CMD_OBJTYPE);
#undef CHKHDR #undef CHKHDR
if(GP->addhdr){ if(GP->addhdr){
char buf[1024], *ptr = buf, **sptr = GP->addhdr; char buf[1024], *ptr = buf, **sptr = GP->addhdr;
@ -236,16 +209,16 @@ static void send_headers(int sock){
int N = snprintf(ptr, L-1, "%s,", *sptr++); int N = snprintf(ptr, L-1, "%s,", *sptr++);
L -= N; ptr += N; L -= N; ptr += N;
} }
SENDMSGW(CMD_HEADERFILES, "=%s", buf); SENDMSGW(CC_CMD_HEADERFILES, "=%s", buf);
} }
} }
void client(int sock){ void client(int sock){
if(GP->restart){ if(GP->restart){
SENDCMDW(CMD_RESTART); SENDCMDW(CC_CMD_RESTART);
return; return;
} }
if(GP->infty > -1) SENDMSGW(CMD_INFTY, "=%d", GP->infty); if(GP->infty > -1) SENDMSGW(CC_CMD_INFTY, "=%d", GP->infty);
send_headers(sock); send_headers(sock);
double t0 = dtime(), tw = t0; double t0 = dtime(), tw = t0;
int Nremain = 0, nframe = 1; int Nremain = 0, nframe = 1;
@ -254,26 +227,26 @@ void client(int sock){
Nremain = GP->nframes - 1; Nremain = GP->nframes - 1;
if(Nremain < 1) Nremain = 0; if(Nremain < 1) Nremain = 0;
else GP->waitexpend = TRUE; // N>1 - wait for exp ends else GP->waitexpend = TRUE; // N>1 - wait for exp ends
SENDMSGW(CMD_EXPSTATE, "=%d", CAMERA_CAPTURE); SENDMSGW(CC_CMD_EXPSTATE, "=%d", CAMERA_CAPTURE);
}else{ }else{
int cntr = 0; int cntr = 0;
while(dtime() - t0 < WAIT_TIMEOUT && cntr < 10) while(dtime() - t0 < CC_WAIT_TIMEOUT && cntr < 3)
if(!getans(sock, NULL)) ++cntr; if(!getans(sock, NULL)) ++cntr;
DBG("RETURN: no more data"); DBG("RETURN: no more data");
return; return;
} }
double timeout = GP->waitexpend ? CLIENT_TIMEOUT : WAIT_TIMEOUT; double timeout = GP->waitexpend ? CC_CLIENT_TIMEOUT : CC_WAIT_TIMEOUT;
verbose(1, "Exposing frame 1..."); verbose(1, "Exposing frame 1...");
if(GP->waitexpend){ if(GP->waitexpend){
expstate = CAMERA_CAPTURE; // could be changed earlier expstate = CAMERA_CAPTURE; // could be changed earlier
verbose(2, "Wait for exposition end"); verbose(2, "Wait for exposition end");
} }
while(dtime() - t0 < timeout){ while(dtime() - t0 < timeout){
if(GP->waitexpend && dtime() - tw > WAIT_TIMEOUT){ if(GP->waitexpend && dtime() - tw > CC_WAIT_TIMEOUT){
SENDCMDW(CMD_TREMAIN); // get remained time SENDCMDW(CC_CMD_TREMAIN); // get remained time
tw = dtime(); tw = dtime();
sprintf(sendbuf, "%s", CMD_EXPSTATE); sprintf(sendbuf, "%s", CC_CMD_EXPSTATE);
sendstrmessage(sock, sendbuf); cc_sendstrmessage(sock, sendbuf);
} }
if(getans(sock, NULL)){ // got next portion of data if(getans(sock, NULL)){ // got next portion of data
DBG("server message"); DBG("server message");
@ -291,7 +264,7 @@ void client(int sock){
if(GP->pause_len > 0){ if(GP->pause_len > 0){
double delta, time1 = dtime() + GP->pause_len; double delta, time1 = dtime() + GP->pause_len;
while(1){ while(1){
SENDCMDW(CMD_CAMTEMPER); SENDCMDW(CC_CMD_CAMTEMPER);
if((delta = time1 - dtime()) < __FLT_EPSILON__) break; if((delta = time1 - dtime()) < __FLT_EPSILON__) break;
// %d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n // %d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n
if(delta > 1.) verbose(1, _("%d seconds till pause ends\n"), (int)delta); if(delta > 1.) verbose(1, _("%d seconds till pause ends\n"), (int)delta);
@ -302,10 +275,10 @@ void client(int sock){
} }
verbose(1, "Exposing frame %d...", ++nframe); verbose(1, "Exposing frame %d...", ++nframe);
--Nremain; --Nremain;
SENDMSGW(CMD_EXPSTATE, "=%d", CAMERA_CAPTURE); SENDMSGW(CC_CMD_EXPSTATE, "=%d", CAMERA_CAPTURE);
}else{ }else{
GP->waitexpend = 0; GP->waitexpend = 0;
timeout = ANSWER_TIMEOUT; // wait for last file name timeout = CC_ANSWER_TIMEOUT; // wait for last file name
} }
} }
} }
@ -321,7 +294,7 @@ void init_grab_sock(int sock){
controlfd = sock; controlfd = sock;
send_headers(sock); send_headers(sock);
if(!GP->forceimsock && !shmima){ // init shm buffer if user don't ask to work through image socket if(!GP->forceimsock && !shmima){ // init shm buffer if user don't ask to work through image socket
shmima = getshm(GP->shmkey, 0); // try to init client shm shmima = cc_getshm(GP->shmkey, 0); // try to init client shm
} }
} }
@ -332,7 +305,7 @@ void init_grab_sock(int sock){
static int readNbytes(int fd, size_t N, uint8_t *buf){ static int readNbytes(int fd, size_t N, uint8_t *buf){
size_t got = 0, need = N; size_t got = 0, need = N;
double t0 = dtime(); double t0 = dtime();
while(dtime() - t0 < CLIENT_TIMEOUT /*&& canberead(fd)*/ && need){ while(dtime() - t0 < CC_CLIENT_TIMEOUT /*&& cc_canberead(fd)*/ && need){
ssize_t rd = read(fd, buf + got, need); ssize_t rd = read(fd, buf + got, need);
if(rd <= 0){ if(rd <= 0){
WARNX("Server disconnected"); WARNX("Server disconnected");
@ -352,15 +325,15 @@ static void getimage(){
int imsock = -1; int imsock = -1;
static double oldtimestamp = -1.; static double oldtimestamp = -1.;
TIMESTAMP("Get image sizes"); TIMESTAMP("Get image sizes");
/*SENDCMDW(CMD_IMWIDTH); /*SENDCMDW(CC_CMD_IMWIDTH);
SENDCMDW(CMD_IMHEIGHT);*/ SENDCMDW(CC_CMD_IMHEIGHT);*/
if(shmima){ // read image from shared memory if(shmima){ // read image from shared memory
memcpy(&ima, shmima, sizeof(IMG)); memcpy(&ima, shmima, sizeof(cc_IMG));
}else{ // get image by socket }else{ // get image by socket
imsock = open_socket(FALSE, GP->imageport, TRUE); imsock = cc_open_socket(FALSE, GP->imageport, TRUE);
if(imsock < 0) ERRX("getimage(): can't open image transport socket"); if(imsock < 0) ERRX("getimage(): can't open image transport socket");
// get image size // get image size
if(!readNbytes(imsock, sizeof(IMG), (uint8_t*)&ima)){ if(!readNbytes(imsock, sizeof(cc_IMG), (uint8_t*)&ima)){
WARNX("Can't read image header"); WARNX("Can't read image header");
goto eofg; goto eofg;
} }
@ -380,7 +353,7 @@ static void getimage(){
ima.data = imbuf; // renew this value each time after getting `ima` from server ima.data = imbuf; // renew this value each time after getting `ima` from server
TIMESTAMP("Start of data read"); TIMESTAMP("Start of data read");
if(shmima){ if(shmima){
uint8_t *datastart = (uint8_t*)shmima + sizeof(IMG); uint8_t *datastart = (uint8_t*)shmima + sizeof(cc_IMG);
memcpy(imbuf, datastart, ima.bytelen); memcpy(imbuf, datastart, ima.bytelen);
TIMESTAMP("Got by shared memory"); TIMESTAMP("Got by shared memory");
}else{ }else{
@ -390,6 +363,7 @@ static void getimage(){
} }
TIMESTAMP("Got by socket"); TIMESTAMP("Got by socket");
} }
DBG("timestamps old-new=%g; imno: %zd", oldtimestamp-ima.timestamp, ima.imnumber);
if(ima.timestamp != oldtimestamp){ // test if image is really new if(ima.timestamp != oldtimestamp){ // test if image is really new
oldtimestamp = ima.timestamp; oldtimestamp = ima.timestamp;
grabno = ima.imnumber; grabno = ima.imnumber;
@ -405,11 +379,11 @@ static void *grabnext(void _U_ *arg){ // daemon grabbing images through the net
int sock = controlfd; int sock = controlfd;
while(1){ while(1){
if(!getWin()) exit(1); if(!getWin()) exit(1);
expstate = CAMERA_CAPTURE;
TIMESTAMP("End of cycle, start new"); TIMESTAMP("End of cycle, start new");
expstate = CAMERA_CAPTURE;
TIMEINIT(); TIMEINIT();
SENDMSGW(CMD_EXPSTATE, "=%d", CAMERA_CAPTURE); // start capture SENDMSGW(CC_CMD_EXPSTATE, "=%d", CAMERA_CAPTURE); // start capture
double timeout = GP->exptime + CLIENT_TIMEOUT, t0 = dtime(); double timeout = GP->exptime + CC_CLIENT_TIMEOUT, t0 = dtime();
useconds_t sleept = 500000; // 0.5s useconds_t sleept = 500000; // 0.5s
if(GP->exptime < 0.5){ if(GP->exptime < 0.5){
sleept = (useconds_t)(GP->exptime * 500000.); sleept = (useconds_t)(GP->exptime * 500000.);
@ -455,7 +429,7 @@ static void *waitimage(void _U_ *arg){ // passive waiting for next image
} }
// try to capture images through socket // try to capture images through socket
int sockcaptured(IMG **imgptr){ int sockcaptured(cc_IMG **imgptr){
//TIMESTAMP("sockcaptured() start"); //TIMESTAMP("sockcaptured() start");
if(!imgptr) return FALSE; if(!imgptr) return FALSE;
static pthread_t grabthread = 0; static pthread_t grabthread = 0;

View File

@ -18,11 +18,11 @@
#pragma once #pragma once
#include "basestructs.h" #include "ccdcapture.h"
// client-side functions // client-side functions
void client(int fd); void client(int fd);
#ifdef IMAGEVIEW #ifdef IMAGEVIEW
void init_grab_sock(int sock); void init_grab_sock(int sock);
int sockcaptured(IMG **img); int sockcaptured(cc_IMG **img);
#endif #endif

View File

@ -8,7 +8,7 @@
#include <usefull_macros.h> #include <usefull_macros.h>
#include "cmdlnopts.h" #include "cmdlnopts.h"
#include "basestructs.h" #include "ccdcapture.h"
static int help; static int help;
glob_pars *GP = NULL; glob_pars *GP = NULL;
@ -104,8 +104,8 @@ myoption cmdlnopts[] = {
{"viewer", NO_ARGS, &G.viewer,1, arg_none, NULL, N_("passive viewer (only get last images)")}, {"viewer", NO_ARGS, &G.viewer,1, arg_none, NULL, N_("passive viewer (only get last images)")},
{"restart", NO_ARGS, &G.restart,1, arg_none, NULL, N_("restart image server")}, {"restart", NO_ARGS, &G.restart,1, arg_none, NULL, N_("restart image server")},
{"shmkey", NEED_ARG, NULL, 'k', arg_int, APTR(&G.shmkey), N_("shared memory (with image data) key (default: 7777777")}, {"shmkey", NEED_ARG, NULL, 'k', arg_int, APTR(&G.shmkey), N_("shared memory (with image data) key (default: 7777777)")},
{"forceimsock",NO_ARGS, &G.forceimsock,1, arg_none, NULL, N_("force using image through socket transition even if can use SHM")}, {"forceimsock",NO_ARGS, &G.forceimsock,1, arg_none, NULL, N_("force using image through socket transition even if can use SHM)")},
{"infty", NEED_ARG, NULL, 0, arg_int, APTR(&G.infty), N_("start (!=0) or stop(==0) infinity capturing loop")}, {"infty", NEED_ARG, NULL, 0, arg_int, APTR(&G.infty), N_("start (!=0) or stop(==0) infinity capturing loop")},
#ifdef IMAGEVIEW #ifdef IMAGEVIEW
@ -125,7 +125,7 @@ myoption cmdlnopts[] = {
*/ */
glob_pars *parse_args(int argc, char **argv){ glob_pars *parse_args(int argc, char **argv){
// format of help: "Usage: progname [args]\n" // format of help: "Usage: progname [args]\n"
change_helpstring("Usage: %s [args] [output file prefix or file/dir name to view]\nTo restart server kill it with SIGUSR1\n\tArgs are:\n"); change_helpstring("Version: " PACKAGE_VERSION "\nUsage: %s [args] [output file prefix]\nTo restart server kill it with SIGUSR1\n\tArgs are:\n");
// parse arguments // parse arguments
parseargs(&argc, &argv, cmdlnopts); parseargs(&argc, &argv, cmdlnopts);
if(help) showhelp(-1, cmdlnopts); if(help) showhelp(-1, cmdlnopts);

5
examples/CMakeLists.txt Normal file
View File

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.20)
include_directories(..)
add_executable(ccd_client main.c)
target_link_libraries(ccd_client ccdcapture usefull_macros)

107
examples/main.c Normal file
View File

@ -0,0 +1,107 @@
/*
* This file is part of the CCD_Capture project.
* Copyright 2023 Edward V. Emelianov <edward.emelianoff@gmail.com>.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* A simple example to take 8-bit images with default size and given exposition time.
* Works in `infinity` mode or requesting each file after receiving previous.
*/
#include <stdio.h>
#include <string.h>
#include <usefull_macros.h>
#include "socket.h"
typedef struct{
char *sockname; // UNIX socket name of command socket or port of local socket
int isun; // command socket is UNIX socket instead of INET
int shmkey; // shared memory (with image data) key
int infty; // run in infinity loop (if not - run by requests)
int nframes; // amount of frames to take
int help; // show this help
double exptime; // time of exposition in seconds
} glob_pars;
static glob_pars G = {
.shmkey = 7777777,
.nframes = 10
};
/*
* Define command line options by filling structure:
* name has_arg flag val type argptr help
*/
myoption cmdlnopts[] = {
{"sock", NEED_ARG, NULL, 's', arg_string, APTR(&G.sockname), "command socket name or port"},
{"isun", NO_ARGS, NULL, 'U', arg_int, APTR(&G.isun), "use UNIX socket"},
{"shmkey", NEED_ARG, NULL, 'k', arg_int, APTR(&G.shmkey), "shared memory (with image data) key (default: 7777777)"},
{"infty", NO_ARGS, NULL, 'i', arg_int, APTR(&G.infty), "run in infinity capturing loop (else - request each frame)"},
{"nframes", NEED_ARG, NULL, 'n', arg_int, APTR(&G.nframes), "make series of N frames"},
{"exptime", NEED_ARG, NULL, 'x', arg_double, APTR(&G.exptime), "set exposure time to given value (seconds!)"},
{"help", NO_ARGS, NULL, 'h', arg_int, APTR(&G.help), "show this help"},
};
static cc_IMG *shimg = NULL, img = {0};
static int refresh_img(){
if(!shimg) return FALSE;
static size_t imnumber = 0;
if(shimg->imnumber == imnumber) return FALSE;
imnumber = shimg->imnumber;
void *optr = img.data;
memcpy(&img, shimg, sizeof(img));
img.data = realloc(optr, img.bytelen);
memcpy(img.data, (uint8_t*)shimg + sizeof(cc_IMG), img.bytelen);
return TRUE;
}
int main(int argc, char **argv){
initial_setup();
parseargs(&argc, &argv, cmdlnopts);
if(G.help) showhelp(-1, cmdlnopts);
if(argc > 0){
WARNX("%d unused parameters:", argc);
for(int i = 0; i < argc; ++i)
printf("%4d: %s\n", i, argv[i]);
}
if(!G.sockname) ERRX("Point socket name or port");
int sock = cc_open_socket(FALSE, G.sockname, !G.isun);
if(sock < 0) ERR("Can't open socket %s", G.sockname);
shimg = cc_getshm(G.shmkey, 0);
if(!shimg) ERRX("Can't get shared memory segment");
int i = 0;
time_t oldtime = time(NULL);
double oldtimestamp = shimg->timestamp;
do{
time_t now = time(NULL);
if(now - oldtime > 5){
WARNX("No new images for 5 seconds");
break;
}
if(!refresh_img()){
usleep(1000);
continue;
}
++i;
oldtime = now;
printf("Got image #%zd, size %dx%d, bitpix %d, time %g\n", img.imnumber, img.w, img.h, img.bitpix, img.timestamp-oldtimestamp);
}while(i < 10);
close(sock);
return 0;
}

View File

@ -449,7 +449,7 @@ result: 0.0014689s
* @param w,h - image width and height * @param w,h - image width and height
* @return data allocated here * @return data allocated here
*/ */
static uint8_t *equalize(IMG *img, int w, int h){ static uint8_t *equalize(cc_IMG *img, int w, int h){
uint8_t *retn = MALLOC(uint8_t, w*h); uint8_t *retn = MALLOC(uint8_t, w*h);
double orig_hysto[0x10000] = {0.}; // original hystogram double orig_hysto[0x10000] = {0.}; // original hystogram
uint8_t eq_levls[0x10000] = {0}; // levels to convert: newpix = eq_levls[oldpix] uint8_t eq_levls[0x10000] = {0}; // levels to convert: newpix = eq_levls[oldpix]
@ -469,7 +469,7 @@ static uint8_t *equalize(IMG *img, int w, int h){
for(int i = 0; i < 0x10000; ++i) orig_hysto[i] += histogram_private[i]; for(int i = 0; i < 0x10000; ++i) orig_hysto[i] += histogram_private[i];
} }
}*/ }*/
int bytes = getNbytes(img); int bytes = cc_getNbytes(img);
if(bytes == 1){ if(bytes == 1){
uint8_t *data = (uint8_t*) img->data; uint8_t *data = (uint8_t*) img->data;
@ -518,12 +518,12 @@ cuts: 0.00188208s
*/ */
// count image cuts as [median-sigma median+5sigma] // count image cuts as [median-sigma median+5sigma]
static uint8_t *mkcuts(IMG *img, int w, int h){ static uint8_t *mkcuts(cc_IMG *img, int w, int h){
uint8_t *retn = MALLOC(uint8_t, w*h); uint8_t *retn = MALLOC(uint8_t, w*h);
int orig_hysto[0x10000] = {0.}; // original hystogram int orig_hysto[0x10000] = {0.}; // original hystogram
int s = w*h; int s = w*h;
double sum = 0., sum2 = 0.; double sum = 0., sum2 = 0.;
int bytes = getNbytes(img); int bytes = cc_getNbytes(img);
TIMESTAMP("Make histogram"); TIMESTAMP("Make histogram");
if(bytes == 1){ if(bytes == 1){
uint8_t *data = (uint8_t*) img->data; uint8_t *data = (uint8_t*) img->data;
@ -607,7 +607,7 @@ static uint8_t *mkcuts(IMG *img, int w, int h){
return retn; return retn;
} }
static void change_displayed_image(IMG *img){ static void change_displayed_image(cc_IMG *img){
if(!win || !img) return; if(!win || !img) return;
static size_t lastN = 0; static size_t lastN = 0;
ssize_t delta = img->imnumber - lastN; ssize_t delta = img->imnumber - lastN;
@ -704,7 +704,7 @@ int viewer(imagefunc newimage){
WARNX(_("Can't open OpenGL window, image preview will be inaccessible")); WARNX(_("Can't open OpenGL window, image preview will be inaccessible"));
return 1; return 1;
} }
IMG *img = NULL; cc_IMG *img = NULL;
//double t0 = dtime(); //double t0 = dtime();
while(1){ while(1){
if(!win || win->killthread){ // got kill from ctrl+q if(!win || win->killthread){ // got kill from ctrl+q

View File

@ -82,6 +82,6 @@ void conv_mouse_to_image_coords(int x, int y, float *X, float *Y, windowData *wi
void conv_image_to_mouse_coords(float X, float Y, int *x, int *y, windowData *window); void conv_image_to_mouse_coords(float X, float Y, int *x, int *y, windowData *window);
windowData* getWin(); windowData* getWin();
typedef int (*imagefunc)(IMG**); typedef int (*imagefunc)(cc_IMG**);
int viewer(imagefunc); int viewer(imagefunc);

Binary file not shown.

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-25 16:15+0300\n" "POT-Creation-Date: 2024-01-24 11:37+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -246,11 +246,11 @@ msgid "restart image server"
msgstr "" msgstr ""
#: cmdlnopts.c:107 #: cmdlnopts.c:107
msgid "shared memory (with image data) key (default: 7777777" msgid "shared memory (with image data) key (default: 7777777)"
msgstr "" msgstr ""
#: cmdlnopts.c:108 #: cmdlnopts.c:108
msgid "force using image through socket transition even if can use SHM" msgid "force using image through socket transition even if can use SHM)"
msgstr "" msgstr ""
#: cmdlnopts.c:109 #: cmdlnopts.c:109
@ -261,321 +261,301 @@ msgstr ""
msgid "Display image in OpenGL window" msgid "Display image in OpenGL window"
msgstr "" msgstr ""
#: ccdfunc.c:65 #: ccdfunc.c:138
#, c-format
msgid "Can't find plugin %s: %s"
msgstr ""
#: ccdfunc.c:77
#, c-format
msgid "Can't find focuser in plugin %s: %s"
msgstr ""
#: ccdfunc.c:88
#, c-format
msgid "Can't find camera in plugin %s: %s"
msgstr ""
#: ccdfunc.c:99
#, c-format
msgid "Can't find wheel in plugin %s: %s"
msgstr ""
#: ccdfunc.c:185
msgid "Camera device unknown" msgid "Camera device unknown"
msgstr "" msgstr ""
#. Не могу сохранить файл #. Не могу сохранить файл
#: ccdfunc.c:209 #: ccdfunc.c:162
#, c-format #, c-format
msgid "Can't save file with prefix %s" msgid "Can't save file with prefix %s"
msgstr "" msgstr ""
#: ccdfunc.c:362 #: ccdfunc.c:315
#, c-format #, c-format
msgid "File saved as '%s'" msgid "File saved as '%s'"
msgstr "" msgstr ""
#: ccdfunc.c:371 #: ccdfunc.c:324
msgid "Error saving file" msgid "Error saving file"
msgstr "" msgstr ""
#: ccdfunc.c:448 #: ccdfunc.c:401
#, c-format #, c-format
msgid "Image stat:\n" msgid "Image stat:\n"
msgstr "" msgstr ""
#: ccdfunc.c:456 #: ccdfunc.c:409
msgid "Focuser device not pointed" msgid "Focuser device not pointed"
msgstr "" msgstr ""
#: ccdfunc.c:463 #: ccdfunc.c:416
msgid "No focusers found" msgid "No focusers found"
msgstr "" msgstr ""
#: ccdfunc.c:494 #: ccdfunc.c:447
#, c-format #, c-format
msgid "Found %d focusers, you point number %d" msgid "Found %d focusers, you point number %d"
msgstr "" msgstr ""
#: ccdfunc.c:498 #: ccdfunc.c:451
msgid "Can't set active focuser number" msgid "Can't set active focuser number"
msgstr "" msgstr ""
#: ccdfunc.c:512 #: ccdfunc.c:465
msgid "Can't get focuser limit positions" msgid "Can't get focuser limit positions"
msgstr "" msgstr ""
#: ccdfunc.c:519 #: ccdfunc.c:472
msgid "Can't get current focuser position" msgid "Can't get current focuser position"
msgstr "" msgstr ""
#: ccdfunc.c:533 #: ccdfunc.c:486
#, c-format #, c-format
msgid "Can't set position %g: out of limits [%g, %g]" msgid "Can't set position %g: out of limits [%g, %g]"
msgstr "" msgstr ""
#: ccdfunc.c:537 #: ccdfunc.c:490
msgid "Can't home focuser" msgid "Can't home focuser"
msgstr "" msgstr ""
#: ccdfunc.c:539 #: ccdfunc.c:492
#, c-format #, c-format
msgid "Can't set position %g" msgid "Can't set position %g"
msgstr "" msgstr ""
#: ccdfunc.c:547 #: ccdfunc.c:500
msgid "Wheel device not pointed" msgid "cc_Wheel device not pointed"
msgstr "" msgstr ""
#: ccdfunc.c:554 #: ccdfunc.c:507
msgid "No wheels found" msgid "No wheels found"
msgstr "" msgstr ""
#: ccdfunc.c:585 #: ccdfunc.c:538
#, c-format #, c-format
msgid "Found %d wheels, you point number %d" msgid "Found %d wheels, you point number %d"
msgstr "" msgstr ""
#: ccdfunc.c:589 #: ccdfunc.c:542
msgid "Can't set active wheel number" msgid "Can't set active wheel number"
msgstr "" msgstr ""
#: ccdfunc.c:605 #: ccdfunc.c:558
msgid "Can't get max wheel position" msgid "Can't get max wheel position"
msgstr "" msgstr ""
#: ccdfunc.c:612 #: ccdfunc.c:565
#, c-format #, c-format
msgid "Wheel position should be from 0 to %d" msgid "cc_Wheel position should be from 0 to %d"
msgstr "" msgstr ""
#: ccdfunc.c:616 #: ccdfunc.c:569
#, c-format #, c-format
msgid "Can't set wheel position %d" msgid "Can't set wheel position %d"
msgstr "" msgstr ""
#: ccdfunc.c:633 #: ccdfunc.c:586
#, c-format #, c-format
msgid "%.1f seconds till exposition ends" msgid "%.1f seconds till exposition ends"
msgstr "" msgstr ""
#: ccdfunc.c:648 #: ccdfunc.c:601
msgid "Camera device not pointed" msgid "Camera device not pointed"
msgstr "" msgstr ""
#: ccdfunc.c:655 ccdfunc.c:656 #: ccdfunc.c:608 ccdfunc.c:609
msgid "No cameras found" msgid "No cameras found"
msgstr "" msgstr ""
#: ccdfunc.c:686 #: ccdfunc.c:639
#, c-format #, c-format
msgid "Found %d cameras, you point number %d" msgid "Found %d cameras, you point number %d"
msgstr "" msgstr ""
#: ccdfunc.c:690 #: ccdfunc.c:643
msgid "Can't set active camera number" msgid "Can't set active camera number"
msgstr "" msgstr ""
#: ccdfunc.c:696 #: ccdfunc.c:649
msgid "Can't set fan speed" msgid "Can't set fan speed"
msgstr "" msgstr ""
#: ccdfunc.c:697 #: ccdfunc.c:650
#, c-format #, c-format
msgid "Set fan speed to %d" msgid "Set fan speed to %d"
msgstr "" msgstr ""
#: ccdfunc.c:702 #: ccdfunc.c:655
#, c-format #, c-format
msgid "Camera model: %s" msgid "Camera model: %s"
msgstr "" msgstr ""
#: ccdfunc.c:703 #: ccdfunc.c:656
#, c-format #, c-format
msgid "Pixel size: %g x %g" msgid "Pixel size: %g x %g"
msgstr "" msgstr ""
#: ccdfunc.c:709 #: ccdfunc.c:662
#, c-format #, c-format
msgid "Full array: %s" msgid "Full array: %s"
msgstr "" msgstr ""
#: ccdfunc.c:712 #: ccdfunc.c:665
#, c-format #, c-format
msgid "Field of view: %s" msgid "Field of view: %s"
msgstr "" msgstr ""
#: ccdfunc.c:715 #: ccdfunc.c:668
#, c-format #, c-format
msgid "Current format: %s" msgid "Current format: %s"
msgstr "" msgstr ""
#: ccdfunc.c:718 #: ccdfunc.c:671
#, c-format #, c-format
msgid "Can't set T to %g degC" msgid "Can't set T to %g degC"
msgstr "" msgstr ""
#: ccdfunc.c:726 #: ccdfunc.c:679
#, c-format #, c-format
msgid "Shutter command: %s\n" msgid "Shutter command: %s\n"
msgstr "" msgstr ""
#: ccdfunc.c:728 #: ccdfunc.c:681
#, c-format #, c-format
msgid "Can't run shutter command %s (unsupported?)" msgid "Can't run shutter command %s (unsupported?)"
msgstr "" msgstr ""
#. "Попытка сконфигурировать порт I/O как %d\n" #. "Попытка сконфигурировать порт I/O как %d\n"
#: ccdfunc.c:732 #: ccdfunc.c:685
#, c-format #, c-format
msgid "Try to configure I/O port as %d" msgid "Try to configure I/O port as %d"
msgstr "" msgstr ""
#: ccdfunc.c:734 #: ccdfunc.c:687
msgid "Can't configure (unsupported?)" msgid "Can't configure (unsupported?)"
msgstr "" msgstr ""
#: ccdfunc.c:741 #: ccdfunc.c:694
msgid "Can't get IOport state (unsupported?)" msgid "Can't get IOport state (unsupported?)"
msgstr "" msgstr ""
#. "Попытка записи %d в порт I/O\n" #. "Попытка записи %d в порт I/O\n"
#: ccdfunc.c:745 #: ccdfunc.c:698
#, c-format #, c-format
msgid "Try to write %d to I/O port" msgid "Try to write %d to I/O port"
msgstr "" msgstr ""
#: ccdfunc.c:747 #: ccdfunc.c:700
msgid "Can't set IOport" msgid "Can't set IOport"
msgstr "" msgstr ""
#: ccdfunc.c:754 #: ccdfunc.c:707
#, c-format #, c-format
msgid "Set gain to %g" msgid "Set gain to %g"
msgstr "" msgstr ""
#: ccdfunc.c:755 #: ccdfunc.c:708
#, c-format #, c-format
msgid "Can't set gain to %g" msgid "Can't set gain to %g"
msgstr "" msgstr ""
#: ccdfunc.c:760 #: ccdfunc.c:713
#, c-format #, c-format
msgid "Set brightness to %g" msgid "Set brightness to %g"
msgstr "" msgstr ""
#: ccdfunc.c:761 #: ccdfunc.c:714
#, c-format #, c-format
msgid "Can't set brightness to %g" msgid "Can't set brightness to %g"
msgstr "" msgstr ""
#: ccdfunc.c:767 server.c:265 #: ccdfunc.c:720 server.c:264
#, c-format #, c-format
msgid "Can't set binning %dx%d" msgid "Can't set binning %dx%d"
msgstr "" msgstr ""
#: ccdfunc.c:779 server.c:266 #: ccdfunc.c:732 server.c:265
msgid "Can't set given geometry" msgid "Can't set given geometry"
msgstr "" msgstr ""
#: ccdfunc.c:783 #: ccdfunc.c:736
#, c-format #, c-format
msgid "Can't set %d flushes" msgid "Can't set %d flushes"
msgstr "" msgstr ""
#: ccdfunc.c:787 #: ccdfunc.c:740
#, c-format #, c-format
msgid "Can't set exposure time to %f seconds" msgid "Can't set exposure time to %f seconds"
msgstr "" msgstr ""
#: ccdfunc.c:790 #: ccdfunc.c:743
msgid "Can't change frame type" msgid "Can't change frame type"
msgstr "" msgstr ""
#: ccdfunc.c:793 #: ccdfunc.c:746
msgid "Can't set bit depth" msgid "Can't set bit depth"
msgstr "" msgstr ""
#: ccdfunc.c:795 #: ccdfunc.c:748
msgid "Can't set readout speed" msgid "Can't set readout speed"
msgstr "" msgstr ""
#: ccdfunc.c:796 #: ccdfunc.c:749
#, c-format #, c-format
msgid "Readout mode: %s" msgid "Readout mode: %s"
msgstr "" msgstr ""
#: ccdfunc.c:797 #: ccdfunc.c:750
msgid "Only show statistics" msgid "Only show statistics"
msgstr "" msgstr ""
#. GET binning should be AFTER setgeometry! #. GET binning should be AFTER setgeometry!
#: ccdfunc.c:799 #: ccdfunc.c:752
msgid "Can't get current binning" msgid "Can't get current binning"
msgstr "" msgstr ""
#. Захват кадра %d\n #. Захват кадра %d\n
#: ccdfunc.c:824 #: ccdfunc.c:777
#, c-format #, c-format
msgid "Capture frame %d" msgid "Capture frame %d"
msgstr "" msgstr ""
#: ccdfunc.c:826 ccdfunc.c:912 server.c:149 #: ccdfunc.c:779 ccdfunc.c:853 server.c:148
msgid "Can't start exposition" msgid "Can't start exposition"
msgstr "" msgstr ""
#: ccdfunc.c:831 #: ccdfunc.c:784
msgid "Can't capture image" msgid "Can't capture image"
msgstr "" msgstr ""
#: ccdfunc.c:834 #: ccdfunc.c:787
msgid "Read grabbed image" msgid "Read grabbed image"
msgstr "" msgstr ""
#: ccdfunc.c:838 ccdfunc.c:925 #: ccdfunc.c:791 ccdfunc.c:866
msgid "Can't grab image" msgid "Can't grab image"
msgstr "" msgstr ""
#. %d секунд до окончания паузы\n #. %d секунд до окончания паузы\n
#: ccdfunc.c:850 client.c:297 #: ccdfunc.c:803 client.c:270
#, c-format #, c-format
msgid "%d seconds till pause ends\n" msgid "%d seconds till pause ends\n"
msgstr "" msgstr ""
#: ccdfunc.c:923 #: ccdfunc.c:864
msgid "Some error when capture" msgid "Some error when capture"
msgstr "" msgstr ""
#: server.c:189 #: server.c:188
msgid "No camera device" msgid "No camera device"
msgstr "" msgstr ""
#: client.c:282 #: client.c:255
msgid "Can't make exposition" msgid "Can't make exposition"
msgstr "" msgstr ""
#: client.c:313 #: client.c:286
msgid "Server timeout" msgid "Server timeout"
msgstr "" msgstr ""

View File

@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\n" msgstr "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-12-25 15:48+0300\n" "POT-Creation-Date: 2024-01-24 11:35+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,13 +16,13 @@ msgstr "Project-Id-Version: PACKAGE VERSION\n"
"Content-Type: text/plain; charset=koi8-r\n" "Content-Type: text/plain; charset=koi8-r\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: ccdfunc.c:633 #: ccdfunc.c:586
#, c-format #, c-format
msgid "%.1f seconds till exposition ends" msgid "%.1f seconds till exposition ends"
msgstr "%.1f ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÜËÓÐÏÚÉÃÉÉ" msgstr "%.1f ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÜËÓÐÏÚÉÃÉÉ"
#. %d Ñ<>екунд до окончаниÑ<C2B8> паузы\n #. %d Ñ<>екунд до окончаниÑ<C2B8> паузы\n
#: ccdfunc.c:850 client.c:297 #: ccdfunc.c:803 client.c:270
#, c-format #, c-format
msgid "%d seconds till pause ends\n" msgid "%d seconds till pause ends\n"
msgstr "%d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n" msgstr "%d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n"
@ -39,77 +39,57 @@ msgstr "
msgid "CMOS gain level" msgid "CMOS gain level"
msgstr "ÕÒÏ×ÅÎØ Gain CMOS" msgstr "ÕÒÏ×ÅÎØ Gain CMOS"
#: ccdfunc.c:648 #: ccdfunc.c:601
msgid "Camera device not pointed" msgid "Camera device not pointed"
msgstr "õÓÔÒÏÊÓÔ×Ï Ó×ÅÏÐÒÉÅÍÎÉËÁ ÎÅ ÐÏÄËÌÀÞÅÎÏ" msgstr "õÓÔÒÏÊÓÔ×Ï Ó×ÅÏÐÒÉÅÍÎÉËÁ ÎÅ ÐÏÄËÌÀÞÅÎÏ"
#: ccdfunc.c:185 #: ccdfunc.c:138
msgid "Camera device unknown" msgid "Camera device unknown"
msgstr "õÓÔÒÏÊÓÔ×Ï Ó×ÅÏÐÒÉÅÍÎÉËÁ ÎÅ ÏÐÏÚÎÁÎÏ" msgstr "õÓÔÒÏÊÓÔ×Ï Ó×ÅÏÐÒÉÅÍÎÉËÁ ÎÅ ÏÐÏÚÎÁÎÏ"
#: ccdfunc.c:702 #: ccdfunc.c:655
#, c-format #, c-format
msgid "Camera model: %s" msgid "Camera model: %s"
msgstr "íÏÄÅÌØ Ó×ÅÔÏÐÒÉÅÍÎÉËÁ: %s" msgstr "íÏÄÅÌØ Ó×ÅÔÏÐÒÉÅÍÎÉËÁ: %s"
#: ccdfunc.c:831 #: ccdfunc.c:784
msgid "Can't capture image" msgid "Can't capture image"
msgstr "îÅ ÍÏÇÕ ÚÁÈ×ÁÔÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ" msgstr "îÅ ÍÏÇÕ ÚÁÈ×ÁÔÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ"
#: ccdfunc.c:790 #: ccdfunc.c:743
msgid "Can't change frame type" msgid "Can't change frame type"
msgstr "îÅ ÍÏÇÕ ÉÚÍÅÎÉÔØ ÔÉÐ ËÁÄÒÁ" msgstr "îÅ ÍÏÇÕ ÉÚÍÅÎÉÔØ ÔÉÐ ËÁÄÒÁ"
#: ccdfunc.c:734 #: ccdfunc.c:687
msgid "Can't configure (unsupported?)" msgid "Can't configure (unsupported?)"
msgstr "îÅ ÍÏÇÕ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ (ÏÐÃÉÑ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)" msgstr "îÅ ÍÏÇÕ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ (ÏÐÃÉÑ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)"
#: ccdfunc.c:88 #: ccdfunc.c:694
#, c-format
msgid "Can't find camera in plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ËÁÍÅÒÙ %s: %s"
#: ccdfunc.c:77
#, c-format
msgid "Can't find focuser in plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ÆÏËÕÓÅÒÁ %s: %s"
#: ccdfunc.c:65
#, c-format
msgid "Can't find plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ %s: %s"
#: ccdfunc.c:99
#, c-format
msgid "Can't find wheel in plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ÔÕÒÅÌÉ %s: %s"
#: ccdfunc.c:741
msgid "Can't get IOport state (unsupported?)" msgid "Can't get IOport state (unsupported?)"
msgstr "îÅ ÍÏÇÕ ÐÏÌÕÞÉÔØ ÓÏÓÔÏÑÎÉÅ ÐÏÒÔÁ I/O (ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)" msgstr "îÅ ÍÏÇÕ ÐÏÌÕÞÉÔØ ÓÏÓÔÏÑÎÉÅ ÐÏÒÔÁ I/O (ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)"
#. GET binning should be AFTER setgeometry! #. GET binning should be AFTER setgeometry!
#: ccdfunc.c:799 #: ccdfunc.c:752
msgid "Can't get current binning" msgid "Can't get current binning"
msgstr "îÅ ÍÏÇÕ ÐÏÌÕÞÉÔØ ÔÅËÕÝÅÅ ÚÎÁÞÅÎÉÅ ÂÉÎÎÉÎÇÁ" msgstr "îÅ ÍÏÇÕ ÐÏÌÕÞÉÔØ ÔÅËÕÝÅÅ ÚÎÁÞÅÎÉÅ ÂÉÎÎÉÎÇÁ"
#: ccdfunc.c:519 #: ccdfunc.c:472
msgid "Can't get current focuser position" msgid "Can't get current focuser position"
msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÔÅËÕÝÕÀ ÐÏÚÉÃÉÀ ÆÏËÕÓÅÒÁ" msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÔÅËÕÝÕÀ ÐÏÚÉÃÉÀ ÆÏËÕÓÅÒÁ"
#: ccdfunc.c:512 #: ccdfunc.c:465
msgid "Can't get focuser limit positions" msgid "Can't get focuser limit positions"
msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÐÒÅÄÅÌØÎÕÀ ÐÏÚÉÃÉÀ ÆÏËÕÓÅÒÁ" msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÐÒÅÄÅÌØÎÕÀ ÐÏÚÉÃÉÀ ÆÏËÕÓÅÒÁ"
#: ccdfunc.c:605 #: ccdfunc.c:558
msgid "Can't get max wheel position" msgid "Can't get max wheel position"
msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÐÒÅÄÅÌØÎÕÀ ÐÏÚÉÃÉÀ ËÏÌÅÓÁ" msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÐÒÅÄÅÌØÎÕÀ ÐÏÚÉÃÉÀ ËÏÌÅÓÁ"
#: ccdfunc.c:838 ccdfunc.c:925 #: ccdfunc.c:791 ccdfunc.c:866
msgid "Can't grab image" msgid "Can't grab image"
msgstr "îÅ ÍÏÇÕ ÚÁÈ×ÁÔÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ" msgstr "îÅ ÍÏÇÕ ÚÁÈ×ÁÔÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ"
#: ccdfunc.c:537 #: ccdfunc.c:490
msgid "Can't home focuser" msgid "Can't home focuser"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÆÏËÕÓÅÒ × ÎÕÌØ" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÆÏËÕÓÅÒ × ÎÕÌØ"
@ -117,7 +97,7 @@ msgstr "
msgid "Can't init mutex!" msgid "Can't init mutex!"
msgstr "îÅ ÍÏÇÕ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÔØ ÍØÀÔÅËÓ!" msgstr "îÅ ÍÏÇÕ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÔØ ÍØÀÔÅËÓ!"
#: client.c:282 #: client.c:255
msgid "Can't make exposition" msgid "Can't make exposition"
msgstr "îÅ ÍÏÇÕ ×ÙÐÏÌÎÉÔØ ÜËÓÐÏÚÉÃÉÀ" msgstr "îÅ ÍÏÇÕ ×ÙÐÏÌÎÉÔØ ÜËÓÐÏÚÉÃÉÀ"
@ -125,105 +105,105 @@ msgstr "
msgid "Can't open OpenGL window, image preview will be inaccessible" msgid "Can't open OpenGL window, image preview will be inaccessible"
msgstr "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÏËÎÏ OpenGL, ÏÔÏÂÒÁÖÅÎÉÅ ÂÕÄÅÔ ÎÅÄÏÓÔÕÐÎÏ" msgstr "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÏËÎÏ OpenGL, ÏÔÏÂÒÁÖÅÎÉÅ ÂÕÄÅÔ ÎÅÄÏÓÔÕÐÎÏ"
#: ccdfunc.c:728 #: ccdfunc.c:681
#, c-format #, c-format
msgid "Can't run shutter command %s (unsupported?)" msgid "Can't run shutter command %s (unsupported?)"
msgstr "îÅ ÍÏÇÕ ×ÙÐÏÌÎÉÔØ ËÏÍÁÎÄÕ ÚÁÔ×ÏÒÁ %s (ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)" msgstr "îÅ ÍÏÇÕ ×ÙÐÏÌÎÉÔØ ËÏÍÁÎÄÕ ÚÁÔ×ÏÒÁ %s (ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)"
#. Ð<>е могу Ñ<>охраниÑÑŒ файл #. Ð<>е могу Ñ<>охраниÑÑŒ файл
#: ccdfunc.c:209 #: ccdfunc.c:162
#, c-format #, c-format
msgid "Can't save file with prefix %s" msgid "Can't save file with prefix %s"
msgstr "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ Ó ÐÒÅÆÉËÓÏÍ %s" msgstr "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ Ó ÐÒÅÆÉËÓÏÍ %s"
#: ccdfunc.c:783 #: ccdfunc.c:736
#, c-format #, c-format
msgid "Can't set %d flushes" msgid "Can't set %d flushes"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ %d ÓÂÒÏÓÏ×" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ %d ÓÂÒÏÓÏ×"
#: ccdfunc.c:747 #: ccdfunc.c:700
msgid "Can't set IOport" msgid "Can't set IOport"
msgstr "îÅ ÍÏÇÕ ÐÏÍÅÎÑÔØ ÚÎÁÞÅÎÉÑ ÐÏÒÔÁ I/O" msgstr "îÅ ÍÏÇÕ ÐÏÍÅÎÑÔØ ÚÎÁÞÅÎÉÑ ÐÏÒÔÁ I/O"
#: ccdfunc.c:718 #: ccdfunc.c:671
#, c-format #, c-format
msgid "Can't set T to %g degC" msgid "Can't set T to %g degC"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ × %g ÇÒÁÄã" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ × %g ÇÒÁÄã"
#: ccdfunc.c:690 #: ccdfunc.c:643
msgid "Can't set active camera number" msgid "Can't set active camera number"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÊ ËÁÍÅÒÙ" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÊ ËÁÍÅÒÙ"
#: ccdfunc.c:498 #: ccdfunc.c:451
msgid "Can't set active focuser number" msgid "Can't set active focuser number"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÇÏ ÆÏËÕÓÅÒÁ" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÇÏ ÆÏËÕÓÅÒÁ"
#: ccdfunc.c:589 #: ccdfunc.c:542
msgid "Can't set active wheel number" msgid "Can't set active wheel number"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÇÏ ËÏÌÅÓÁ" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÇÏ ËÏÌÅÓÁ"
#: ccdfunc.c:767 server.c:265 #: ccdfunc.c:720 server.c:264
#, c-format #, c-format
msgid "Can't set binning %dx%d" msgid "Can't set binning %dx%d"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÂÉÎÎÉÎÇ %dx%d" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÂÉÎÎÉÎÇ %dx%d"
#: ccdfunc.c:793 #: ccdfunc.c:746
msgid "Can't set bit depth" msgid "Can't set bit depth"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÒÁÚÒÑÄÎÏÓÔØ áãð" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÒÁÚÒÑÄÎÏÓÔØ áãð"
#: ccdfunc.c:761 #: ccdfunc.c:714
#, c-format #, c-format
msgid "Can't set brightness to %g" msgid "Can't set brightness to %g"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÑÒËÏÓÔØ × %g" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÑÒËÏÓÔØ × %g"
#: ccdfunc.c:787 #: ccdfunc.c:740
#, c-format #, c-format
msgid "Can't set exposure time to %f seconds" msgid "Can't set exposure time to %f seconds"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÜËÓÐÏÚÉÃÉÀ × %f ÓÅËÕÎÄ" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÜËÓÐÏÚÉÃÉÀ × %f ÓÅËÕÎÄ"
#: ccdfunc.c:696 #: ccdfunc.c:649
msgid "Can't set fan speed" msgid "Can't set fan speed"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ×" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ×"
#: ccdfunc.c:755 #: ccdfunc.c:708
#, c-format #, c-format
msgid "Can't set gain to %g" msgid "Can't set gain to %g"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ Gain × %g" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ Gain × %g"
#: ccdfunc.c:779 server.c:266 #: ccdfunc.c:732 server.c:265
msgid "Can't set given geometry" msgid "Can't set given geometry"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÇÅÏÍÅÔÒÉÀ" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÇÅÏÍÅÔÒÉÀ"
#: ccdfunc.c:539 #: ccdfunc.c:492
#, c-format #, c-format
msgid "Can't set position %g" msgid "Can't set position %g"
msgstr "îÅ ÍÏÇÕ ÉÚÍÅÎÉÔØ ÐÏÚÉÃÉÀ ÎÁ %g" msgstr "îÅ ÍÏÇÕ ÉÚÍÅÎÉÔØ ÐÏÚÉÃÉÀ ÎÁ %g"
#: ccdfunc.c:533 #: ccdfunc.c:486
#, c-format #, c-format
msgid "Can't set position %g: out of limits [%g, %g]" msgid "Can't set position %g: out of limits [%g, %g]"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÏÚÉÃÉÀ %g: ×ÎÅ ÐÒÅÄÅÌÏ× [%g, %g]" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÏÚÉÃÉÀ %g: ×ÎÅ ÐÒÅÄÅÌÏ× [%g, %g]"
#: ccdfunc.c:795 #: ccdfunc.c:748
msgid "Can't set readout speed" msgid "Can't set readout speed"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ"
#: ccdfunc.c:616 #: ccdfunc.c:569
#, c-format #, c-format
msgid "Can't set wheel position %d" msgid "Can't set wheel position %d"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÏÌÏÖÅÎÉÅ ËÏÌÅÓÁ %d" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÏÌÏÖÅÎÉÅ ËÏÌÅÓÁ %d"
#: ccdfunc.c:826 ccdfunc.c:912 server.c:149 #: ccdfunc.c:779 ccdfunc.c:853 server.c:148
msgid "Can't start exposition" msgid "Can't start exposition"
msgstr "îÅ ÍÏÇÕ ÎÁÞÁÔØ ÜËÓÐÏÚÉÃÉÀ" msgstr "îÅ ÍÏÇÕ ÎÁÞÁÔØ ÜËÓÐÏÚÉÃÉÀ"
#. Захват кадра %d\n #. Захват кадра %d\n
#: ccdfunc.c:824 #: ccdfunc.c:777
#, c-format #, c-format
msgid "Capture frame %d" msgid "Capture frame %d"
msgstr "úÁÈ×ÁÔ ËÁÄÒÁ %d" msgstr "úÁÈ×ÁÔ ËÁÄÒÁ %d"
#: ccdfunc.c:715 #: ccdfunc.c:668
#, c-format #, c-format
msgid "Current format: %s" msgid "Current format: %s"
msgstr "" msgstr ""
@ -237,40 +217,40 @@ msgstr "
msgid "Equalization of histogram: %s" msgid "Equalization of histogram: %s"
msgstr "üË×ÁÌÉÚÁÃÉÑ ÇÉÓÔÏÇÒÁÍÍÙ: %s" msgstr "üË×ÁÌÉÚÁÃÉÑ ÇÉÓÔÏÇÒÁÍÍÙ: %s"
#: ccdfunc.c:371 #: ccdfunc.c:324
msgid "Error saving file" msgid "Error saving file"
msgstr "ïÛÉÂËÁ ÓÏÈÒÁÎÅÎÉÑ ÆÁÊÌÁ" msgstr "ïÛÉÂËÁ ÓÏÈÒÁÎÅÎÉÑ ÆÁÊÌÁ"
#: ccdfunc.c:712 #: ccdfunc.c:665
#, c-format #, c-format
msgid "Field of view: %s" msgid "Field of view: %s"
msgstr "ðÏÌÅ ÚÒÅÎÉÑ: %s" msgstr "ðÏÌÅ ÚÒÅÎÉÑ: %s"
#: ccdfunc.c:362 #: ccdfunc.c:315
#, c-format #, c-format
msgid "File saved as '%s'" msgid "File saved as '%s'"
msgstr "æÁÊÌ ÓÏÈÒÁÎÅÎ ËÁË '%s'" msgstr "æÁÊÌ ÓÏÈÒÁÎÅÎ ËÁË '%s'"
#: ccdfunc.c:456 #: ccdfunc.c:409
msgid "Focuser device not pointed" msgid "Focuser device not pointed"
msgstr "õÓÔÒÏÊÓÔ×Ï ÆÏËÕÓÅÒÁ ÎÅ ÕËÁÚÁÎÏ" msgstr "õÓÔÒÏÊÓÔ×Ï ÆÏËÕÓÅÒÁ ÎÅ ÕËÁÚÁÎÏ"
#: ccdfunc.c:686 #: ccdfunc.c:639
#, c-format #, c-format
msgid "Found %d cameras, you point number %d" msgid "Found %d cameras, you point number %d"
msgstr "ïÂÎÁÒÕÖÅÎÏ %d ËÁÍÅÒ, ×Ù ÕËÁÚÁÌÉ %d" msgstr "ïÂÎÁÒÕÖÅÎÏ %d ËÁÍÅÒ, ×Ù ÕËÁÚÁÌÉ %d"
#: ccdfunc.c:494 #: ccdfunc.c:447
#, c-format #, c-format
msgid "Found %d focusers, you point number %d" msgid "Found %d focusers, you point number %d"
msgstr "ïÂÎÁÒÕÖÅÎÏ %d ÆÏËÕÓÅÒÏ×, ×Ù ÕËÁÚÁÌÉ %d" msgstr "ïÂÎÁÒÕÖÅÎÏ %d ÆÏËÕÓÅÒÏ×, ×Ù ÕËÁÚÁÌÉ %d"
#: ccdfunc.c:585 #: ccdfunc.c:538
#, c-format #, c-format
msgid "Found %d wheels, you point number %d" msgid "Found %d wheels, you point number %d"
msgstr "ïÂÎÁÒÕÖÅÎÏ %d ËÏÌÅÓ, ×Ù ÕËÁÚÁÌÉ %d" msgstr "ïÂÎÁÒÕÖÅÎÏ %d ËÏÌÅÓ, ×Ù ÕËÁÚÁÌÉ %d"
#: ccdfunc.c:709 #: ccdfunc.c:662
#, c-format #, c-format
msgid "Full array: %s" msgid "Full array: %s"
msgstr "ðÏÌÎÙÊ ÆÏÒÍÁÔ: %s" msgstr "ðÏÌÎÙÊ ÆÏÒÍÁÔ: %s"
@ -285,7 +265,7 @@ msgstr "
msgid "INET image socket port" msgid "INET image socket port"
msgstr "ÐÏÒÔ ÌÏËÁÌØÎÏÇÏ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ" msgstr "ÐÏÒÔ ÌÏËÁÌØÎÏÇÏ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ"
#: ccdfunc.c:448 #: ccdfunc.c:401
#, c-format #, c-format
msgid "Image stat:\n" msgid "Image stat:\n"
msgstr "óÔÁÔÉÓÔÉËÁ ÐÏ ÉÚÏÂÒÁÖÅÎÉÀ: \n" msgstr "óÔÁÔÉÓÔÉËÁ ÐÏ ÉÚÏÂÒÁÖÅÎÉÀ: \n"
@ -294,76 +274,76 @@ msgstr "
msgid "N flushes before exposing (default: 1)" msgid "N flushes before exposing (default: 1)"
msgstr "N ÚÁÓ×ÅÞÉ×ÁÎÉÊ ÐÅÒÅÄ ÜËÓÐÏÚÉÃÉÅÊ (ÐÏ ÕÍÏÌÞÁÎÉÀ: 1)" msgstr "N ÚÁÓ×ÅÞÉ×ÁÎÉÊ ÐÅÒÅÄ ÜËÓÐÏÚÉÃÉÅÊ (ÐÏ ÕÍÏÌÞÁÎÉÀ: 1)"
#: server.c:189 #: server.c:188
msgid "No camera device" msgid "No camera device"
msgstr "îÅ ÕËÁÚÁÎÏ ÕÓÔÒÏÊÓÔ×Ï ËÁÍÅÒÙ" msgstr "îÅ ÕËÁÚÁÎÏ ÕÓÔÒÏÊÓÔ×Ï ËÁÍÅÒÙ"
#: ccdfunc.c:655 ccdfunc.c:656 #: ccdfunc.c:608 ccdfunc.c:609
msgid "No cameras found" msgid "No cameras found"
msgstr "ëÁÍÅÒ ÎÅ ÏÂÎÁÒÕÖÅÎÏ" msgstr "ëÁÍÅÒ ÎÅ ÏÂÎÁÒÕÖÅÎÏ"
#: ccdfunc.c:463 #: ccdfunc.c:416
msgid "No focusers found" msgid "No focusers found"
msgstr "æÏËÕÓÅÒÏ× ÎÅ ÏÂÎÁÒÕÖÅÎÏ" msgstr "æÏËÕÓÅÒÏ× ÎÅ ÏÂÎÁÒÕÖÅÎÏ"
#: ccdfunc.c:554 #: ccdfunc.c:507
msgid "No wheels found" msgid "No wheels found"
msgstr "ôÕÒÅÌÅÊ ÎÅ ÏÂÎÁÒÕÖÅÎÏ" msgstr "ôÕÒÅÌÅÊ ÎÅ ÏÂÎÁÒÕÖÅÎÏ"
#: ccdfunc.c:797 #: ccdfunc.c:750
msgid "Only show statistics" msgid "Only show statistics"
msgstr "ôÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ" msgstr "ôÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ"
#: ccdfunc.c:703 #: ccdfunc.c:656
#, c-format #, c-format
msgid "Pixel size: %g x %g" msgid "Pixel size: %g x %g"
msgstr "òÁÚÍÅÒ ÐÉËÓÅÌÑ: %g x %g" msgstr "òÁÚÍÅÒ ÐÉËÓÅÌÑ: %g x %g"
#: ccdfunc.c:834 #: ccdfunc.c:787
msgid "Read grabbed image" msgid "Read grabbed image"
msgstr "óÞÉÔÙ×ÁÎÉÅ ÉÚÏÂÒÁÖÅÎÉÑ" msgstr "óÞÉÔÙ×ÁÎÉÅ ÉÚÏÂÒÁÖÅÎÉÑ"
#: ccdfunc.c:796 #: ccdfunc.c:749
#, c-format #, c-format
msgid "Readout mode: %s" msgid "Readout mode: %s"
msgstr "òÅÖÉÍ ÓÞÉÔÙ×ÁÎÉÑ: %s" msgstr "òÅÖÉÍ ÓÞÉÔÙ×ÁÎÉÑ: %s"
#: client.c:313 #: client.c:286
msgid "Server timeout" msgid "Server timeout"
msgstr "ôÁÊÍÁÕÔ ÓÅÒ×ÅÒÁ" msgstr "ôÁÊÍÁÕÔ ÓÅÒ×ÅÒÁ"
#: ccdfunc.c:760 #: ccdfunc.c:713
#, c-format #, c-format
msgid "Set brightness to %g" msgid "Set brightness to %g"
msgstr "õÓÔÁÎÏ×ÉÔØ ÑÒËÏÓÔØ × %g" msgstr "õÓÔÁÎÏ×ÉÔØ ÑÒËÏÓÔØ × %g"
#: ccdfunc.c:697 #: ccdfunc.c:650
#, c-format #, c-format
msgid "Set fan speed to %d" msgid "Set fan speed to %d"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ× × %d" msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ× × %d"
#: ccdfunc.c:754 #: ccdfunc.c:707
#, c-format #, c-format
msgid "Set gain to %g" msgid "Set gain to %g"
msgstr "õÓÔÁÎÏ×ÉÔØ Gain × %g" msgstr "õÓÔÁÎÏ×ÉÔØ Gain × %g"
#: ccdfunc.c:726 #: ccdfunc.c:679
#, c-format #, c-format
msgid "Shutter command: %s\n" msgid "Shutter command: %s\n"
msgstr "ëÏÍÁÎÄÁ ÚÁÔ×ÏÒÁ: %s\n" msgstr "ëÏÍÁÎÄÁ ÚÁÔ×ÏÒÁ: %s\n"
#: ccdfunc.c:923 #: ccdfunc.c:864
msgid "Some error when capture" msgid "Some error when capture"
msgstr "" msgstr ""
#. "Попытка Ñ<>конфигурироваÑÑŒ порт I/O как %d\n" #. "Попытка Ñ<>конфигурироваÑÑŒ порт I/O как %d\n"
#: ccdfunc.c:732 #: ccdfunc.c:685
#, c-format #, c-format
msgid "Try to configure I/O port as %d" msgid "Try to configure I/O port as %d"
msgstr "ðÏÐÙÔËÁ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ ÐÏÒÔ I/O ËÁË %d" msgstr "ðÏÐÙÔËÁ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ ÐÏÒÔ I/O ËÁË %d"
#. "Попытка запиÑ<C2B8>и %d в порт I/O\n" #. "Попытка запиÑ<C2B8>и %d в порт I/O\n"
#: ccdfunc.c:745 #: ccdfunc.c:698
#, c-format #, c-format
msgid "Try to write %d to I/O port" msgid "Try to write %d to I/O port"
msgstr "ðÏÐÙÔËÁ ÚÁÐÉÓÉ %d × ÐÏÒÔ I/O" msgstr "ðÏÐÙÔËÁ ÚÁÐÉÓÉ %d × ÐÏÒÔ I/O"
@ -373,15 +353,6 @@ msgstr "
msgid "UNIX socket name (command socket)" msgid "UNIX socket name (command socket)"
msgstr "éÍÑ UNIX-ÓÏËÅÔÁ" msgstr "éÍÑ UNIX-ÓÏËÅÔÁ"
#: ccdfunc.c:547
msgid "Wheel device not pointed"
msgstr "õÓÔÒÏÊÓÔ×Ï ÔÕÒÅÌÉ ÎÅ ÕËÁÚÁÎÏ"
#: ccdfunc.c:612
#, c-format
msgid "Wheel position should be from 0 to %d"
msgstr "ðÏÚÉÃÉÑ ËÏÌÅÓÁ ÄÏÌÖÎÁ ÂÙÔØ ÏÔ 0 ÄÏ %d"
#: cmdlnopts.c:76 #: cmdlnopts.c:76
msgid "absolute (not divided by binning!) frame X0 coordinate (-1 - all " msgid "absolute (not divided by binning!) frame X0 coordinate (-1 - all "
"with overscan)" "with overscan)"
@ -416,6 +387,16 @@ msgstr "
msgid "cancel current exposition" msgid "cancel current exposition"
msgstr "ÏÔÍÅÎÁ ÔÅËÕÝÅÊ ÜËÓÐÏÚÉÃÉÉ" msgstr "ÏÔÍÅÎÁ ÔÅËÕÝÅÊ ÜËÓÐÏÚÉÃÉÉ"
#: ccdfunc.c:500
#, fuzzy
msgid "cc_Wheel device not pointed"
msgstr "õÓÔÒÏÊÓÔ×Ï ÔÕÒÅÌÉ ÎÅ ÕËÁÚÁÎÏ"
#: ccdfunc.c:565
#, fuzzy, c-format
msgid "cc_Wheel position should be from 0 to %d"
msgstr "ðÏÚÉÃÉÑ ËÏÌÅÓÁ ÄÏÌÖÎÁ ÂÙÔØ ÏÔ 0 ÄÏ %d"
#: cmdlnopts.c:82 #: cmdlnopts.c:82
msgid "close shutter" msgid "close shutter"
msgstr "ÚÁËÒÙÔØ ÚÁÔ×ÏÒ" msgstr "ÚÁËÒÙÔØ ÚÁÔ×ÏÒ"
@ -447,7 +428,7 @@ msgid "focuser device plugin (e.g. devzwo.so)"
msgstr "ÐÌÁÇÉÎ ÆÏËÕÓÅÒÁ (ÎÁÐÒÉÍÅÒ, devzwo.so)" msgstr "ÐÌÁÇÉÎ ÆÏËÕÓÅÒÁ (ÎÁÐÒÉÍÅÒ, devzwo.so)"
#: cmdlnopts.c:108 #: cmdlnopts.c:108
msgid "force using image through socket transition even if can use SHM" msgid "force using image through socket transition even if can use SHM)"
msgstr "" msgstr ""
#: cmdlnopts.c:85 #: cmdlnopts.c:85
@ -585,7 +566,7 @@ msgid "set wheel position"
msgstr "ÕÓÔÁÎÏ×ÉÔØ ÐÏÌÏÖÅÎÉÅ ËÏÌÅÓÁ" msgstr "ÕÓÔÁÎÏ×ÉÔØ ÐÏÌÏÖÅÎÉÅ ËÏÌÅÓÁ"
#: cmdlnopts.c:107 #: cmdlnopts.c:107
msgid "shared memory (with image data) key (default: 7777777" msgid "shared memory (with image data) key (default: 7777777)"
msgstr "" msgstr ""
#: cmdlnopts.c:50 #: cmdlnopts.c:50
@ -612,6 +593,22 @@ msgstr "
msgid "wheel device plugin (e.g. devdummy.so)" msgid "wheel device plugin (e.g. devdummy.so)"
msgstr "ÐÌÁÇÉÎ ÕÓÔÒÏÊÓÔ×Á ÔÕÒÅÌÉ (ÎÁÐÒÉÍÅÒ, devdummy.so)" msgstr "ÐÌÁÇÉÎ ÕÓÔÒÏÊÓÔ×Á ÔÕÒÅÌÉ (ÎÁÐÒÉÍÅÒ, devdummy.so)"
#, c-format
#~ msgid "Can't find camera in plugin %s: %s"
#~ msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ËÁÍÅÒÙ %s: %s"
#, c-format
#~ msgid "Can't find focuser in plugin %s: %s"
#~ msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ÆÏËÕÓÅÒÁ %s: %s"
#, c-format
#~ msgid "Can't find plugin %s: %s"
#~ msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ %s: %s"
#, c-format
#~ msgid "Can't find wheel in plugin %s: %s"
#~ msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ÔÕÒÅÌÉ %s: %s"
#~ msgid "Neither filename nor filename prefix pointed!" #~ msgid "Neither filename nor filename prefix pointed!"
#~ msgstr "îÉ ÉÍÑ ÆÁÊÌÁ, ÎÉ ÐÒÅÆÉËÓ ÎÅ ÕËÁÚÁÎÙ!" #~ msgstr "îÉ ÉÍÑ ÆÁÊÌÁ, ÎÉ ÐÒÅÆÉËÓ ÎÅ ÕËÁÚÁÎÙ!"

586
locale/ru/ru.po.bkp Normal file
View File

@ -0,0 +1,586 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-04-18 16:50+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=koi8-r\n"
"Content-Transfer-Encoding: 8bit\n"
#: ccdfunc.c:570
#, c-format
msgid "%.1f seconds till exposition ends"
msgstr "%.1f ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÜËÓÐÏÚÉÃÉÉ"
#. %d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n
#: ccdfunc.c:805 client.c:260
#, c-format
msgid "%d seconds till pause ends\n"
msgstr "%d ÓÅËÕÎÄ ÄÏ ÏËÏÎÞÁÎÉÑ ÐÁÕÚÙ\n"
#: imageview.c:282
msgid "Already initialized!"
msgstr "õÖÅ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÎÏ!"
#: cmdlnopts.c:97
msgid "CMOS brightness level"
msgstr "ÕÒÏ×ÅÎØ ÑÒËÏÓÔÉ CMOS"
#: cmdlnopts.c:96
msgid "CMOS gain level"
msgstr "ÕÒÏ×ÅÎØ Gain CMOS"
#: ccdfunc.c:584
msgid "Camera device not pointed"
msgstr "õÓÔÒÏÊÓÔ×Ï Ó×ÅÏÐÒÉÅÍÎÉËÁ ÎÅ ÐÏÄËÌÀÞÅÎÏ"
#: ccdfunc.c:155
msgid "Camera device unknown"
msgstr "õÓÔÒÏÊÓÔ×Ï Ó×ÅÏÐÒÉÅÍÎÉËÁ ÎÅ ÏÐÏÚÎÁÎÏ"
#: ccdfunc.c:643
#, c-format
msgid "Camera model: %s"
msgstr "íÏÄÅÌØ Ó×ÅÔÏÐÒÉÅÍÎÉËÁ: %s"
#: ccdfunc.c:762 ccdfunc.c:784 ccdfunc.c:825
msgid "Can't capture image"
msgstr "îÅ ÍÏÇÕ ÚÁÈ×ÁÔÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ"
#: ccdfunc.c:726
msgid "Can't change frame type"
msgstr "îÅ ÍÏÇÕ ÉÚÍÅÎÉÔØ ÔÉÐ ËÁÄÒÁ"
#: ccdfunc.c:671
msgid "Can't configure (unsupported?)"
msgstr "îÅ ÍÏÇÕ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ (ÏÐÃÉÑ ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)"
#: ccdfunc.c:86
#, c-format
msgid "Can't find camera in plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ËÁÍÅÒÙ %s: %s"
#: ccdfunc.c:75
#, c-format
msgid "Can't find focuser in plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ÆÏËÕÓÅÒÁ %s: %s"
#: ccdfunc.c:63
#, c-format
msgid "Can't find plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ %s: %s"
#: ccdfunc.c:97
#, c-format
msgid "Can't find wheel in plugin %s: %s"
msgstr "îÅ ÍÏÇÕ ÎÁÊÔÉ ÐÌÁÇÉÎ ÔÕÒÅÌÉ %s: %s"
#: ccdfunc.c:677
msgid "Can't get IOport state (unsupported?)"
msgstr "îÅ ÍÏÇÕ ÐÏÌÕÞÉÔØ ÓÏÓÔÏÑÎÉÅ ÐÏÒÔÁ I/O (ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)"
#. GET binning should be AFTER setgeometry!
#: ccdfunc.c:735
msgid "Can't get current binning"
msgstr "îÅ ÍÏÇÕ ÐÏÌÕÞÉÔØ ÔÅËÕÝÅÅ ÚÎÁÞÅÎÉÅ ÂÉÎÎÉÎÇÁ"
#: ccdfunc.c:455
msgid "Can't get current focuser position"
msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÔÅËÕÝÕÀ ÐÏÚÉÃÉÀ ÆÏËÕÓÅÒÁ"
#: ccdfunc.c:448
msgid "Can't get focuser limit positions"
msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÐÒÅÄÅÌØÎÕÀ ÐÏÚÉÃÉÀ ÆÏËÕÓÅÒÁ"
#: ccdfunc.c:542
msgid "Can't get max wheel position"
msgstr "îÅ ÍÏÇÕ ÏÐÒÅÄÅÌÉÔØ ÐÒÅÄÅÌØÎÕÀ ÐÏÚÉÃÉÀ ËÏÌÅÓÁ"
#: ccdfunc.c:768 ccdfunc.c:788 ccdfunc.c:829
msgid "Can't grab image"
msgstr "îÅ ÍÏÇÕ ÚÁÈ×ÁÔÉÔØ ÉÚÏÂÒÁÖÅÎÉÅ"
#: ccdfunc.c:473
msgid "Can't home focuser"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÆÏËÕÓÅÒ × ÎÕÌØ"
#: imageview.c:264
msgid "Can't init mutex!"
msgstr "îÅ ÍÏÇÕ ÉÎÉÃÉÁÌÉÚÉÒÏ×ÁÔØ ÍØÀÔÅËÓ!"
#: client.c:247
msgid "Can't make exposition"
msgstr "îÅ ÍÏÇÕ ×ÙÐÏÌÎÉÔØ ÜËÓÐÏÚÉÃÉÀ"
#: ccdfunc.c:748
msgid "Can't open OpenGL window, image preview will be inaccessible"
msgstr "îÅ ÍÏÇÕ ÏÔËÒÙÔØ ÏËÎÏ OpenGL, ÏÔÏÂÒÁÖÅÎÉÅ ÂÕÄÅÔ ÎÅÄÏÓÔÕÐÎÏ"
#: ccdfunc.c:665
#, c-format
msgid "Can't run shutter command %s (unsupported?)"
msgstr "îÅ ÍÏÇÕ ×ÙÐÏÌÎÉÔØ ËÏÍÁÎÄÕ ÚÁÔ×ÏÒÁ %s (ÎÅ ÐÏÄÄÅÒÖÉ×ÁÅÔÓÑ?)"
#. îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ
#: ccdfunc.c:180
#, c-format
msgid "Can't save file with prefix %s"
msgstr "îÅ ÍÏÇÕ ÓÏÈÒÁÎÉÔØ ÆÁÊÌ Ó ÐÒÅÆÉËÓÏÍ %s"
#: ccdfunc.c:719
#, c-format
msgid "Can't set %d flushes"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ %d ÓÂÒÏÓÏ×"
#: ccdfunc.c:683
msgid "Can't set IOport"
msgstr "îÅ ÍÏÇÕ ÐÏÍÅÎÑÔØ ÚÎÁÞÅÎÉÑ ÐÏÒÔÁ I/O"
#: ccdfunc.c:656
#, c-format
msgid "Can't set T to %g degC"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ × %g ÇÒÁÄã"
#: ccdfunc.c:631
msgid "Can't set active camera number"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÊ ËÁÍÅÒÙ"
#: ccdfunc.c:434
msgid "Can't set active focuser number"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÇÏ ÆÏËÕÓÅÒÁ"
#: ccdfunc.c:526
msgid "Can't set active wheel number"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÎÏÍÅÒ ÁËÔÉ×ÎÏÇÏ ËÏÌÅÓÁ"
#: ccdfunc.c:705 server.c:223
#, c-format
msgid "Can't set binning %dx%d"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÂÉÎÎÉÎÇ %dx%d"
#: ccdfunc.c:729
msgid "Can't set bit depth"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÒÁÚÒÑÄÎÏÓÔØ áãð"
#: ccdfunc.c:697
#, c-format
msgid "Can't set brightness to %g"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÑÒËÏÓÔØ × %g"
#: ccdfunc.c:723
#, c-format
msgid "Can't set exposure time to %f seconds"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÜËÓÐÏÚÉÃÉÀ × %f ÓÅËÕÎÄ"
#: ccdfunc.c:637
msgid "Can't set fan speed"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ×"
#: ccdfunc.c:691
#, c-format
msgid "Can't set gain to %g"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ Gain × %g"
#: ccdfunc.c:715 server.c:224
msgid "Can't set given geometry"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÇÅÏÍÅÔÒÉÀ"
#: ccdfunc.c:475
#, c-format
msgid "Can't set position %g"
msgstr "îÅ ÍÏÇÕ ÉÚÍÅÎÉÔØ ÐÏÚÉÃÉÀ ÎÁ %g"
#: ccdfunc.c:469
#, c-format
msgid "Can't set position %g: out of limits [%g, %g]"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÏÚÉÃÉÀ %g: ×ÎÅ ÐÒÅÄÅÌÏ× [%g, %g]"
#: ccdfunc.c:731
msgid "Can't set readout speed"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ÓÞÉÔÙ×ÁÎÉÑ"
#: ccdfunc.c:553
#, c-format
msgid "Can't set wheel position %d"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÐÏÌÏÖÅÎÉÅ ËÏÌÅÓÁ %d"
#: ccdfunc.c:758 server.c:121
msgid "Can't start exposition"
msgstr "îÅ ÍÏÇÕ ÎÁÞÁÔØ ÜËÓÐÏÚÉÃÉÀ"
#. úÁÈ×ÁÔ ËÁÄÒÁ %d\n
#: ccdfunc.c:756
#, c-format
msgid "Capture frame %d"
msgstr "úÁÈ×ÁÔ ËÁÄÒÁ %d"
#: cmdlnopts.c:107
msgid "Display image in OpenGL window"
msgstr "ïÔÏÂÒÁÖÅÎÉÅ ÉÚÏÂÒÁÖÅÎÉÑ × ÏËÎÅ OpenGL"
#: imageview.c:517
#, c-format
msgid "Equalization of histogram: %s"
msgstr "üË×ÁÌÉÚÁÃÉÑ ÇÉÓÔÏÇÒÁÍÍÙ: %s"
#: ccdfunc.c:343
msgid "Error saving file"
msgstr "ïÛÉÂËÁ ÓÏÈÒÁÎÅÎÉÑ ÆÁÊÌÁ"
#: ccdfunc.c:653
#, c-format
msgid "Field of view: %s"
msgstr "ðÏÌÅ ÚÒÅÎÉÑ: %s"
#: ccdfunc.c:334
#, c-format
msgid "File saved as '%s'"
msgstr "æÁÊÌ ÓÏÈÒÁÎÅÎ ËÁË '%s'"
#: ccdfunc.c:391
msgid "Focuser device not pointed"
msgstr "õÓÔÒÏÊÓÔ×Ï ÆÏËÕÓÅÒÁ ÎÅ ÕËÁÚÁÎÏ"
#: ccdfunc.c:627
#, c-format
msgid "Found %d cameras, you point number %d"
msgstr "ïÂÎÁÒÕÖÅÎÏ %d ËÁÍÅÒ, ×Ù ÕËÁÚÁÌÉ %d"
#: ccdfunc.c:430
#, c-format
msgid "Found %d focusers, you point number %d"
msgstr "ïÂÎÁÒÕÖÅÎÏ %d ÆÏËÕÓÅÒÏ×, ×Ù ÕËÁÚÁÌÉ %d"
#: ccdfunc.c:522
#, c-format
msgid "Found %d wheels, you point number %d"
msgstr "ïÂÎÁÒÕÖÅÎÏ %d ËÏÌÅÓ, ×Ù ÕËÁÚÁÌÉ %d"
#: ccdfunc.c:650
#, c-format
msgid "Full array: %s"
msgstr "ðÏÌÎÙÊ ÆÏÒÍÁÔ: %s"
#: imageview.c:408
#, c-format
msgid "Histogram conversion: %s"
msgstr "ðÒÅÏÂÒÁÚÏ×ÁÎÉÅ ÇÉÓÔÏÇÒÁÍÍÙ: %s"
#: ccdfunc.c:383
#, c-format
msgid "Image stat:\n"
msgstr "óÔÁÔÉÓÔÉËÁ ÐÏ ÉÚÏÂÒÁÖÅÎÉÀ: \n"
#: cmdlnopts.c:69
msgid "N flushes before exposing (default: 1)"
msgstr "N ÚÁÓ×ÅÞÉ×ÁÎÉÊ ÐÅÒÅÄ ÜËÓÐÏÚÉÃÉÅÊ (ÐÏ ÕÍÏÌÞÁÎÉÀ: 1)"
#: ccdfunc.c:161
msgid "Neither filename nor filename prefix pointed!"
msgstr "îÉ ÉÍÑ ÆÁÊÌÁ, ÎÉ ÐÒÅÆÉËÓ ÎÅ ÕËÁÚÁÎÙ!"
#: server.c:163
msgid "No camera device"
msgstr "îÅ ÕËÁÚÁÎÏ ÕÓÔÒÏÊÓÔ×Ï ËÁÍÅÒÙ"
#: ccdfunc.c:591 ccdfunc.c:592
msgid "No cameras found"
msgstr "ëÁÍÅÒ ÎÅ ÏÂÎÁÒÕÖÅÎÏ"
#: ccdfunc.c:398
msgid "No focusers found"
msgstr "æÏËÕÓÅÒÏ× ÎÅ ÏÂÎÁÒÕÖÅÎÏ"
#: ccdfunc.c:490
msgid "No wheels found"
msgstr "ôÕÒÅÌÅÊ ÎÅ ÏÂÎÁÒÕÖÅÎÏ"
#: ccdfunc.c:733
msgid "Only show statistics"
msgstr "ôÏÌØËÏ ÏÔÏÂÒÁÚÉÔØ ÓÔÁÔÉÓÔÉËÕ"
#: cmdlnopts.c:103
msgid "PID file (default: "
msgstr "PID-ÆÁÊÌ (ÐÏ ÕÍÏÌÞÁÎÉÀ: "
#: ccdfunc.c:644
#, c-format
msgid "Pixel size: %g x %g"
msgstr "òÁÚÍÅÒ ÐÉËÓÅÌÑ: %g x %g"
#: ccdfunc.c:765
msgid "Read grabbed image"
msgstr "óÞÉÔÙ×ÁÎÉÅ ÉÚÏÂÒÁÖÅÎÉÑ"
#: ccdfunc.c:732
#, c-format
msgid "Readout mode: %s"
msgstr "òÅÖÉÍ ÓÞÉÔÙ×ÁÎÉÑ: %s"
#: client.c:276
msgid "Server timeout"
msgstr "ôÁÊÍÁÕÔ ÓÅÒ×ÅÒÁ"
#: ccdfunc.c:696
#, c-format
msgid "Set brightness to %g"
msgstr "õÓÔÁÎÏ×ÉÔØ ÑÒËÏÓÔØ × %g"
#: ccdfunc.c:638
#, c-format
msgid "Set fan speed to %d"
msgstr "îÅ ÍÏÇÕ ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÏ× × %d"
#: ccdfunc.c:690
#, c-format
msgid "Set gain to %g"
msgstr "õÓÔÁÎÏ×ÉÔØ Gain × %g"
#: ccdfunc.c:663
#, c-format
msgid "Shutter command: %s\n"
msgstr "ëÏÍÁÎÄÁ ÚÁÔ×ÏÒÁ: %s\n"
#. "ðÏÐÙÔËÁ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ ÐÏÒÔ I/O ËÁË %d\n"
#: ccdfunc.c:669
#, c-format
msgid "Try to configure I/O port as %d"
msgstr "ðÏÐÙÔËÁ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ ÐÏÒÔ I/O ËÁË %d"
#. "ðÏÐÙÔËÁ ÚÁÐÉÓÉ %d × ÐÏÒÔ I/O\n"
#: ccdfunc.c:681
#, c-format
msgid "Try to write %d to I/O port"
msgstr "ðÏÐÙÔËÁ ÚÁÐÉÓÉ %d × ÐÏÒÔ I/O"
#: cmdlnopts.c:100
msgid "UNIX socket name"
msgstr "éÍÑ UNIX-ÓÏËÅÔÁ"
#: ccdfunc.c:483
msgid "Wheel device not pointed"
msgstr "õÓÔÒÏÊÓÔ×Ï ÔÕÒÅÌÉ ÎÅ ÕËÁÚÁÎÏ"
#: ccdfunc.c:549
#, c-format
msgid "Wheel position should be from 0 to %d"
msgstr "ðÏÚÉÃÉÑ ËÏÌÅÓÁ ÄÏÌÖÎÁ ÂÙÔØ ÏÔ 0 ÄÏ %d"
#: cmdlnopts.c:76
msgid "absolute (not divided by binning!) frame X0 coordinate (-1 - all "
"with overscan)"
msgstr "ÁÂÓÏÌÀÔÎÁÑ (ÎÅ ÄÅÌÅÎÎÁÑ ÎÁ ÂÉÎÎÉÎÇ!) ËÏÏÒÄÉÎÁÔÁ X0 (-1 - ×ËÌÀÞÁÑ Ï×ÅÒÓËÁÎ)"
#: cmdlnopts.c:78
msgid "absolute frame X1 coordinate (-1 - all with overscan)"
msgstr "ÁÂÓÏÌÀÔÎÁÑ ËÏÏÒÄÉÎÁÔÁ X1 (-1 - ×ËÌÀÞÁÑ Ï×ÅÒÓËÁÎ)"
#: cmdlnopts.c:77
msgid "absolute frame Y0 coordinate (-1 - all with overscan)"
msgstr "ÁÂÓÏÌÀÔÎÁÑ ËÏÏÒÄÉÎÁÔÁ Y0 (-1 - ×ËÌÀÞÁÑ Ï×ÅÒÓËÁÎ)"
#: cmdlnopts.c:79
msgid "absolute frame Y1 coordinate (-1 - all with overscan)"
msgstr "ÁÂÓÏÌÀÔÎÁÑ ËÏÏÒÄÉÎÁÔÁ Y1 (-1 - ×ËÌÀÞÁÑ Ï×ÅÒÓËÁÎ)"
#: cmdlnopts.c:65
msgid "add records to header from given file[s]"
msgstr "ÄÏÂÁ×ÉÔØ ÚÁÐÉÓÉ Ë ÛÁÐËÅ FITS-ÆÁÊÌÁ ÉÚ ÚÁÄÁÎÎÙÈ ÆÁÊÌÏ×"
#: cmdlnopts.c:47
msgid "camera device number (if many: 0, 1, 2 etc)"
msgstr "ÎÏÍÅÒ ÕÓÔÒÏÊÓÔ×Á ËÁÍÅÒÙ"
#: cmdlnopts.c:43
msgid "camera device plugin (e.g. devfli.so)"
msgstr "ÐÌÁÇÉÎ ËÁÍÅÒÙ (ÎÁÐÒÉÍÅÒ, devfli.so)"
#: cmdlnopts.c:75
msgid "cancel current exposition"
msgstr "ÏÔÍÅÎÁ ÔÅËÕÝÅÊ ÜËÓÐÏÚÉÃÉÉ"
#: cmdlnopts.c:82
msgid "close shutter"
msgstr "ÚÁËÒÙÔØ ÚÁÔ×ÏÒ"
#: cmdlnopts.c:42
msgid "common device plugin (e.g devfli.so)"
msgstr "ÏÂÝÉÊ ÐÌÁÇÉÎ ÄÌÑ ×ÓÅÈ ÕÓÔÒÏÊÓÔ× (ÎÁÐÒÉÍÅÒ, devfli.so)"
#: cmdlnopts.c:89
msgid "configure I/O port pins to given value (decimal number, pin1 is LSB, "
"1 == output, 0 == input)"
msgstr "ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ ÐÏÒÔ I/O × ÚÁÄÁÎÎÏÅ ÓÏÓÔÏÑÎÉÅ (ÄÅÓÑÔÉÞÎÏÅ ÞÉÓÌÏ, pin1 - ÍÌÁÄÛÉÊ ÂÉÔ, 1 - ×ÙÈÏÄ, 0 - ×ÈÏÄ)"
#: cmdlnopts.c:55
msgid "fast readout mode"
msgstr "ÂÙÓÔÒÙÊ ÒÅÖÉÍ ÓÞÉÔÙ×ÁÎÉÑ"
#: cmdlnopts.c:48
msgid "filter wheel device number (if many: 0, 1, 2 etc)"
msgstr "ÎÏÍÅÒ ÕÓÔÒÏÊÓÔ×Á ÔÕÒÅÌÉ"
#: cmdlnopts.c:49
msgid "focuser device number (if many: 0, 1, 2 etc)"
msgstr "ÎÏÍÅÒ ÕÓÔÒÏÊÓÔ×Á ÆÏËÕÓÅÒÁ"
#: cmdlnopts.c:44
msgid "focuser device plugin (e.g. devzwo.so)"
msgstr "ÐÌÁÇÉÎ ÆÏËÕÓÅÒÁ (ÎÁÐÒÉÍÅÒ, devzwo.so)"
#: cmdlnopts.c:85
msgid "get value of I/O port pins"
msgstr "ÐÏÌÕÞÉÔØ ÚÎÁÞÅÎÉÅ ÐÏÒÔÁ I/O"
#: cmdlnopts.c:70
msgid "horizontal binning to N pixels"
msgstr "ÇÏÒÉÚÏÎÔÁÌØÎÙÊ ÂÉÎÎÉÎÇ × N ÐÉËÓÅÌÅÊ"
#: cmdlnopts.c:61
msgid "instrument name"
msgstr "ÎÁÚ×ÁÎÉÅ ÐÒÉÂÏÒÁ"
#: cmdlnopts.c:46
msgid "list connected devices"
msgstr "ÓÐÉÓÏË ÐÏÄËÌÀÞÅÎÎÙÈ ÕÓÔÒÏÊÓÔ×"
#: cmdlnopts.c:101
msgid "local INET socket port"
msgstr "ÐÏÒÔ ÌÏËÁÌØÎÏÇÏ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ"
#: cmdlnopts.c:99
msgid "logging file name (if run as server)"
msgstr "ÉÍÑ ÆÁÊÌÁ ÌÏÇÇÉÒÏ×ÁÎÉÑ (ÅÓÌÉ ÚÁÐÕÝÅÎ ÓÅÒ×ÅÒ)"
#: cmdlnopts.c:73
msgid "make pause for N seconds between expositions"
msgstr "ÐÁÕÚÁ × N ÓÅËÕÎÄ ÍÅÖÄÕ ÜËÓÐÏÚÉÃÉÑÍÉ"
#: cmdlnopts.c:72
msgid "make series of N frames"
msgstr "ÐÏÓÌÅÄÏ×ÁÔÅÌØÎÏÓÔØ ÉÚ N ËÁÄÒÏ×"
#: cmdlnopts.c:91
msgid "move focuser to absolute position, mm"
msgstr "ÐÅÒÅÍÅÓÔÉÔØ ÆÏËÕÓÅÒ × ÁÂÓÏÌÀÔÎÏÅ ÐÏÌÏÖÅÎÉÅ, ÍÍ"
#: cmdlnopts.c:92
msgid "move focuser to relative position, mm (only for standalone)"
msgstr "ÐÅÒÅÍÅÓÔÉÔØ ÆÏËÕÓÅÒ × ÏÔÎÏÓÉÔÅÌØÎÏÅ ÐÏÌÏÖÅÎÉÅ, ÍÍ (ÎÅ ÄÌÑ ÓÅÒ×ÅÒ/ËÌÉÅÎÔ)"
#: cmdlnopts.c:86
msgid "move stepper motor asynchronous"
msgstr "ÁÓÉÎÈÒÏÎÎÏÅ Ä×ÉÖÅÎÉÅ ÛÁÇÏ×ÏÇÏ Ä×ÉÇÁÔÅÌÑ"
#: cmdlnopts.c:53
msgid "not open shutter, when exposing (\"dark frames\")"
msgstr "ÎÅ ÏÔËÒÙ×ÁÔØ ÚÁÔ×ÏÒ ÐÒÉ ÜËÓÐÏÚÉÃÉÉ (\"ÔÅÍÎÏ×ÙÅ\")"
#: cmdlnopts.c:62
msgid "object name"
msgstr "ÎÁÚ×ÁÎÉÅ ÏÂßÅËÔÁ"
#: cmdlnopts.c:60
msgid "object type (neon, object, flat etc)"
msgstr "ÔÉÐ ÏÂßÅËÔÁ (neon, object, flat É Ô.Ä.)"
#: cmdlnopts.c:63
msgid "observers' names"
msgstr "ÉÍÅÎÁ ÎÁÂÌÀÄÁÔÅÌÅÊ"
#: cmdlnopts.c:64
msgid "observing program name"
msgstr "ÎÁÚ×ÁÎÉÅ ÐÒÏÇÒÁÍÍÙ"
#: imageview.c:517
msgid "off"
msgstr "×ÙËÌ"
#: imageview.c:517
msgid "on"
msgstr "×ËÌ"
#: cmdlnopts.c:81
msgid "open shutter"
msgstr "ÏÔËÒÙÔØ ÚÁÔ×ÏÒ"
#: cmdlnopts.c:66
msgid "output file name"
msgstr "ÉÍÑ ÆÁÊÌÁ"
#: cmdlnopts.c:59
msgid "program author"
msgstr "Á×ÔÏÒ ÐÒÏÇÒÁÍÍÙ"
#: cmdlnopts.c:104
msgid "restart image server"
msgstr "ÐÅÒÅÚÁÐÕÓË ÓÅÒ×ÅÒÁ"
#: cmdlnopts.c:51
msgid "rewrite output file if exists"
msgstr "ÐÅÒÅÚÁÐÉÓØ ×ÙÈÏÄÎÏÇÏ ÆÁÊÌÁ"
#: cmdlnopts.c:102
msgid "run as client"
msgstr "ÚÁÐÕÓÔÉÔØ ËÌÉÅÎÔ"
#: cmdlnopts.c:84
msgid "run exposition on HIGH @ pin5 I/O port"
msgstr ""
#: cmdlnopts.c:83
msgid "run exposition on LOW @ pin5 I/O port"
msgstr ""
#: cmdlnopts.c:54
msgid "run in 8-bit mode"
msgstr "8-ÂÉÔÎÙÊ ÒÅÖÉÍ"
#: cmdlnopts.c:56
msgid "set CCD temperature to given value (degr C)"
msgstr "ÕÓÔÁÎÏ×ÉÔØ ÔÅÍÐÅÒÁÔÕÒÕ Ó×ÅÔÏÐÒÉÅÍÎÉËÁ (ÇÒÁÄã)"
#: cmdlnopts.c:88
msgid "set I/O port pins to given value (decimal number, pin1 is LSB)"
msgstr "ÕÓÔÁÎÏ×ÉÔØ ÐÏÒÔ I/O (ÄÅÓÑÔÉÞÎÏÅ ÞÉÓÌÏ, pin1 - ÍÌÁÄÛÉÊ ÂÉÔ)"
#: cmdlnopts.c:74
msgid "set exposure time to given value (seconds!)"
msgstr "ÕÓÔÁÎÏ×ÉÔØ ×ÒÅÍÑ ÜËÓÐÏÚÉÃÉÉ (ÓÅËÕÎÄÙ!)"
#: cmdlnopts.c:57
msgid "set fan speed (0 - off, 1 - low, 2 - high)"
msgstr "ÕÓÔÁÎÏ×ÉÔØ ÓËÏÒÏÓÔØ ×ÅÎÔÉÌÑÔÏÒÁ (0 - ×ÙËÌ, 1 - ÎÉÚËÁÑ, 2 - ×ÙÓÏËÁÑ)"
#: cmdlnopts.c:94
msgid "set wheel position"
msgstr "ÕÓÔÁÎÏ×ÉÔØ ÐÏÌÏÖÅÎÉÅ ËÏÌÅÓÁ"
#: cmdlnopts.c:50
msgid "show this help"
msgstr "ÏÔÏÂÒÁÚÉÔØ ÜÔÕ ÓÐÒÁ×ËÕ"
#: cmdlnopts.c:52
msgid "verbose level (-V - messages, -VV - debug, -VVV - all shit)"
msgstr "ÕÒÏ×ÅÎØ ÂÏÌÔÌÉ×ÏÓÔÉ (-V - ÓÏÏÂÝÅÎÉÑ, -VV - ÏÔÌÁÄËÁ, -VVV - ×ÓÅ)"
#: cmdlnopts.c:71
msgid "vertical binning to N pixels"
msgstr "×ÅÒÔÉËÁÌØÎÙÊ ÂÉÎÎÉÎÇ × N ÐÉËÓÅÌÅÊ"
#: cmdlnopts.c:67
msgid "wait while exposition ends"
msgstr "ÖÄÁÔØ, ÐÏËÁ ÎÅ ËÏÎÞÉÔÓÑ ÜËÓÐÏÚÉÃÉÑ"
#: cmdlnopts.c:45
msgid "wheel device plugin (e.g. devdummy.so)"
msgstr "ÐÌÁÇÉÎ ÕÓÔÒÏÊÓÔ×Á ÔÕÒÅÌÉ (ÎÁÐÒÉÍÅÒ, devdummy.so)"

4
main.c
View File

@ -71,7 +71,7 @@ void signals(int signo){
int main(int argc, char **argv){ int main(int argc, char **argv){
initial_setup(); initial_setup();
#if defined GETTEXT_PACKAGE && defined LOCALEDIR #if defined GETTEXT_PACKAGE && defined LOCALEDIR
printf("GETTEXT_PACKAGE=" GETTEXT_PACKAGE ", LOCALEDIR=" LOCALEDIR "\n"); //printf("GETTEXT_PACKAGE=" GETTEXT_PACKAGE ", LOCALEDIR=" LOCALEDIR "\n");
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
textdomain(GETTEXT_PACKAGE); textdomain(GETTEXT_PACKAGE);
#endif #endif
@ -97,7 +97,7 @@ int main(int argc, char **argv){
return 1; return 1;
} }
int port = atoi(GP->port); int port = atoi(GP->port);
if(port < PORTN_MIN || port > PORTN_MAX){ if(port < CC_PORTN_MIN || port > CC_PORTN_MAX){
WARNX("Wrong port value: %d", port); WARNX("Wrong port value: %d", port);
return 1; return 1;
} }

608
server.c

File diff suppressed because it is too large Load Diff

View File

@ -18,13 +18,6 @@
#pragma once #pragma once
typedef enum{
CAMERA_IDLE, // idle state, client send this to cancel capture
CAMERA_CAPTURE, // capturing frame, client send this to start capture
CAMERA_FRAMERDY, // frame ready to be saved
CAMERA_ERROR // can't do exposition
} camera_state;
// pause (seconds) between temperature logging // pause (seconds) between temperature logging
#define TLOG_PAUSE 60. #define TLOG_PAUSE 60.
@ -32,60 +25,3 @@ typedef enum{
void server(int fd, int imsock); void server(int fd, int imsock);
char *makeabspath(const char *path, int shouldbe); char *makeabspath(const char *path, int shouldbe);
// common information about everything
#define CMD_INFO "info"
#define CMD_HELP "help"
// restart server
#define CMD_RESTART "restartTheServer"
// get image size in pixels
#define CMD_IMWIDTH "imwidth"
#define CMD_IMHEIGHT "imheight"
// get shared memory key
#define CMD_SHMEMKEY "shmemkey"
// CCD/CMOS
#define CMD_CAMLIST "camlist"
#define CMD_CAMDEVNO "camdevno"
#define CMD_EXPOSITION "exptime"
#define CMD_LASTFNAME "lastfilename"
#define CMD_FILENAME "filename"
#define CMD_FILENAMEPREFIX "filenameprefix"
// rewrite=1 will rewrite files, =0 - not (only for `filename`)
#define CMD_REWRITE "rewrite"
#define CMD_HBIN "hbin"
#define CMD_VBIN "vbin"
#define CMD_CAMTEMPER "tcold"
#define CMD_CAMFANSPD "ccdfanspeed"
#define CMD_SHUTTER "shutter"
#define CMD_CONFIO "confio"
#define CMD_IO "io"
#define CMD_GAIN "gain"
#define CMD_BRIGHTNESS "brightness"
#define CMD_FRAMEFORMAT "format"
#define CMD_FRAMEMAX "maxformat"
#define CMD_NFLUSHES "nflushes"
// expstate=CAMERA_CAPTURE will start exposition, CAMERA_IDLE - cancel
#define CMD_EXPSTATE "expstate"
#define CMD_TREMAIN "tremain"
#define CMD_8BIT "8bit"
#define CMD_FASTSPD "fastspeed"
#define CMD_DARK "dark"
#define CMD_INFTY "infty"
// FITS file keywords
#define CMD_AUTHOR "author"
#define CMD_INSTRUMENT "instrument"
#define CMD_OBSERVER "observer"
#define CMD_OBJECT "object"
#define CMD_PROGRAM "program"
#define CMD_OBJTYPE "objtype"
#define CMD_HEADERFILES "headerfiles"
// focuser
#define CMD_FOCLIST "foclist"
#define CMD_FDEVNO "focdevno"
#define CMD_FGOTO "focpos"
// wheel
#define CMD_WLIST "wlist"
#define CMD_WDEVNO "wdevno"
#define CMD_WPOS "wpos"

View File

@ -23,61 +23,14 @@
#include <sys/shm.h> #include <sys/shm.h>
#include <usefull_macros.h> #include <usefull_macros.h>
#include "basestructs.h" #include "ccdcapture.h"
// max & min TCP socket port number
#define PORTN_MAX (65535)
#define PORTN_MIN (1024)
#define BUFLEN (1024)
// Max amount of connections
#define MAXCLIENTS (30)
// wait for mutex locking
#define BUSY_TIMEOUT (1.0)
// waiting for answer timeout
#define ANSWER_TIMEOUT (0.01)
// wait for exposition ends (between subsequent check calls)
#define WAIT_TIMEOUT (2.0)
// client will disconnect after this time from last server message
#define CLIENT_TIMEOUT (3.0)
#ifdef EBUG #ifdef EBUG
extern double __t0; extern double __t0;
#define TIMEINIT() do{__t0 = dtime();}while(0) #define TIMEINIT() do{__t0 = dtime();}while(0)
#define TIMESTAMP(...) do{DBG(__VA_ARGS__); fprintf(stderr, COLOR_GREEN "%g" COLOR_OLD "\n", dtime()-__t0);}while(0) #define TIMESTAMP(...) do{DBG(__VA_ARGS__); green("%g\n", dtime()-__t0); fflush(stdout);}while(0)
#else #else
#define TIMEINIT() #define TIMEINIT()
#define TIMESTAMP(...) #define TIMESTAMP(...)
#endif #endif
typedef enum{
RESULT_OK, // 0: all OK
RESULT_BUSY, // 1: camera busy and no setters can be done
RESULT_FAIL, // 2: failed running command
RESULT_BADVAL, // 3: bad key's value
RESULT_BADKEY, // 4: bad key
RESULT_SILENCE, // 5: send nothing to client
RESULT_DISCONNECTED,// 6: client disconnected
RESULT_NUM
} hresult;
const char *hresult2str(hresult r);
// fd - socket fd to send private messages, key, val - key and its value
typedef hresult (*mesghandler)(int fd, const char *key, const char *val);
typedef struct{
hresult (*chkfunction)(char *val); // function to check device is ready
mesghandler handler; // handler function
const char *key; // keyword
} handleritem;
int open_socket(int isserver, char *path, int isnet);
int start_socket(int server);
int senddata(int fd, void *data, size_t l);
int sendmessage(int fd, const char *msg, int l);
int sendstrmessage(int fd, const char *msg);
char *get_keyval(char *keyval);
IMG *getshm(key_t key, size_t imsize);
int canberead(int fd);