blob: d8b16260643679501cdcca63b7dc3a515b5c8027 [file] [log] [blame]
Jon Medhurstaaf37a32013-06-11 12:10:56 +01001/**
Jon Medhurstb1d07442015-05-08 12:04:18 +01002 * Copyright (C) ARM Limited 2010-2015. All rights reserved.
Jon Medhurstaaf37a32013-06-11 12:10:56 +01003 *
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 */
8
Jon Medhurst96b56152014-10-30 18:01:15 +00009#ifndef __STREAMLINE_SETUP_H__
10#define __STREAMLINE_SETUP_H__
Jon Medhurstaaf37a32013-06-11 12:10:56 +010011
Jon Medhurst15ce78d2014-04-10 09:02:02 +010012#include <stdint.h>
13#include <string.h>
14
15class OlySocket;
Jon Medhurstaaf37a32013-06-11 12:10:56 +010016
17// Commands from Streamline
18enum {
19 COMMAND_REQUEST_XML = 0,
20 COMMAND_DELIVER_XML = 1,
21 COMMAND_APC_START = 2,
22 COMMAND_APC_STOP = 3,
23 COMMAND_DISCONNECT = 4,
Jon Medhurste31266f2014-08-04 15:47:44 +010024 COMMAND_PING = 5
Jon Medhurstaaf37a32013-06-11 12:10:56 +010025};
26
27class StreamlineSetup {
28public:
29 StreamlineSetup(OlySocket *socket);
30 ~StreamlineSetup();
31private:
Jon Medhurstaaf37a32013-06-11 12:10:56 +010032 OlySocket* mSocket;
33
34 char* readCommand(int*);
35 void handleRequest(char* xml);
36 void handleDeliver(char* xml);
37 void sendData(const char* data, uint32_t length, char type);
38 void sendString(const char* string, int type) {sendData(string, strlen(string), type);}
39 void sendEvents();
40 void sendConfiguration();
41 void sendDefaults();
42 void sendCounters();
43 void writeConfiguration(char* xml);
Jon Medhurst34d97692013-12-19 09:23:06 +000044
45 // Intentionally unimplemented
46 StreamlineSetup(const StreamlineSetup &);
47 StreamlineSetup &operator=(const StreamlineSetup &);
Jon Medhurstaaf37a32013-06-11 12:10:56 +010048};
49
Jon Medhurste31266f2014-08-04 15:47:44 +010050#endif //__STREAMLINE_SETUP_H__