blob: 752d35ea124d7fedcace7959c472f064ce8b3868 [file] [log] [blame]
bigbiffce8f83c2015-12-12 18:30:21 -05001/*
2 Copyright 2013 to 2016 TeamWin
3 TWRP is free software: you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation, either version 3 of the License, or
6 (at your option) any later version.
7
8 TWRP is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with TWRP. If not, see <http://www.gnu.org/licenses/>.
15*/
16
17#include <fstream>
18
19#include "../orscmd/orscmd.h"
20#include "../variables.h"
21#include "../twcommon.h"
22
23class twrpback {
24public:
25 int adbd_fd; // adbd data stream
26
27 twrpback(void);
28 virtual ~twrpback(void);
29 int backup(std::string command); // adb backup stream
30 int restore(void); // adb restore stream
31 void adblogwrite(std::string writemsg); // adb debugging log function
32 void close_backup_fds(); // close backup resources
33 void close_restore_fds(); // close restore resources
34
35private:
36 int read_fd; // ors input fd
37 int write_fd; // ors operation fd
38 int ors_fd; // ors output fd
39 int adb_control_twrp_fd; // fd for bu to twrp communication
40 int adb_control_bu_fd; // fd for twrp to bu communication
41 int adb_read_fd; // adb read data stream
42 int adb_write_fd; // adb write data stream
43 bool firstPart; // first partition in the stream
44 FILE *adbd_fp; // file pointer for adb stream
45 char cmd[512]; // store result of commands
46 char operation[512]; // operation to send to ors
47 std::ofstream adblogfile; // adb stream log file
48 void adbloginit(void); // setup adb log stream file
49};