Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b176655424c38010f730cbeae07ec895188b755f (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
/*******************************************************************************
 * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * CONTRIBUTORS:
 * 		Thomas Schuetz (initial contribution)
 *
 *******************************************************************************/

#ifndef _ETMESSAGESERVICE_H_
#define _ETMESSAGESERVICE_H_

#include <stddef.h>
#include "etDatatypes.h"
#include "etMessageQueue.h"


typedef struct RBuffer{
	etUInt8 *buffer;
	etUInt16 maxBlocks;
	etUInt16 blockSize;
} RBuffer;

typedef struct etMessageService {
	etMessageQueue messageQueue;
	etMessageQueue messagePool;
	RBuffer messageBuffer;
} etMessageService;

void etMessageService_init(etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize);

void etMessageService_initMessagePool(etMessageService* self);

void etMessageService_pushMessage(etMessageService* self, etMessage* msg);
etMessage* etMessageService_popMessage(etMessageService* self);


etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size);
void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer);

void etMessageService_execute(etMessageService* self);


#endif /* RMESSAGESERVICE_H_ */

Back to the top