summaryrefslogtreecommitdiffstats
path: root/nsframework/notification_persistent_service/server/include/ns_npp_types.h
blob: 79a44d74dc906051d279f70dce5e0644a9ceed5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/*
 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

////////////////////////////////////////////////////////////////////////////////////////////////////
/// \defgroup <<Group Tag>> <<Group Name>>
/// \ingroup  tag_NS_NPPService
/// .
////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////
/// \ingroup  tag_NS_NPPService
/// \brief
///
///
///
////////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_
#define NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_

#include <native_service/frameworkunified_sm_eventdata.h>
#include <aglpath.h>
#include <native_service/ns_np_types.h>

// name of notification file to be saved in persistent memory depending on the persistent type category

#define NOTIFICATIONFILE "PERSISTENT_NOTIFICATION"     // stores user notification common to all user
#define USERNOTIFICATIONFILE "USER_PERSISTENT_NOTIFICATION"    // stores user notification specific to particular user
#define FACTORYNOTIFICATIONFILE "FACTORY_NOTIFICATION"        // stores factory notification
#define FACTORYCUSTOMERNOTIFICATIONFILE   "FACTORYCUSTOMER_NOTIFICATION"      // stores factorycustomer notification
#define DEALERNOTIFICATIONFILE        "DEALER_NOTIFICATION"       // stores dealer notification

// name of persistence folder for persistent type categorization
#define USERDATA          "UserData"          // name of folder contatining userdata
#define FACTORYDATA         "FactoryData"       // name of folder contatining factory data
#define FACTORYCUSTOMERDATA     "FactoryCustomerData"   // name of folder contatining factory customer data
#define DEALERDATA          "DealerData"        // name of folder contatining dealer data

// default user name for personalization
#define DEFAULTUSERNAME           "DefaultUser"

// name of NSNPS version file
#define VERSION_TXT             "version.txt"

#define STORAGE_PATH             "/nv/BS/ns/npp/rwdata/"


typedef enum ENPSLoadType {
  LOADTYPE_NONE    = -1,
  LOADTYPE_RELEASE = 0,  // load file to persistent memory
  LOADTYPE_LOAD    = 1,  // load file to temporary memory
  LOADTYPE_RELOAD  = 2,  // reload the file.
} ENPS_Loadtype;

/// \typedef ENotificationpersistentservicePersistType
/// \brief Persist file types
typedef enum ENotificationpersistentservicePersistType {
  ENOTIFICATIONPERSISTENTSERVICEPERSISTFIRST = 0,   ///< Add values after this value only.
  ENOTIFICATIONPERSISTENTSERVICEPERSISTFILE,        ///< Persist a file to a persistent memory
  ENOTIFICATIONPERSISTENTSERVICEPERSISTFOLDER,      ///< Persist a folder to a persistent memory
  ENOTIFICATIONPERSISTENTSERVICEPERSISTNONE,        ///< no type
  ENOTIFICATIONPERSISTENTSERVICEPERSISTLAST,        ///< Add values before this value only.
} ENotificationpersistentservicePersistType;

typedef enum ENPSPersistenceJobState {
  ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEIDLE = 0,            ///< Job is idle.  // NOLINT (readability/naming)
  ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATEINPROCESS = 1,       ///< Job is in process. Either release or load.  // NOLINT (readability/naming)
  ENOTIFICATIONPERSISTENTSERVICEPERSISTJObSTATERELEASEABORTED = 2,  ///< Job release was aborted due to abort shutdown.  // NOLINT (readability/naming)
} ENPSPersistenceJobState;

typedef CHAR CopyInfoStr[MAX_PATH_LENGTH];  ///< Information passed via the framework


typedef enum ENPSCopyWorkerProtocol {
  // > Command(s)
  CP_WRK_CMD_START                = 1500,
  CP_WRK_CMD_STOP                 = 1501,
  CP_WRK_CMD_COPY                 = 1502,
  CP_WRK_CMD_RESUME               = 1503,  // This will release the thread from the abort command.

  // < Command Ack(s)
  CP_WRK_ACK_CMD_COMPLETE           = 1504,

  // < Notification(s)
  CP_WRK_NTFY                     = 1505,

  // < Shutdown request command
  CMD_WRK_SHUTDOWN_REQ          = 1506,
  CMD_WRK_SHUTDOWN_ACK          = 1507,

  CMD_DELETE_OLD_DATA           = 1508,

  AR_CMD_START                  = 1400,
  AR_CMD_STOP                   = 1401,
  AR_CMD_ARCHIVE                = 1402,
  AR_CMD_RESUME                 = 1403,  // This will release the thread from the abort command.

  // < Command Ack(s)
  AR_ACK_CMD_COMPLETE           = 1404,

  // < Notification(s)
  AR_CMD_NTFY                     = 1405,

  NOR_PERSISTENCE_TIMER_START       = 1406,
  NOR_PERSISTENCE_REGISTER        = 1407,
  NOR_PERSISTENCE_UNREGISTER        = 1408,
  // this cmd is used to tell the NOR thread to stop the timer
  // for all the the notifications in case of userdata reset during shutdown
  NOR_PERSISTENCE_ONSHUTDOWN        = 1409,
  // while to persist the data immediately irrespective of delay in case of shutdown without userdata reset.
  // ack sent to NPPService main thread by Nor worker thread after persisting immediate data
  NOR_PERSISTENCE_ONSHUTDOWN_ACK          = 1410,
  // message sent by main thread to immediate persistence thread
  // to change the persistent category of immediate notification
  NOR_PERSISTENCE_CHANGE_CATEGORY         = 1411
} ENSP_CopyWorkerProtocol, *PENSP_CopyWorkerProtocol, ENPS_ArchiveProtocol;


typedef enum ENPSCopyWorkerFailures {
  // > Failure codes(s)
  CP_WRK_FAILURE_SRC_NOT_FND            = 3500,
  CP_WRK_FAILURE_DST_CREATE           = 3501,
  CP_WRK_FAILURE_ABORT_DURING_CP      = 3502,
  CP_WRK_FAILURE_ABORT_BEFORE_CP      = 3503,
  CP_WRK_FAILURE_WRITE_ERROR_CP       = 3504,

  AR_THREAD_FAILURE_SRC_NOT_FND         = 3400,
  AR_THREAD_FAILURE_DST_CREATE          = 3401,
  AR_THREAD_FAILURE_ABORT_DURING_ARCHIVE  = 3402,
  AR_THREAD_FAILURE_ABORT_BEFORE_ARCHIVE  = 3403,
} ENPS_CopyWorkerFailures, *PENPS_CopyWorkerFailures, ENPS_ArchiveFailures;

typedef struct NPSCopyAckMsg {
  ENSP_CopyWorkerProtocol m_eworkerprotocol;  // Worker Load or Release Protocol Id
} NSP_CopyAckMsg;

typedef enum NotificationpersistentserviceCompressionType {
  ENOTIFICATIONPERSISTENTSERVICENONE = 0,       /// No Compression before file persistence
  ENOTIFICATIONPERSISTENTSERVICEDEFAULTCOMPRESSION,   /// Compress file before persistence using default compression method
  ENOTIFICATIONPERSISTENTSERVICECOMPRESSUSINGLIBZ   /// Compress file before persistence using libz
} NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE;

typedef struct NPSCopyInfoMsg {
  CopyInfoStr     m_csourcepath;      // Source path
  CopyInfoStr     m_cdestinationpath;  // Destination path
  CopyInfoStr     m_cpersistenttag;   // Tag for Persistence
  CopyInfoStr     m_crequesterappname;  // Requester Name
  ENPS_Loadtype     m_eloadtype;    // Load to Persistent or Temporary Memory
  ENotificationpersistentservicePersistType   m_epersisttype;     // Folder or File Persistence
  NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype;  // Check for Compression of the file
} NSP_CopyInfoCmd;

typedef struct NPSCopyStatus {
  BOOL              m_bpersistencechk;  // Persistence Success or Failure
  ENPS_CopyWorkerFailures m_ecopyfailures;    // Failure Protocol ID
  CopyInfoStr       m_cpersistenttag;   // Tag for Persistence
  CopyInfoStr       m_crequesterappname;  // Requester Name
  ENPS_Loadtype     m_eloadtype;    // Load to Persistent or Temporary Memory
  ENotificationpersistentservicePersistType     m_epersisttype;   // Folder or File Persistence
  NOTIFICATIONPERSISTENTSERVICE_COMPRESSION_TYPE m_ecompressiontype;    // Check for Compression of the file
} NSP_CopyStatusResponse, NSP_CopyCancel;


// Structure for Nor Persistent Notification
typedef struct TNorPersistenceNotifInfoHeader {
  CHAR m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION];  ///< Name of Notification
  UI_32 m_uimaxmsglength;             ///< Maximum data length of notification
  EFrameworkunifiedNotificationType m_epersistenttype;     ///< type of notification
  CHAR m_cpublishername[MAX_NAME_SIZE_APP];   ///< Service Name
  UI_32 m_uimsgsize;                ///< length of message
  UI_32 m_uidelay;                ///< Time delay between persistence
  EFrameworkunifiedPersistCategory m_epersistcategory;     ///< Persistent Category
} TNorPersistenceNotifInfoHeader;

typedef struct _TImmediatePersistenceRegisterNotifInfo { // NOLINT (readability/naming)
  CHAR  m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION];    ///< Name of Notification
  UI_32 m_uidelay;                ///< Time delay between persistence
  EFrameworkunifiedPersistCategory m_epersistcategory;     ///< Persistent Category
} TImmediatePersistenceRegisterNotifInfo;

typedef struct _TImmediatePersistenceUnregisterNotifInfo { // NOLINT (readability/naming)
  CHAR  m_cnotificationname[MAX_STRING_SIZE_NOTIFICATION];  ///< Name of Notification
} TImmediatePersistenceUnregisterNotifInfo;

typedef struct _NPS_CopyShutdown { // NOLINT (readability/naming)
  CopyInfoStr m_crequesterappname;
} NSP_CopyShutdown, NSP_CopyShutdownAck;

typedef struct _TImmediatePersistenceChangeCategory { // NOLINT (readability/naming)
  TNorPersistenceNotifInfoHeader  m_tnornotifInfoheader;    ///< Notification info with new persist category type
  EFrameworkunifiedPersistCategory m_eoldpersistcategory;     ///< Old Persistent Category of notification
} TImmediatePersistenceChangeCategory;

typedef struct _TImmediateShutdown { // NOLINT (readability/naming)
  EFrameworkunifiedShutdownType f_eshutdowntype;
  UI_32 f_uinotificationpersistentservicepersistcategoryflag;
} TImmediateShutdown;

#endif  // NOTIFICATION_PERSISTENT_SERVICE_SERVER_INCLUDE_NS_NPP_TYPES_H_