forked from n5ac/mmsstv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHamlog5.h
119 lines (104 loc) · 3.48 KB
/
Hamlog5.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//Copyright+LGPL
//-----------------------------------------------------------------------------------------------------------------------------------------------
// Copyright 2000-2013 Makoto Mori, Nobuyuki Oba
//-----------------------------------------------------------------------------------------------------------------------------------------------
// This file is part of MMSSTV.
// MMSSTV is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
// MMSSTV 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 Lesser General Public License for more details.
// You should have received a copy of the GNU Lesser General Public License along with MMTTY. If not, see
// <http://www.gnu.org/licenses/>.
//-----------------------------------------------------------------------------------------------------------------------------------------------
#ifndef Hamlog5H
#define Hamlog5H
// MMQSL用Hamlog Ver5のドライバ
#include "ComLib.h"
#include "LogFile.h"
extern const LPCSTR g_Hamlog5Key[];
extern const BYTE g_Hamlog5Len[];
typedef enum {
itemhamlog5CALLS,
itemhamlog5IGN,
itemhamlog5DATE,
itemhamlog5TIME,
itemhamlog5CODE,
itemhamlog5GL,
itemhamlog5QSL,
itemhamlog5FLAG,
itemhamlog5HIS,
itemhamlog5MY,
itemhamlog5FREQ,
itemhamlog5MODE,
itemhamlog5NAME,
itemhamlog5QTH,
itemhamlog5RMK1,
itemhamlog5RMK2,
}HAMLOG5_ITEMS;
#define bithamlog5DX 8
#define bithamlog5NorOdr 1
#define bithamlog5RevOdr 2
#pragma pack(1)
typedef struct {
BYTE Type;
BYTE Year;
BYTE Mon;
BYTE Day;
ULONG RecMax;
USHORT FilOff;
USHORT RecWidth;
BYTE dm1[20];
}hamlog5DBHD;
typedef struct {
char Name[11];
BYTE Type;
BYTE dm1[4];
BYTE Len;
BYTE dm2[15];
}hamlog5DBRHD;
#pragma pack()
#define HamlogDBMAX 16
class CHamlog5
{
private:
BOOL m_fCreate;
hamlog5DBHD m_Head; // ヘッダ情報
ULONG m_RecMax; // レコード数
USHORT m_FilMax; // フィールド数
USHORT m_RecWidth; // レコードの幅
USHORT m_FilOff; // ヘッダオフセット
FILE *m_fp;
AnsiString m_StrTable[HamlogDBMAX]; // テーブル名の配列
USHORT m_PosTable[HamlogDBMAX]; // フィールド位置の配列
USHORT m_LenTable[HamlogDBMAX]; // フィールド長さの配列
char m_TypeTable[HamlogDBMAX]; // 型情報の配列
BOOL m_OpenFlag; // ファイルオープンフラグ
ULONG m_Index; // シーク時のインデックス
ULONG m_Pos; // シーク時のファイル位置
LPSTR m_bp; // バッファのポインタ
BOOL m_WriteFlag; // 書き込みフラグ
BOOL SetupHeader(void); // ヘッダセットアップ
BOOL MakeHeader(const LPCSTR _NT[], const BYTE _LT[]);
public:
CHamlog5();
~CHamlog5();
BOOL Open(LPCSTR Name, BOOL fMsg);
BOOL Create(LPCSTR Name);
void Close(void);
inline ULONG GetRCount(void){return m_RecMax;};
inline USHORT GetFCount(void){return m_FilMax;};
AnsiString *GetStrBase(void){return m_StrTable;};
BOOL Seek(ULONG Index);
BOOL IsData(void);
BOOL GetData(USHORT SubIndex, AnsiString &cs);
BOOL GetData(USHORT SubIndex, LPSTR pStore);
BOOL SetData(USHORT SubIndex, LPCSTR p);
BOOL SetBinary(USHORT SubIndex, LPBYTE p);
int GetData(USHORT SubIndex, LPBYTE pData, int len);
BOOL Update(void);
void DecodeData(SDMMLOG *sp);
void EncodeData(SDMMLOG *sp);
};
void __fastcall GetHamlog5FieldsLen(AnsiString &as);
void __fastcall SetHamlog5FieldsLen(AnsiString &as);
#endif