//
//  Copyright © 2003, RESON Inc. All Rights Reserved.
//
//  No part of this file may be reproduced or transmitted in any form or by
//  any means, electronic or mechanical, including photocopy, recording, or
//  information storage or retrieval system, without permission in writing
//  from RESON Inc.
//
//  Filename:   TimeEmitter.h
//
//  Project:    6046.
//
//  Author(s):  W. Arcus
//
//  Purpose:    
//
//  Notes:
//

#if !defined(AFX_TIMEEMITTER_H__81F428A1_0817_4664_BC25_553513E004DE__INCLUDED_)
#define AFX_TIMEEMITTER_H__81F428A1_0817_4664_BC25_553513E004DE__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "GeneralScheduler.h"

#include "..\Utils\NetUtils\Generic7kRecordEncoder.h"

class CTimeEmitter : public CGeneralScheduler
{
public:

    ///////////////
    // Services.

                    CTimeEmitter            (   void );
    virtual        ~CTimeEmitter            (   void );

    void            Enable                  (   const bool     &rbEnable );

	bool            IsEnabled               (   void )  const;

    bool            GenerateMessage         (   void );

                    operator BYTE  *        (   void )  const;
                    operator unsigned long  (   void )  const;

private:

    ///////////////
    // Definitions.

#pragma pack( push, TIMEEMITTER_H_PACK, 1 )

    typedef struct tagRECORDTYPE7400TIME
    {
        char                m_cLeapSecond;
        unsigned char       m_ucPulseFlag;
        unsigned short      m_unPortId;
        unsigned long       m_ulReserved1;
        unsigned __int64    m_ui64Reserved2;
    }
    RECORDTYPE7400TIME, *PRECORDTYPE7400TIME;

#pragma pack( pop, TIMEEMITTER_H_PACK )

    ///////////////
    // Attributes.

    bool                                        m_bEnabled;
    CGeneric7kRecordEncoder<RECORDTYPE7400TIME> m_TimeRecord;

    ///////////////
    // Services.

    CTimeEmitter &  operator =              (   const CTimeEmitter  &rRhs );       // Not implemented thus private.
                    CTimeEmitter            (   const CTimeEmitter  &rRhs );       // Not implemented thus private.

};

#endif // !defined(AFX_TIMEEMITTER_H__81F428A1_0817_4664_BC25_553513E004DE__INCLUDED_)

