1 /* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef __DMTFIRMALERT_H__ 18 #define __DMTFIRMALERT_H__ 19 20 #ifndef __cplusplus 21 #error "This is a C++ header file; it requires C++ to compile." 22 #endif 23 24 /** 25 \file dmtFirmAlert.hpp 26 \brief The dmtFirmAlert.hpp header file contains DmtFirmAlert class definition. \n 27 This class is a helper class for sending repair status with ALERT 1226.\n 28 <b>Warning:</b> All functions, structures, and classes from this header file are for internal usage only!!! 29 */ 30 31 #include "jem_defs.hpp" 32 33 /** 34 * Helper class for sending repair status with ALERT 1226 35 * \warning This class is using <b>ONLY</b> for firmware update session! 36 * \par Category: General 37 * \par Persistence: Transient 38 * \par Security: Non-Secure 39 * \par Migration State: FINAL 40 */ 41 class DmtFirmAlert 42 { 43 private: 44 DMString m_strPackageURI; // URI of update package 45 DMString m_strCorrelator; 46 DMString m_strResultData; 47 DMString m_strAlertType; 48 DMString m_strAlertFormat; 49 DMString m_strAlertMark; 50 51 public: 52 /** 53 * Default constructor - no memory allocation performed. 54 */ 55 DmtFirmAlert() 56 { 57 } 58 59 /** 60 * Constructor Firm Alert base on the parameters. The memory will be allocated. 61 * \param packageURI [in] - package URI, constant character pointer. 62 * \param resultData [in] - result data, constant character pointer. 63 * \param alertType [in] - alert type, constant character pointer. 64 * \param alertFormat [in] - alert format, constant character pointer. 65 * \param alertMark [in] - alert mark, constant character pointer. 66 * \param szCorrelator [in] - correlator, constant character pointer. 67 */ 68 DmtFirmAlert( 69 const char* packageURI, 70 const char* resultData, 71 const char* alertType, 72 const char* alertFormat, 73 const char* alertMark, 74 const char* szCorrelator ) 75 { 76 m_strPackageURI = packageURI; 77 m_strCorrelator = szCorrelator; 78 m_strResultData = resultData; 79 m_strAlertType = alertType; 80 m_strAlertFormat = alertFormat; 81 m_strAlertMark = alertMark; 82 } 83 84 85 /** 86 * Retrieves alert type 87 * \par Sync (or) Async: 88 * This is a Synchronous function. 89 * \par Secure (or) Non-Secure (or) N/A: 90 * This is a Non-Secure function. 91 * \returns string alert type 92 * \par Prospective Clients: 93 * All potential applications that require configuration settings. 94 */ 95 const DMString & getAlertType() const 96 { 97 return m_strAlertType; 98 } 99 100 /** 101 * Retrieves alert format 102 * \par Sync (or) Async: 103 * This is a Synchronous function. 104 * \par Secure (or) Non-Secure (or) N/A: 105 * This is a Non-Secure function. 106 * \returns alert format 107 * \par Prospective Clients: 108 * All potential applications that require configuration settings. 109 */ 110 const DMString& getAlertFormat() const 111 { 112 return m_strAlertFormat; 113 } 114 115 /** 116 * Retrieves alert mark 117 * \par Sync (or) Async: 118 * This is a Synchronous function. 119 * \par Secure (or) Non-Secure (or) N/A: 120 * This is a Non-Secure function. 121 * \returns alert mark 122 * \par Prospective Clients: 123 * All potential applications that require configuration settings. 124 */ 125 const DMString& getAlertMark() const 126 { 127 return m_strAlertMark; 128 } 129 130 131 /** 132 * Retrieves result data 133 * \par Sync (or) Async: 134 * This is a Synchronous function. 135 * \par Secure (or) Non-Secure (or) N/A: 136 * This is a Non-Secure function. 137 * \returns firmware update result code 138 * \par Prospective Clients: 139 * All potential applications that require configuration settings. 140 */ 141 const DMString& getResultData() const 142 { 143 return m_strResultData; 144 } 145 146 147 /** 148 * Retrieves package URI 149 * \par Sync (or) Async: 150 * This is a Synchronous function. 151 * \par Secure (or) Non-Secure (or) N/A: 152 * This is a Non-Secure function. 153 * \returns update package URI in DMString. 154 * \par Prospective Clients: 155 * All potential applications that require configuration settings. 156 */ 157 const DMString & getPackageURI() const 158 { 159 return m_strPackageURI; 160 } 161 162 /** 163 * Retrieves correlator 164 * \par Sync (or) Async: 165 * This is a Synchronous function. 166 * \par Secure (or) Non-Secure (or) N/A: 167 * This is a Non-Secure function. 168 * \returns Correlator in DMString. 169 * \par Prospective Clients: 170 * All potential applications that require configuration settings. 171 */ 172 const DMString & getCorrelator() const 173 { 174 return m_strCorrelator; 175 } 176 177 178 /** 179 * Sets alert type 180 * \par Sync (or) Async: 181 * This is a Synchronous function. 182 * \par Secure (or) Non-Secure (or) N/A: 183 * This is a Non-Secure function. 184 * \param alertType [in] - alert type as a string 185 * \return Return Type (SYNCML_DM_RET_STATUS_T) \n 186 * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n 187 * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n 188 * \par Prospective Clients: 189 * All potential applications that require configuration settings. 190 */ 191 SYNCML_DM_RET_STATUS_T setAlertType(const char* alertType) 192 { 193 m_strAlertType = alertType; 194 return SYNCML_DM_SUCCESS; 195 } 196 197 /** 198 * Sets alert format 199 * \par Sync (or) Async: 200 * This is a Synchronous function. 201 * \par Secure (or) Non-Secure (or) N/A: 202 * This is a Non-Secure function. 203 * \param alertFormat [in] - alert format as a string 204 * \return Return Type (SYNCML_DM_RET_STATUS_T) \n 205 * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n 206 * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n 207 * \par Prospective Clients: 208 * All potential applications that require configuration settings. 209 */ 210 SYNCML_DM_RET_STATUS_T setAlertFormat(const char* alertFormat) 211 { 212 m_strAlertFormat = alertFormat; 213 return SYNCML_DM_SUCCESS; 214 } 215 216 /** 217 * Sets alert mark 218 * \par Sync (or) Async: 219 * This is a Synchronous function. 220 * \par Secure (or) Non-Secure (or) N/A: 221 * This is a Non-Secure function. 222 * \param alertMark [in] - alert mark as a string 223 * \return Return Type (SYNCML_DM_RET_STATUS_T) \n 224 * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n 225 * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n 226 * \par Prospective Clients: 227 * All potential applications that require configuration settings. 228 */ 229 SYNCML_DM_RET_STATUS_T setAlertMark(const char* alertMark) 230 { 231 m_strAlertMark = alertMark; 232 return SYNCML_DM_SUCCESS; 233 } 234 235 236 /** 237 * Sets result code 238 * \par Sync (or) Async: 239 * This is a Synchronous function. 240 * \par Secure (or) Non-Secure (or) N/A: 241 * This is a Non-Secure function. 242 * \param resultData [in] - result data as a string, usually a result code 243 * \return Return Type (SYNCML_DM_RET_STATUS_T) \n 244 * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n 245 * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n 246 * \par Prospective Clients: 247 * All potential applications that require configuration settings. 248 */ 249 SYNCML_DM_RET_STATUS_T setResultData(const char* resultData ) 250 { 251 m_strResultData = resultData; 252 return SYNCML_DM_SUCCESS; 253 } 254 255 /** 256 * Sets correlator 257 * \par Sync (or) Async: 258 * This is a Synchronous function. 259 * \par Secure (or) Non-Secure (or) N/A: 260 * This is a Non-Secure function. 261 * \param correlator [in] - correlator as a string 262 * \return Return Type (SYNCML_DM_RET_STATUS_T) \n 263 * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n 264 * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n 265 * \par Prospective Clients: 266 * All potential applications that require configuration settings. 267 */ 268 SYNCML_DM_RET_STATUS_T setCorrelator(const char* correlator ) 269 { 270 m_strCorrelator= correlator; 271 return SYNCML_DM_SUCCESS; 272 } 273 274 /** 275 * Sets package URI 276 * \par Sync (or) Async: 277 * This is a Synchronous function. 278 * \par Secure (or) Non-Secure (or) N/A: 279 * This is a Non-Secure function. 280 * \param strPackageURI [in] - package URI as a string 281 * \return Return Type (SYNCML_DM_RET_STATUS_T) \n 282 * - SYNCML_DM_DEVICE_FULL - indicate that operation cannot be performed. \n 283 * - SYNCML_DM_INVALID_PARAMETER - indicate that operation cannot be performed. \n 284 * - SYNCML_DM_SUCCESS - indicate that operation has completed successfully. \n 285 * \par Prospective Clients: 286 * All potential applications that require configuration settings. 287 */ 288 SYNCML_DM_RET_STATUS_T setPackageURI(const DMString & strPackageURI) 289 { 290 if ( !strPackageURI.length() ) 291 return SYNCML_DM_INVALID_PARAMETER; 292 293 m_strPackageURI = strPackageURI; 294 return SYNCML_DM_SUCCESS; 295 } 296 297 }; 298 299 #endif //End of include file 300