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

#include "CommunicationProtocol.h"
#include "debugging/etMSCLogger.h"


/*--------------------- port methods */

void CommunicationProtocolPort_receivedData(const CommunicationProtocolPort* self) {
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolPort", "receivedData")
		etPort_sendMessage(self, CommunicationProtocol_OUT_receivedData, 0, NULL);
	ET_MSC_LOGGER_SYNC_EXIT
}

void CommunicationProtocolReplPort_receivedData_broadcast(const CommunicationProtocolReplPort* self) {
	int i;
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolReplPort", "receivedData")
	for (i=0; i<((etReplPort*)self)->size; ++i) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), CommunicationProtocol_OUT_receivedData, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}

void CommunicationProtocolReplPort_receivedData(const CommunicationProtocolReplPort* self, int idx) {
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolReplPort", "receivedData")
	if (0<=idx && idx<((etReplPort*)self)->size) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), CommunicationProtocol_OUT_receivedData, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}


// getReplication
etInt32 CommunicationProtocolReplPort_getReplication(const CommunicationProtocolReplPort* self) {
	return ((etReplPort*)self)->size;
}



void CommunicationProtocolConjPort_sendData(const CommunicationProtocolConjPort* self) {
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolConjPort", "sendData")
		etPort_sendMessage(self, CommunicationProtocol_IN_sendData, 0, NULL);
	ET_MSC_LOGGER_SYNC_EXIT
}

void CommunicationProtocolConjReplPort_sendData_broadcast(const CommunicationProtocolConjReplPort* self) {
	int i;
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolConjReplPort", "sendData")
	for (i=0; i<((etReplPort*)self)->size; ++i) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), CommunicationProtocol_IN_sendData, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}

void CommunicationProtocolConjReplPort_sendData(const CommunicationProtocolConjReplPort* self, int idx) {
	ET_MSC_LOGGER_SYNC_ENTRY("CommunicationProtocolConjReplPort", "sendData")
	if (0<=idx && idx<((etReplPort*)self)->size) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), CommunicationProtocol_IN_sendData, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}


// getReplication
etInt32 CommunicationProtocolConjReplPort_getReplication(const CommunicationProtocolConjReplPort* self) {
	return ((etReplPort*)self)->size;
}



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

/* message names as strings for debugging (generate MSC) */
static const char* const CommunicationProtocol_messageStrings[] = {"MIN", "receivedData","sendData", "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