@@ -22,35 +22,35 @@ using namespace std;
22
22
23
23
OTAUpdate::OTAUpdate () {}
24
24
25
- OTAUpdate::Error OTAUpdate::setCACert (const char * root_ca) {
25
+ int OTAUpdate::setCACert (const char * root_ca) {
26
26
string res = " " ;
27
27
if ( root_ca != nullptr && strlen (root_ca) > 0 ) {
28
28
modem.write_nowait (string (PROMPT (_OTA_SETCAROOT)), res, " %s%d\r\n " , CMD_WRITE (_OTA_SETCAROOT), strlen (root_ca));
29
29
if (modem.passthrough ((uint8_t *)root_ca, strlen (root_ca))) {
30
- return Error::None;
30
+ return static_cast < int >( Error::None) ;
31
31
}
32
- return Error::Modem;
32
+ return static_cast < int >( Error::Modem) ;
33
33
}
34
- return Error::Library;
34
+ return static_cast < int >( Error::Library) ;
35
35
}
36
36
37
- OTAUpdate::Error OTAUpdate::begin () {
37
+ int OTAUpdate::begin () {
38
38
string res = " " ;
39
39
if (modem.write (string (PROMPT (_OTA_BEGIN)), res, " %s" , CMD (_OTA_BEGIN))) {
40
- return static_cast <OTAUpdate::Error>( atoi (res.c_str () ));
40
+ return atoi (res.c_str ());
41
41
}
42
- return Error::Modem;
42
+ return static_cast < int >( Error::Modem) ;
43
43
}
44
44
45
- OTAUpdate::Error OTAUpdate::begin (const char * file_path) {
45
+ int OTAUpdate::begin (const char * file_path) {
46
46
string res = " " ;
47
47
if ( file_path != nullptr && strlen (file_path) > 0 ) {
48
48
if (modem.write (string (PROMPT (_OTA_BEGIN)), res, " %s%s\r\n " , CMD_WRITE (_OTA_BEGIN), file_path)) {
49
- return static_cast <OTAUpdate::Error>( atoi (res.c_str () ));
49
+ return atoi (res.c_str ());
50
50
}
51
- return Error::Modem;
51
+ return static_cast < int >( Error::Modem) ;
52
52
}
53
- return Error::Library;
53
+ return static_cast < int >( Error::Library) ;
54
54
}
55
55
56
56
int OTAUpdate::download (const char * url) {
@@ -87,37 +87,37 @@ int OTAUpdate::download(const char* url, const char* file_path) {
87
87
return ret;
88
88
}
89
89
90
- OTAUpdate::Error OTAUpdate::verify () {
90
+ int OTAUpdate::verify () {
91
91
string res = " " ;
92
92
if (modem.write (string (PROMPT (_OTA_VERIFY)), res, " %s" , CMD (_OTA_VERIFY))) {
93
- return static_cast <OTAUpdate::Error>( atoi (res.c_str () ));
93
+ return atoi (res.c_str ());
94
94
}
95
- return Error::Modem;
95
+ return static_cast < int >( Error::Modem) ;
96
96
}
97
97
98
- OTAUpdate::Error OTAUpdate::update () {
98
+ int OTAUpdate::update () {
99
99
string res = " " ;
100
100
if (modem.write (string (PROMPT (_OTA_UPDATE)), res, " %s" , CMD (_OTA_UPDATE))) {
101
- return static_cast <OTAUpdate::Error>( atoi (res.c_str () ));
101
+ return atoi (res.c_str ());
102
102
}
103
- return Error::Modem;
103
+ return static_cast < int >( Error::Modem) ;
104
104
}
105
105
106
- OTAUpdate::Error OTAUpdate::update (const char * file_path) {
106
+ int OTAUpdate::update (const char * file_path) {
107
107
string res = " " ;
108
108
if ( file_path != nullptr && strlen (file_path) > 0 ) {
109
109
if (modem.write (string (PROMPT (_OTA_UPDATE)), res, " %s%s\r\n " , CMD_WRITE (_OTA_UPDATE), file_path)) {
110
- return Error::None ;
110
+ return atoi (res. c_str ()) ;
111
111
}
112
- return Error::Modem;
112
+ return static_cast < int >( Error::Modem) ;
113
113
}
114
- return Error::Library;
114
+ return static_cast < int >( Error::Library) ;
115
115
}
116
116
117
- OTAUpdate::Error OTAUpdate::reset () {
117
+ int OTAUpdate::reset () {
118
118
string res = " " ;
119
119
if (modem.write (string (PROMPT (_OTA_RESET)), res, " %s" , CMD (_OTA_RESET))) {
120
- return Error::None;
120
+ return static_cast < int >( Error::None) ;
121
121
}
122
- return Error::Modem;
122
+ return static_cast < int >( Error::Modem) ;
123
123
}
0 commit comments