uboot.h
1 #pragma once
2 
3 #include <iostream>
4 #include <functional>
5 #include "command.h"
6 
7 #ifdef TESTING
8 #include <gtest/gtest.h>
9 #endif
10 
16 class UBoot
17 {
18 private:
19  static const std::string EP200_1GB_BINARY;
20  static const std::string EP200_4GB_BINARY;
21  static const std::string TV100_1GB_BINARY;
22  static const std::string TV100_1_5GB_BINARY;
23  static const std::string DTD200_BINARY;
24 
25 public:
26  UBoot();
27  virtual ~UBoot();
28  static bool updateUBoot(const std::string &zipLocation);
29  static bool getCurrentVersion(std::string &current_version);
30 
31 private:
32  static inline std::function<std::string(std::string)> mCmdFunc = Command::GetStdoutFromCommand;
33  static bool getCurrentBootPartition(std::string &current_part);
34  static bool getBinaryPath(const std::string &zipLocation, std::string &binaryPath);
35  static unsigned long int getTotalKBMemory();
36  static bool getBinaryName(std::string &binaryName);
37 
38 #ifdef TESTING
39 public:
40  friend class UpdateUBoot_test;
41  FRIEND_TEST(UpdateUBoot_test,getCurrentBootPartition0);
42  FRIEND_TEST(UpdateUBoot_test,getCurrentBootPartition1);
43  FRIEND_TEST(UpdateUBoot_test,getCurrentBootPartitionNotValidPattern);
44  FRIEND_TEST(UpdateUBoot_test,getCurrentBootPartitionNotValidPattern2);
45  FRIEND_TEST(UpdateUBoot_test,getCurrentBootPartitionEmptyResponse);
46  FRIEND_TEST(UpdateUBoot_test,getCurrentVersionOK);
47  FRIEND_TEST(UpdateUBoot_test,getCurrentVersionNotValidPattern);
48  FRIEND_TEST(UpdateUBoot_test,getCurrentVersionEmptyResponse);
49  FRIEND_TEST(UpdateUBoot_test,zipError);
50  FRIEND_TEST(UpdateUBoot_test,updateUBootVersionsMatch);
51  FRIEND_TEST(UpdateUBoot_test,updateUBootVersionError);
52 #endif //TESTING
53 };
Defines a class for executing commands and getting output.
Class that triggers a UBoot update.
Definition: uboot.h:16