Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 40bc41261aee4c175a8e27e23aa524cd3a68b762 (plain) (blame)
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
/**
 * @author generated by eTrice
 *
 * Source File of ProtocolClass CommunicationProtocol
 * 
 */

#include "CommunicationProtocol.h"

#include "etMSCLogger.h"

/*--------------------- port classes */

void CommunicationProtocolPort_receivedData(const CommunicationProtocolPort* self){
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolPort", "receivedData")
	etMessage* msg = etMessageService_getMessageBuffer(self->msgService, sizeof(etMessage));
	msg->address = self->peerAddress;
	msg->evtID = CommunicationProtocol_OUT_receivedData;
	etMessageService_pushMessage(self->msgService, msg);
	ET_MSC_LOGGER_SYNC_EXIT
}



void CommunicationProtocolConjPort_sendData(const CommunicationProtocolConjPort* self){
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolConjPort", "sendData")
	etMessage* msg = etMessageService_getMessageBuffer(self->msgService, sizeof(etMessage));
	msg->address = self->peerAddress;
	msg->evtID = CommunicationProtocol_IN_sendData;
	etMessageService_pushMessage(self->msgService, msg);
	ET_MSC_LOGGER_SYNC_EXIT
}
void CommunicationProtocolConjPort_sendData2(const CommunicationProtocolConjPort* self){
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolConjPort", "sendData2")
	etMessage* msg = etMessageService_getMessageBuffer(self->msgService, sizeof(etMessage));
	msg->address = self->peerAddress;
	msg->evtID = CommunicationProtocol_IN_sendData2;
	etMessageService_pushMessage(self->msgService, msg);
	ET_MSC_LOGGER_SYNC_EXIT
}



/*--------------------- debug helpers */

/* TODO: make this optional or different for smaller footprint */
/* message names as strings for debugging (generate MSC) */
static const char* CommunicationProtocol_messageStrings[] = {"MIN", "receivedData","sendData", "sendData2", "MAX"};

const char* CommunicationProtocol_getMessageString(int msg_id) {
	if (msg_id<CommunicationProtocol_MSG_MIN || msg_id>CommunicationProtocol_MSG_MAX+1){
		/* id out of range */
		return "Message ID out of range";
	}
	else{
		return CommunicationProtocol_messageStrings[msg_id];
	}
}

Back to the top