2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 /// \defgroup <<Group Tag>> <<Group Name>>
19 /// \ingroup tag_NS_NPPService
21 ////////////////////////////////////////////////////////////////////////////////////////////////////
23 ////////////////////////////////////////////////////////////////////////////////////////////////////
24 /// \ingroup tag_NS_NPPService
29 ////////////////////////////////////////////////////////////////////////////////////////////////////
31 #ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
32 #define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
34 #include <native_service/frameworkunified_sm_eventdata.h>
36 #include <native_service/ns_np_types.h>
38 // name of notification file to be saved in persistent memory depending on the persistent type category
40 #define NOTIFICATIONFILE "PERSISTENT_NOTIFICATION" // stores user notification common to all user
41 #define USERNOTIFICATIONFILE "USER_PERSISTENT_NOTIFICATION" // stores user notification specific to particular user
42 #define FACTORYNOTIFICATIONFILE "FACTORY_NOTIFICATION" // stores factory notification
43 #define FACTORYCUSTOMERNOTIFICATIONFILE "FACTORYCUSTOMER_NOTIFICATION" // stores factorycustomer notification
44 #define DEALERNOTIFICATIONFILE "DEALER_NOTIFICATION" // stores dealer notification
46 // name of persistence folder for persistent type categorization
47 #define USERDATA "UserData" // name of folder contatining userdata
48 #define FACTORYDATA "FactoryData" // name of folder contatining factory data
49 #define FACTORYCUSTOMERDATA "FactoryCustomerData" // name of folder contatining factory customer data
50 #define DEALERDATA "DealerData" // name of folder contatining dealer data
52 // default user name for personalization
53 #define DEFAULTUSERNAME "DefaultUser"
55 // name of NSNPS version file
56 #define VERSION_TXT "version.txt"
58 #define STORAGE_PATH "/var/local/lib/basesystem/nv/BS/ns/npp/rwdata/"
61 typedef enum ENPSLoadType {
63 LOADTYPE_RELEASE = 0, // load file to persistent memory
64 LOADTYPE_LOAD = 1, // load file to temporary memory
65 LOADTYPE_RELOAD = 2, // reload the file.
68 /// \typedef ENotificationpersistentservicePersistType
69 /// \brief Persist file types
70 typedef enum ENotificationpersistentservicePersistType {
71 ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST = 0, ///< Add values after this value only.
72 ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE, ///< Persist a file to a persistent memory
73 ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER, ///< Persist a folder to a persistent memory
74 ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE, ///< no type
75 ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST, ///< Add values before this value only.
76 } ENotificationpersistentservicePersistType;
78 typedef enum ENPSPersistenceJobState {
79 ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE = 0, ///< Job is idle. // NOLINT (readability/naming)
80 ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS = 1, ///< Job is in process. Either release or load. // NOLINT (readability/naming)
81 ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED = 2, ///< Job release was aborted due to abort shutdown. // NOLINT (readability/naming)
82 } ENPSPersistenceJobState;
84 typedef CHAR CopyInfoStr[MAX_PATH_LENGTH]; ///< Information passed via the framework
87 typedef enum ENPSCopyWorkerProtocol {
89 CP_WRK_CMD_START = 1500,
90 CP_WRK_CMD_STOP = 1501,
91 CP_WRK_CMD_COPY = 1502,
92 CP_WRK_CMD_RESUME = 1503, // This will release the thread from the abort command.
95 CP_WRK_ACK_CMD_COMPLETE = 1504,
100 // < Shutdown request command
101 CMD_WRK_SHUTDOWN_REQ = 1506,
102 CMD_WRK_SHUTDOWN_ACK = 1507,
104 CMD_DELETE_OLD_DATA = 1508,
108 AR_CMD_ARCHIVE = 1402,
109 AR_CMD_RESUME = 1403, // This will release the thread from the abort command.
112 AR_ACK_CMD_COMPLETE = 1404,
117 NOR_PERSISTENCE_TIMER_START = 1406,
118 NOR_PERSISTENCE_REGISTER = 1407,
119 NOR_PERSISTENCE_UNREGISTER = 1408,
120 // this cmd is used to tell the NOR thread to stop the timer
121 // for all the the notifications in case of userdata reset during shutdown
122 NOR_PERSISTENCE_ONSHUTDOWN = 1409,
123 // while to persist the data immediately irrespective of delay in case of shutdown without userdata reset.
124 // ack sent to NPPService main thread by Nor worker thread after persisting immediate data
125 NOR_PERSISTENCE_ONSHUTDOWN_ACK = 1410,
126 // message sent by main thread to immediate persistence thread
127 // to change the persistent category of immediate notification
128 NOR_PERSISTENCE_CHANGE_CATEGORY = 1411
129 } ENSP_CopyWorkerProtocol, *PENSP_CopyWorkerProtocol, ENPS_ArchiveProtocol;
132 typedef enum ENPSCopyWorkerFailures {
133 // > Failure codes(s)
134 CP_WRK_FAILURE_SRC_NOT_FND = 3500,
135 CP_WRK_FAILURE_DST_CREATE = 3501,
136 CP_WRK_FAILURE_ABORT_DURING_CP = 3502,
137 CP_WRK_FAILURE_ABORT_BEFORE_CP = 3503,
138 CP_WRK_FAILURE_WRITE_ERROR_CP = 3504,
140 AR_THREAD_FAILURE_SRC_NOT_FND = 3400,
141 AR_THREAD_FAILURE_DST_CREATE = 3401,
142 AR_THREAD_FAILURE_ABORT_DURING_ARCHIVE = 3402,
143 AR_THREAD_FAILURE_ABORT_BEFORE_ARCHIVE = 3403,
144 } ENPS_CopyWorkerFailures, *PENPS_CopyWorkerFailures, ENPS_ArchiveFailures;
146 typedef struct NPSCopyAckMsg {
147 ENSP_CopyWorkerProtocol m_eworkerprotocol; // Worker Load or Release Protocol Id
150 typedef enum NotificationpersistentserviceCompressionType {
151 ENOTIFICATIONPERSISTENTSERVICENONE = 0, /// No Compression before file persistence
152 ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION, /// Compress file before persistence using default compression method
153 ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ /// Compress file before persistence using libz
154 } NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE;
156 typedef struct NPSCopyInfoMsg {
157 CopyInfoStr m_csourcepath; // Source path
158 CopyInfoStr m_cdestinationpath; // Destination path
159 CopyInfoStr m_cpersistenttag; // Tag for Persistence
160 CopyInfoStr m_crequesterappname; // Requester Name
161 ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
162 ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
163 NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
166 typedef struct NPSCopyStatus {
167 BOOL m_bpersistencechk; // Persistence Success or Failure
168 ENPS_CopyWorkerFailures m_ecopyfailures; // Failure Protocol ID
169 CopyInfoStr m_cpersistenttag; // Tag for Persistence
170 CopyInfoStr m_crequesterappname; // Requester Name
171 ENPS_Loadtype m_eloadtype; // Load to Persistent or Temporary Memory
172 ENotificationpersistentservicePersistType m_epersisttype; // Folder or File Persistence
173 NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype; // Check for Compression of the file
174 } NSP_CopyStatusResponse, NSP_CopyCancel;
177 // Structure for Nor Persistent Notification
178 typedef struct TNorPersistenceNotifInfoHeader {
179 CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
180 UI_32 m_uimaxmsglength; ///< Maximum data length of notification
181 EFrameworkunifiedNotificationType m_epersistenttype; ///< type of notification
182 CHAR m_cpublishername[MAX_NAME_SIZE_APP]; ///< Service Name
183 UI_32 m_uimsgsize; ///< length of message
184 UI_32 m_uidelay; ///< Time delay between persistence
185 EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
186 } TNorPersistenceNotifInfoHeader;
188 typedef struct _TImmediatePersistenceRegisterNotifInfo { // NOLINT (readability/naming)
189 CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
190 UI_32 m_uidelay; ///< Time delay between persistence
191 EFrameworkunifiedPersistCategory m_epersistcategory; ///< Persistent Category
192 } TImmediatePersistenceRegisterNotifInfo;
194 typedef struct _TImmediatePersistenceUnregisterNotifInfo { // NOLINT (readability/naming)
195 CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION]; ///< Name of Notification
196 } TImmediatePersistenceUnregisterNotifInfo;
198 typedef struct _NPS_CopyShutdown { // NOLINT (readability/naming)
199 CopyInfoStr m_crequesterappname;
200 } NSP_CopyShutdown, NSP_CopyShutdownAck;
202 typedef struct _TImmediatePersistenceChangeCategory { // NOLINT (readability/naming)
203 TNorPersistenceNotifInfoHeader m_tnornotifInfoheader; ///< Notification info with new persist category type
204 EFrameworkunifiedPersistCategory m_eoldpersistcategory; ///< Old Persistent Category of notification
205 } TImmediatePersistenceChangeCategory;
207 typedef struct _TImmediateShutdown { // NOLINT (readability/naming)
208 EFrameworkunifiedShutdownType f_eshutdowntype;
209 UI_32 f_uinotificationpersistentservicepersistcategoryflag;
210 } TImmediateShutdown;
212 #endif // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_