Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fae4e33bb36d5ae069574dc1d18503630721979a (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 RMESSAGESERVICE_H_
#define RMESSAGESERVICE_H_

#include <stddef.h>
#include "datatypes.h"
#include "RMessageQueue.h"


typedef struct RBuffer{
	uint8 *buffer;
	uint16 maxBlocks;
	uint16 blockSize;
} RBuffer;

typedef struct RMessageService {
	RMessageQueue messageQueue;
	RMessageQueue messagePool;
	RBuffer messageBuffer;
} RMessageService;

void RMessageService_init(RMessageService* self, uint8* buffer, uint16 maxBlocks, uint16 blockSize);

void RMessageService_initMessagePool(RMessageService* self);

void RMessageService_pushMessage(RMessageService* self, RMessage* msg);
RMessage* RMessageService_popMessage(RMessageService* self);


RMessage* RMessageService_getMessageBuffer(RMessageService* self, int16 size);
void RMessageService_returnMessageBuffer(RMessageService* self, RMessage* buffer);

#endif /* RMESSAGESERVICE_H_ */

Back to the top