blob: 7cb28eec3ec72ee8335455f4b1089066eb8ac22c (
plain)
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
|
/*
* Video On Demand Samples
*
* Copyright (C) 2015 Microchip Technology Germany II GmbH & Co. KG
*
* 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/>.
*
* You may also obtain this software under a propriety license from Microchip.
* Please contact Microchip for further information.
*
*/
/*----------------------------------------------------------*/
/*! \file
* \brief This file contains the CIndustrialStack class (NetService part).
*/
/*----------------------------------------------------------*/
#ifndef INDUSTRIAL_STACK_MNS_H
#define INDUSTRIAL_STACK_MNS_H
#include <assert.h>
#include "IndustrialStack_Types.h"
#include "IndustrialStack_LLD.h"
#include "mns_types_cfg.h"
#include "mnsl.h"
#define MNSW_TESTPATTERN ((uint32_t)0xA1B2C3D4)
class IISNetServiceWrapperCB
{
public:
virtual void OnReceivedMostMessage(CISMostMsg *rcvMessage) = 0;
virtual void OnSyncStateChanged(bool isSynced) = 0;
virtual void OnControlReadEnd() = 0;
};
class CISNetServiceWrapper : public CIndustrialStackLldCB
{
public:
const uint32_t testPattern;
bool inicWriteError;
Mns_Lld_Api_t *pMnsInterface;
void *pMnsInst;
CTransceiver *icm_inst_ptr;
CTransceiver *rcm_inst_ptr;
CTransceiver *mcm_inst_ptr;
private:
CMnsl mnsl;
Mns_Lld_Callbacks_t pLldCb;
bool isSynced;
IISNetServiceWrapperCB *wrapperCB;
CIndustrialStackLld *lld;
public:
CISNetServiceWrapper(uint8_t deviceApi, int controlRxHandle, int controlTxHandle);
virtual ~CISNetServiceWrapper();
void ServiceMns();
void AddListener(IISNetServiceWrapperCB *rcvListener);
bool SendMostMessage(CISMostMsg *sndMessage);
void Unsynchronize();
public:
//Will be called from LLD, do not call directly
virtual void OnReadThreadEnd(CIndustrialStackLld *lld);
//All this functions will be called by the C wrappers, do not call them directly
void OnCtrlTxTransmit( Mns_Lld_TxMsg_t *msg_ptr);
void OnMnslEvent( Mnsl_Event_t event_code );
void OnMessage( Msg_MostTel_t *pRx, CTransceiver *pTr );
};
#endif //INDUSTRIAL_STACK_MNS_H
|