~ubuntu-branches/debian/sid/acfax/sid

« back to all changes in this revision

Viewing changes to fax_funcs.h

  • Committer: Bazaar Package Importer
  • Author(s): Hamish Moffatt
  • Date: 2001-12-27 12:07:46 UTC
  • Revision ID: james.westby@ubuntu.com-20011227120746-iz2p5k757bcla8ov
Tags: upstream-981011
ImportĀ upstreamĀ versionĀ 981011

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    ACfax - Fax reception with X11-interface for amateur radio
 
3
    Copyright (C) 1995-1998 Andreas Czechanowski, DL4SDC
 
4
 
 
5
    This program is free software; you can redistribute it and/or modify
 
6
    it under the terms of the GNU General Public License as published by
 
7
    the Free Software Foundation; either version 2 of the License, or
 
8
    (at your option) any later version.
 
9
 
 
10
    This program is distributed in the hope that it will be useful,
 
11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
    GNU General Public License for more details.
 
14
 
 
15
    You should have received a copy of the GNU General Public License
 
16
    along with this program; if not, write to the Free Software Foundation,
 
17
    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
18
 
 
19
    andreas.czechanowski@ins.uni-stuttgart.de
 
20
*/
 
21
 
 
22
/*
 
23
 * fax_funcs.h : function declarations and external variable declarations
 
24
 *      for all fax-related computing
 
25
 */
 
26
 
 
27
/* This is the size of the internal raw image storage. Adjust it so that
 
28
   the largest picture to expect can fit into memory (4000 * time_in_sec) */
 
29
#define CORESIZE (4560 << 10)
 
30
#define COREMAX (CORESIZE - 1)
 
31
 
 
32
/* set this to pre-define a directory for saving fax-pictures */
 
33
#define FAX_SAVEDIR "."
 
34
/* #define FAX_SAVEDIR "/usr/local/faxsave" */
 
35
 
 
36
/* define this if you run on 8-bit X-displays only, it can speed up the
 
37
   image-redrawing by replacing XPutPixel by direct access to memory : */
 
38
/* #define FAST8BIT */
 
39
 
 
40
/* debugging flags */
 
41
#define DEBUG 0
 
42
#define DBG_APT 2
 
43
#define DBG_SYN 4
 
44
 
 
45
/* decoding function: initialisation types (see fax_funcs.c) */
 
46
#define D_CPINIT        0x00000001
 
47
#define D_WDINIT        0x00000002
 
48
#define D_LDINIT        0x00000004
 
49
#define D_INITS         0x00000007
 
50
#define D_ALLOWX        0x00000008
 
51
#define D_FLUSHIMG      0x00000010
 
52
 
 
53
/* inverting of color- or grayscale-map, color-flip and rotation possibilities */
 
54
#define FAX_CNOR        0x00000001
 
55
#define FAX_CINV        0x00000002
 
56
#define FAX_POL         0x00000003
 
57
 
 
58
#define FAX_CUNFL       0x00000004
 
59
#define FAX_CFLIP       0x00000008
 
60
#define FAX_CFLS        0x0000000c
 
61
 
 
62
#define FAX_CROT0       0x00000010
 
63
#define FAX_CROT1       0x00000020
 
64
#define FAX_CROT2       0x00000030
 
65
#define FAX_CROTS       0x00000030
 
66
#define FAX_CMODS       (FAX_CROTS | FAX_CFLS | FAX_POL)
 
67
 
 
68
/* writing directions for the FAX transmission and reception */
 
69
#define FAX_DIR         0x00000f00
 
70
#define FAX_TOP2BOT     0x00000100
 
71
#define FAX_BOT2TOP     0x00000200
 
72
#define FAX_LEF2RIG     0x00000400
 
73
#define FAX_RIG2LEF     0x00000800
 
74
 
 
75
/* direction order / line direction */
 
76
#define FAX_ROT         0x00003000
 
77
#define FAX_HOR         0x00001000
 
78
#define FAX_VER         0x00002000
 
79
 
 
80
/* phase-signal polarity */
 
81
#define FAX_PHS         0x0000c000
 
82
#define FAX_PWHT        0x00004000
 
83
#define FAX_PBLK        0x00008000
 
84
 
 
85
/* color mode definitions */
 
86
#define FAX_CMODE       0x000f0000
 
87
#define FAX_GRAY        0x00010000
 
88
#define FAX_COLOR       0x00020000
 
89
 
 
90
/* fax receiver/transmitter status flag */
 
91
#define FAX_APT         1
 
92
#define FAX_PHAS        2
 
93
#define FAX_RX          3
 
94
#define FATX_APTA       16
 
95
#define FATX_PHAS       17
 
96
#define FATX_TX         18
 
97
#define FATX_APTB       19
 
98
 
 
99
/* fax file-save opearations */
 
100
#define F_DOSAVE        0       /* save image with captured parameters & close */
 
101
#define F_OPEN          1       /* open new savefile, write header */
 
102
#define F_CLOSE         2       /* close savefile, correct header */
 
103
#define F_GETDIM        3       /* capture current parameters for saving */
 
104
/* fax file-save return values */
 
105
#define SAVE_OK         0
 
106
#define SAVE_NPERM      1
 
107
#define SAVE_BUSY       2
 
108
#define SAVE_NFILE      3
 
109
/* fax apt-transmit initialisation commands */
 
110
#define APTX_ISTART     1
 
111
#define APTX_ISTOP      2
 
112
 
 
113
struct fax_savestruct {
 
114
    char *name;
 
115
    int width;
 
116
    int height;
 
117
};
 
118
 
 
119
/*
 
120
 * NOTE : these variables are made global for read-only purposes !
 
121
 * to change any of these, use setup_fax().
 
122
 */
 
123
extern int lpm;         /* current lines-per-minute */
 
124
extern int ixoc;        /* current index-of-cooperation */
 
125
extern int devi;        /* current selected deviation (for FM) */
 
126
extern int mod_mode;    /* current filter and mod.mode (see mod_demod.h) */
 
127
extern int vertical;    /* writing direction order vertical first */
 
128
extern int right2left;  /* writing direction horizontal */
 
129
extern int bot2top;     /* writing direction vertical */
 
130
extern int invphase;    /* inverse phase detection */
 
131
extern int invimage;    /* inverse image display */
 
132
/*
 
133
 * these may be changed directly :
 
134
 */
 
135
extern int aptstart;    /* current APT start frequency */
 
136
extern int aptstop;     /* current APT stop frequency */
 
137
 
 
138
extern void (*update_area)(XImage *, int, int, int, int, unsigned, unsigned);
 
139
extern void (*mode_notify)(int);
 
140
extern FILE *fsfile;
 
141
 
 
142
void    init_fax(void);
 
143
void    exit_fax(void);
 
144
void    setup_fax(int, int, unsigned,
 
145
        Widget, unsigned, unsigned,
 
146
        int, unsigned);
 
147
void    receive_on(void);
 
148
void    receive_off(void);
 
149
#ifdef DSP_SELECT
 
150
void    fax_rx_backgnd(XtPointer, int *, XtInputId *);
 
151
#else
 
152
void    fax_rx_backgnd(XtPointer, XtIntervalId *);
 
153
#endif
 
154
void    decode_fax_gray(int);
 
155
int     save_faxfile(char *, int);
 
156
void    close_faxsave(void);
 
157
int     save_fax_gray(int, int);
 
158
void    faxsave_complete(int);
 
159
void    sync_phase(int);
 
160
void    decode_apt(int);
 
161
void    apt_control(int);
 
162
void    fax_rx_start(int);
 
163
void    fax_rx_phase(int);
 
164
void    fax_rx_stop(int);
 
165
void    shift_fax_coords(unsigned, unsigned);
 
166
void    correct_fax_azimut(int, int);
 
167
 
 
168
void    fax_tx_stop(int);
 
169
void    fax_tx_start(int);
 
170
void    fax_tx_apta(int);
 
171
void    fax_tx_aptb(int);
 
172
void    fax_tx_phase(int);
 
173
int     load_txfile(char *name);
 
174
#ifdef DSP_SELECT
 
175
void    fax_tx_backgnd(XtPointer client_data, int *, XtInputId *xid);
 
176
#else
 
177
void    fax_tx_backgnd(XtPointer client_data, XtIntervalId *xid);
 
178
#endif
 
179
void    transmit_fax_gray(int init);
 
180
void    transmit_apt(int init);
 
181
void    transmit_phase(int init);