Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 12f02885bd579185b2f4f8cd8062dd6fae9213a4 (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
/*******************************************************************************
 * 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);

#endif /* RMESSAGESERVICE_H_ */

Back to the top