Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 1 | /** |
Jon Medhurst | b1d0744 | 2015-05-08 12:04:18 +0100 | [diff] [blame] | 2 | * Copyright (C) ARM Limited 2010-2015. All rights reserved. |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 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 | */ |
| 8 | |
Jon Medhurst | 96b5615 | 2014-10-30 18:01:15 +0000 | [diff] [blame] | 9 | #ifndef __STREAMLINE_SETUP_H__ |
| 10 | #define __STREAMLINE_SETUP_H__ |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 11 | |
Jon Medhurst | 15ce78d | 2014-04-10 09:02:02 +0100 | [diff] [blame] | 12 | #include <stdint.h> |
| 13 | #include <string.h> |
| 14 | |
| 15 | class OlySocket; |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 16 | |
| 17 | // Commands from Streamline |
| 18 | enum { |
| 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 Medhurst | e31266f | 2014-08-04 15:47:44 +0100 | [diff] [blame] | 24 | COMMAND_PING = 5 |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 25 | }; |
| 26 | |
| 27 | class StreamlineSetup { |
| 28 | public: |
| 29 | StreamlineSetup(OlySocket *socket); |
| 30 | ~StreamlineSetup(); |
| 31 | private: |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 32 | 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 Medhurst | 34d9769 | 2013-12-19 09:23:06 +0000 | [diff] [blame] | 44 | |
| 45 | // Intentionally unimplemented |
| 46 | StreamlineSetup(const StreamlineSetup &); |
| 47 | StreamlineSetup &operator=(const StreamlineSetup &); |
Jon Medhurst | aaf37a3 | 2013-06-11 12:10:56 +0100 | [diff] [blame] | 48 | }; |
| 49 | |
Jon Medhurst | e31266f | 2014-08-04 15:47:44 +0100 | [diff] [blame] | 50 | #endif //__STREAMLINE_SETUP_H__ |