/*****************************************************************************/
/*                                                                           */
/*                                ICCONFIG.H                                 */
/*                                                                           */
/* (C) 1995-97  Ullrich von Bassewitz                                        */
/*              Wacholderweg 14                                              */
/*              D-70597 Stuttgart                                            */
/* EMail:       uz@ibb.schwaben.com                                          */
/*                                                                           */
/*****************************************************************************/



// $Id$
//
// $Log$
//
//



#ifndef _ICCONFIG_H
#define _ICCONFIG_H



#include <string.h>


/*****************************************************************************/
/*                                 Constants                                 */
/*****************************************************************************/



// Possible values for IstecBaseConfig.Connection
#define coPointToMulti            0
#define coPointToPoint            1
#define coMax                     1

// Possible values for IstecBaseConfig.Protocol
#define pr1TR6                    0
#define prDSS1                    1
#define prMax                     1

// Possible values for IstecBaseConfig.DialCaps
#define dcKeine                   0
#define dcInland                  1
#define dcOrt                     2
#define dcHalbamt                 3
#define dcNichtamt                4
#define dcMax                     4

// Possible values for IstecBaseConfig.Service
#define svFernsprechen            0
#define svFaxG3                   1
#define svDatenModem              2
#define svDatexJModem             3
#define svAnrufbeantworter        4
#define svKombi                   5

// Flags for the internal and external knock bitsets
#define knInt21                   0x0001
#define knInt22                   0x0002
#define knInt23                   0x0004
#define knInt24                   0x0008
#define knInt25                   0x0010
#define knInt26                   0x0020
#define knInt27                   0x0040
#define knInt28                   0x0080
#define knMSN0                    0x0001
#define knMSN1                    0x0002
#define knMSN2                    0x0004
#define knMSN3                    0x0008
#define knMSN4                    0x0010
#define knMSN5                    0x0020
#define knMSN6                    0x0040
#define knMSN7                    0x0080
#define knMSN8                    0x0100
#define knMSN9                    0x0200
#define knTFE1                    0x0400
#define knTFE2                    0x0800
#define knTFE3                    0x1000
#define knTFE4                    0x2000

// Signaling
#define siStandard                0
#define siSignal1                 1
#define siSignal2                 2
#define siSignal3                 3
#define siNone                    4

// Reroute conditions
#define rcNone                    0
#define rcUnconditional           1
#define rcBusy                    2
#define rcDelayed                 3

// Count of MSN's
#define bcMSNCount                10

// Maximum count of devices
#define IstecDevCount             64

// Number of first and last usable device
#define FirstDev                  21
#define LastDev                   28

// Raw sizes of the transmission data buffers. The actual space occupied from
// the date maybe less, depending on the istec firmware version.
#define BaseConfigSize            116
#define DevConfigSize             26
#define ChargeSize                128



/*****************************************************************************/
/*                           class IstecBaseConfig                           */
/*****************************************************************************/



// Basic ISTEC configuration struct
struct IC_BaseConfig
{
	UBYTE						Command;

    unsigned char       Connection;
    unsigned char       DevCount;
    unsigned char       Protocol;
    unsigned char       VersionHigh;
    unsigned char       VersionLow;
    unsigned char       TFEAssignment;

    unsigned char       MSN [bcMSNCount] [5];   // MSN in BCD

    unsigned char       Music;                  // 0 == off, 1 == on
    unsigned char       IntS0;
    unsigned char       ExtS0;

    unsigned char       QueryLoc1;
    unsigned char       QueryLoc2;
    unsigned char       Number1 [11];           // Number 1, pascal style
    unsigned char       Number2 [11];           // Number 2, pascal style

    unsigned char       MSNGroups [10];

//  ----------------------------------------    // 1.93 and up
    unsigned char       MusicPort;
    UBYTE               CountryCode[2];
    unsigned char       TFELoc [4];             // TFE Location (bitmap)

//  ----------------------------------------    // 2.00 and up

    unsigned char       AlarmTone;              // Unused according to E. docs
    unsigned char       Signaling [bcMSNCount];
    unsigned char       Reserved [5];

};



/*****************************************************************************/
/*                           class IstecDevConfig                            */
/*****************************************************************************/



// Configuration of the devices device
struct IC_DevConfig
{
	UBYTE						Command;

    unsigned char       DevNum;
    unsigned char       DialCaps;
    unsigned char       Service;
    unsigned char       Reroute;
    unsigned char       ChargePulse;
    unsigned char       PIN [2];
    unsigned char       ExtNum[10];

//  ---------------------------------   // 1.93 and up
    unsigned char       TerminalMode;

//  ---------------------------------   // 1.94 and up
    unsigned char       InternalKnock;
    unsigned char       Fill1;
    UBYTE               ExternalKnock[2];

//  ---------------------------------   // 1.95 and up

    unsigned char       ExtNumLen;      // Length of external number

//  ---------------------------------   // 2.00 and up

    unsigned char       RerouteIfBusy;
    unsigned char       RerouteDelayed;
    unsigned char       RingsUntilReroute;

};


// Configuration of the devices charge
struct IC_Charge
{
	UBYTE						Command;
	UBYTE						ChargeInfo[16];

	UWORD						Charge[8];
	UWORD						ChargeType[8];
};

// End of ICCONFIG.H

#endif


