Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 40be5342a6724c8a6dac51497bc4cbd290d2fbe4 (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 etSystemProtocol
 * 
 */

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


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


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



void etSystemProtocolConjPort_poll(const etSystemProtocolConjPort* self) {
	ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjPort", "poll")
		etPort_sendMessage(self, etSystemProtocol_IN_poll, 0, NULL);
	ET_MSC_LOGGER_SYNC_EXIT
}

void etSystemProtocolConjReplPort_poll_broadcast(const etSystemProtocolConjReplPort* self) {
	int i;
	ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "poll")
	for (i=0; i<((etReplPort*)self)->size; ++i) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), etSystemProtocol_IN_poll, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}

void etSystemProtocolConjReplPort_poll(const etSystemProtocolConjReplPort* self, int idx) {
	ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "poll")
	if (0<=idx && idx<((etReplPort*)self)->size) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), etSystemProtocol_IN_poll, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}

void etSystemProtocolConjPort_terminate(const etSystemProtocolConjPort* self) {
	ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjPort", "terminate")
		etPort_sendMessage(self, etSystemProtocol_IN_terminate, 0, NULL);
	ET_MSC_LOGGER_SYNC_EXIT
}

void etSystemProtocolConjReplPort_terminate_broadcast(const etSystemProtocolConjReplPort* self) {
	int i;
	ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "terminate")
	for (i=0; i<((etReplPort*)self)->size; ++i) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[i]), etSystemProtocol_IN_terminate, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}

void etSystemProtocolConjReplPort_terminate(const etSystemProtocolConjReplPort* self, int idx) {
	ET_MSC_LOGGER_SYNC_ENTRY("etSystemProtocolConjReplPort", "terminate")
	if (0<=idx && idx<((etReplPort*)self)->size) {
		etPort_sendMessage(((etPort*)&((etReplPort*)self)->ports[idx]), etSystemProtocol_IN_terminate, 0, NULL);
	}
	ET_MSC_LOGGER_SYNC_EXIT
}


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



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

/* message names as strings for debugging (generate MSC) */
static const char* const etSystemProtocol_messageStrings[] = {"MIN", "poll", "terminate", "MAX"};

const char* etSystemProtocol_getMessageString(int msg_id) {
	if (msg_id<etSystemProtocol_MSG_MIN || msg_id>etSystemProtocol_MSG_MAX+1){
		/* id out of range */
		return "Message ID out of range";
	}
	else{
		return etSystemProtocol_messageStrings[msg_id];
	}
}

Back to the top