1 /**
2 * Copyright (C) ARM Limited 2010-2012. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
9 #ifndef __SENDER_H__
10 #define __SENDER_H__
12 #include <stdio.h>
13 #include <pthread.h>
14 #include "OlySocket.h"
16 enum {
17 RESPONSE_END = 0, // unused
18 RESPONSE_XML = 1,
19 RESPONSE_APC_DATA = 3,
20 RESPONSE_ACK = 4,
21 RESPONSE_NAK = 5,
22 RESPONSE_ERROR = 0xFF
23 };
25 class Sender {
26 public:
27 Sender(OlySocket* socket);
28 ~Sender();
29 void writeData(const char* data, int length, int type);
30 void createDataFile(char* apcDir);
31 private:
32 OlySocket* mDataSocket;
33 FILE* mDataFile;
34 char* mDataFileName;
35 pthread_mutex_t mSendMutex;
36 };
38 #endif //__SENDER_H__