1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_EVENT_CESFWK_KITS_NATIVE_INCLUDE_COMMON_EVENT_SUPPORT_H 17 #define FOUNDATION_EVENT_CESFWK_KITS_NATIVE_INCLUDE_COMMON_EVENT_SUPPORT_H 18 19 #include <string> 20 #include <vector> 21 22 namespace OHOS { 23 namespace EventFwk { 24 class CommonEventSupport { 25 public: 26 /** 27 * Indicate the action of a common event that the user has finished booting and the system has been loaded. 28 * To subscribe to this common event, your application must have the ohos.permission.RECEIVER_STARTUP_COMPLETED 29 * permission. 30 * This common event can only be published by the system. 31 */ 32 static const std::string COMMON_EVENT_BOOT_COMPLETED; 33 /** 34 * Indicate the action of a common event that the user has finished booting and the system has been loaded but the 35 * screen is still locked. 36 * To subscribe to this common event, your application must have the ohos.permission.RECEIVER_STARTUP_COMPLETED 37 * permission. 38 * This common event can only be published by the system. 39 */ 40 static const std::string COMMON_EVENT_LOCKED_BOOT_COMPLETED; 41 /** 42 * Indicate the action of a common event that the device is being shut down and the final shutdown will proceed. 43 * This is different from sleeping. All unsaved data will be lost after shut down. 44 * This common event can only be published by the system. 45 */ 46 static const std::string COMMON_EVENT_SHUTDOWN; 47 /** 48 * Indicate the action of a common event that the charging state, level, and other information about the battery 49 * have changed. 50 * This common event can only be published by the system. 51 */ 52 static const std::string COMMON_EVENT_BATTERY_CHANGED; 53 /** 54 * Indicate the action of a common event that the battery level is low. 55 * This common event can only be published by the system. 56 */ 57 static const std::string COMMON_EVENT_BATTERY_LOW; 58 /** 59 * Indicate the action of a common event that the battery exit the low state. 60 * This common event can only be published by the system. 61 */ 62 static const std::string COMMON_EVENT_BATTERY_OKAY; 63 /** 64 * Indicate the action of a common event that the device is connected to the external power. 65 * This common event can only be published by the system. 66 */ 67 static const std::string COMMON_EVENT_POWER_CONNECTED; 68 /** 69 * Indicate the action of a common event that the device is disconnected from the external power. 70 * This common event can only be published by the system. 71 */ 72 static const std::string COMMON_EVENT_POWER_DISCONNECTED; 73 74 /** 75 * Indicate the action of a common event that the device screen is off and the device is sleeping. 76 * This common event can only be published by the system. 77 */ 78 static const std::string COMMON_EVENT_SCREEN_OFF; 79 /** 80 * Indicate the action of a common event that the device screen is on and the device is interactive. 81 * This common event can only be published by the system. 82 */ 83 static const std::string COMMON_EVENT_SCREEN_ON; 84 /** 85 * Indicate the action of a common event that the thermal level changed. 86 * This common event can only be published by the system. 87 */ 88 static const std::string COMMON_EVENT_THERMAL_LEVEL_CHANGED; 89 /** 90 * Indicate the action of a common event that the user unlocks the device. 91 * This common event can only be published by the system. 92 */ 93 static const std::string COMMON_EVENT_USER_PRESENT; 94 95 /** 96 * Indicate the action of a common event that the system time has changed. 97 * This common event can only be published by the system. 98 */ 99 static const std::string COMMON_EVENT_TIME_TICK; 100 /** 101 * Indicate the action of a common event that the system time is set. 102 * This common event can only be published by the system. 103 */ 104 static const std::string COMMON_EVENT_TIME_CHANGED; 105 /** 106 * Indicate the action of a common event that the system date has changed. 107 * This common event can only be published by the system. 108 */ 109 static const std::string COMMON_EVENT_DATE_CHANGED; 110 /** 111 * Indicate the action of a common event that the system time zone has changed. 112 * This common event can only be published by the system. 113 */ 114 static const std::string COMMON_EVENT_TIMEZONE_CHANGED; 115 116 /** 117 * Indicate the action of a common event that a user closes a temporary system dialog box. 118 * This common event can only be published by the system. 119 */ 120 static const std::string COMMON_EVENT_CLOSE_SYSTEM_DIALOGS; 121 122 /** 123 * Indicate the action of a common event that a new application package has been installed on the device. 124 * This common event can only be published by the system. 125 */ 126 static const std::string COMMON_EVENT_PACKAGE_ADDED; 127 /** 128 * Indicate the action of a common event that a new version of an installed application package has replaced 129 * the previous one on the device. 130 * This common event can only be published by the system. 131 */ 132 static const std::string COMMON_EVENT_PACKAGE_REPLACED; 133 /** 134 * Indicate the action of a common event that a new version of your application package has replaced 135 * the previous one. This common event is sent only to the application that was replaced. 136 * This common event can only be published by the system. 137 */ 138 static const std::string COMMON_EVENT_MY_PACKAGE_REPLACED; 139 /** 140 * Indicate the action of a common event that an installed application has been uninstalled from the device 141 * with the application data remained. 142 * This common event can only be published by the system. 143 */ 144 static const std::string COMMON_EVENT_PACKAGE_REMOVED; 145 /** 146 * Indicate the action of a common event that an installed bundle has been uninstalled from the device with the 147 * application data remained. 148 * This common event can only be published by the system. 149 */ 150 static const std::string COMMON_EVENT_BUNDLE_REMOVED; 151 /** 152 * Indicate the action of a common event that an installed application, including both the application data and 153 * code, have been completely uninstalled from the device. 154 * This common event can only be published by the system. 155 */ 156 static const std::string COMMON_EVENT_PACKAGE_FULLY_REMOVED; 157 /** 158 * Indicate the action of a common event that an application package has been changed 159 * (for example, a component in the package has been enabled or disabled). 160 * This common event can only be published by the system. 161 */ 162 static const std::string COMMON_EVENT_PACKAGE_CHANGED; 163 /** 164 * Indicate the action of a common event that the user has restarted the application package and killed all its 165 * processes. 166 * This common event can only be published by the system. 167 */ 168 static const std::string COMMON_EVENT_PACKAGE_RESTARTED; 169 /** 170 * Indicate the action of a common event that the user has cleared the application package data. 171 * This common event is published after COMMON_EVENT_PACKAGE_RESTARTED is triggered and the data has been cleared. 172 * This common event can only be published by the system. 173 */ 174 static const std::string COMMON_EVENT_PACKAGE_DATA_CLEARED; 175 /** 176 * Indicate the action of a common event that application packages have been suspended. 177 * This common event can only be published by the system. 178 */ 179 static const std::string COMMON_EVENT_PACKAGES_SUSPENDED; 180 /** 181 * Indicate the action of a common event that application packages have not been suspended. 182 * This common event can only be published by the system. 183 */ 184 static const std::string COMMON_EVENT_PACKAGES_UNSUSPENDED; 185 /** 186 * Indicate the action of a common event that an application package has been suspended. 187 * This common event can only be published by the system. 188 */ 189 static const std::string COMMON_EVENT_MY_PACKAGE_SUSPENDED; 190 /** 191 * Indicate the action of a common event that an application package has not been suspended. 192 * This common event can only be published by the system. 193 */ 194 static const std::string COMMON_EVENT_MY_PACKAGE_UNSUSPENDED; 195 /** 196 * Indicate the action of a common event that a user ID has been removed from the system. 197 * This common event can only be published by the system. 198 */ 199 static const std::string COMMON_EVENT_UID_REMOVED; 200 /** 201 * Indicate the action of a common event that an installed application is started for the first time. 202 * This common event can only be published by the system. 203 */ 204 static const std::string COMMON_EVENT_PACKAGE_FIRST_LAUNCH; 205 /** 206 * Indicate the action of a common event that an application requires system verification. 207 * This common event can only be published by the system. 208 */ 209 static const std::string COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION; 210 /** 211 * Indicate the action of a common event that an application has been verified by the system. 212 * This common event can only be published by the system. 213 */ 214 static const std::string COMMON_EVENT_PACKAGE_VERIFIED; 215 216 /** 217 * Indicate the action of a common event that applications installed on the external storage become 218 * available for the system. 219 * This common event can only be published by the system. 220 */ 221 static const std::string COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE; 222 /** 223 * Indicate the action of a common event that applications installed on the external storage become unavailable for 224 * the system. 225 * This common event can only be published by the system. 226 */ 227 static const std::string COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE; 228 229 /** 230 * Indicates the action of a common event that the device state (for example, orientation and locale) has changed. 231 * This common event can only be published by the system. 232 */ 233 static const std::string COMMON_EVENT_CONFIGURATION_CHANGED; 234 /** 235 * Indicate the action of a common event that the device locale has changed. 236 * This common event can only be published by the system. 237 */ 238 static const std::string COMMON_EVENT_LOCALE_CHANGED; 239 240 /** 241 * Indicate the action of a common event that the device storage is insufficient. 242 */ 243 static const std::string COMMON_EVENT_MANAGE_PACKAGE_STORAGE; 244 245 /** 246 * Indicate the action of a common event that the system is in driving mode. 247 * This is a protected common event, which can be sent only by the system. 248 */ 249 static const std::string COMMON_EVENT_DRIVE_MODE; 250 /** 251 * Indicate the action of a common event that the system is in home mode. 252 * This is a protected common event, which can be sent only by the system. 253 */ 254 static const std::string COMMON_EVENT_HOME_MODE; 255 /** 256 * Indicate the action of a common event that the system is in office mode. 257 * This is a protected common event, which can be sent only by the system. 258 */ 259 static const std::string COMMON_EVENT_OFFICE_MODE; 260 261 /** 262 * Indicate the action of a common event that the window mode is split screen. 263 * This is a protected common event, which can be sent only by the system. 264 */ 265 static const std::string COMMON_EVENT_SPLIT_SCREEN; 266 267 /** 268 * Indicate the action of a common event that the user has been started. 269 */ 270 static const std::string COMMON_EVENT_USER_STARTED; 271 /** 272 * Indicate the action of a common event that the user has been brought to the background. 273 */ 274 static const std::string COMMON_EVENT_USER_BACKGROUND; 275 /** 276 * Indicate the action of a common event that the user has been brought to the foreground. 277 */ 278 static const std::string COMMON_EVENT_USER_FOREGROUND; 279 /** 280 * Indicate the action of a common event that a user switch is happening. 281 * To subscribe to this common event, your application must have the ohos.permission.MANAGE_USERS permission. 282 */ 283 static const std::string COMMON_EVENT_USER_SWITCHED; 284 /** 285 * Indicate the action of a common event that the user is going to be started. 286 * To subscribe to this common event, your application must have the ohos.permission.INTERACT_ACROSS_USERS 287 * permission. 288 */ 289 static const std::string COMMON_EVENT_USER_STARTING; 290 /** 291 * Indicate the action of a common event that the credential-encrypted storage has become unlocked 292 * for the current user when the device is unlocked after being restarted. 293 */ 294 static const std::string COMMON_EVENT_USER_UNLOCKED; 295 /** 296 * Indicate the action of a common event that the user is going to be stopped. 297 * To subscribe to this common event, your application must have the ohos.permission.INTERACT_ACROSS_USERS 298 * permission. 299 */ 300 static const std::string COMMON_EVENT_USER_STOPPING; 301 /** 302 * Indicate the action of a common event that the user has been stopped. 303 */ 304 static const std::string COMMON_EVENT_USER_STOPPED; 305 /** 306 * Indicate the action of a common event about a login of a user with account ID. 307 * This is a protected common event, which can be sent only by the system. 308 */ 309 static const std::string COMMON_EVENT_HWID_LOGIN; 310 /** 311 * Indicate the action of a common event about a logout of a user with account ID. 312 * This is a protected common event, which can be sent only by the system. 313 */ 314 static const std::string COMMON_EVENT_HWID_LOGOUT; 315 /** 316 * Indicate the action of a common event that the account ID is invalid. 317 * This is a protected common event, which can be sent only by the system. 318 */ 319 static const std::string COMMON_EVENT_HWID_TOKEN_INVALID; 320 /** 321 * Indicate the action of a common event about a logoff of a account ID. 322 * This is a protected common event, which can be sent only by the system. 323 */ 324 static const std::string COMMON_EVENT_HWID_LOGOFF; 325 326 /** 327 * Indicate the action of a common event about the Wi-Fi state, such as enabled and disabled. 328 */ 329 static const std::string COMMON_EVENT_WIFI_POWER_STATE; 330 331 /** 332 * Indicate the action of a common event that the Wi-Fi access point has been scanned and proven to be available. 333 * To subscribe to this common event, your application must have the ohos.permission.LOCATION permission. 334 */ 335 static const std::string COMMON_EVENT_WIFI_SCAN_FINISHED; 336 337 /** 338 * Indicate the action of a common event that the Wi-Fi signal strength (RSSI) has changed. 339 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 340 */ 341 static const std::string COMMON_EVENT_WIFI_RSSI_VALUE; 342 343 /** 344 * Indicate the action of a common event that the Wi-Fi connection state has changed. 345 */ 346 static const std::string COMMON_EVENT_WIFI_CONN_STATE; 347 348 /** 349 * Indicate the action of a common event about the Wi-Fi hotspot state, such as enabled or disabled. 350 */ 351 static const std::string COMMON_EVENT_WIFI_HOTSPOT_STATE; 352 353 /** 354 * Indicates the action of a common event that a client has joined the Wi-Fi hotspot of the current device. You can 355 * register this common event to listen for information about the clients joining your hotspot. 356 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 357 */ 358 static const std::string COMMON_EVENT_WIFI_AP_STA_JOIN; 359 360 /** 361 * Indicates the action of a common event that a client has dropped connection to the Wi-Fi hotspot of the current 362 * device. You can register this common event to listen for information about the clients leaving your hotspot. 363 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 364 */ 365 static const std::string COMMON_EVENT_WIFI_AP_STA_LEAVE; 366 367 /** 368 * Indicate the action of a common event that the state of MPLink (an enhanced Wi-Fi feature) has changed. 369 * To subscribe to this common event, your application must have the ohos.permission.MPLINK_CHANGE_STATE permission. 370 */ 371 static const std::string COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE; 372 373 /** 374 * Indicate the action of a common event that the Wi-Fi P2P connection state has changed. 375 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO and 376 * ohos.permission.LOCATION permissions. 377 */ 378 static const std::string COMMON_EVENT_WIFI_P2P_CONN_STATE; 379 380 /** 381 * Indicate the action of a common event about the Wi-Fi P2P state, such as enabled and disabled. 382 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 383 */ 384 static const std::string COMMON_EVENT_WIFI_P2P_STATE_CHANGED; 385 386 /** 387 * Indicate that the Wi-Fi P2P peers state change. 388 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 389 */ 390 static const std::string COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED; 391 392 /** 393 * Indicate that the Wi-Fi P2P discovery state change. 394 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 395 */ 396 static const std::string COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED; 397 398 /** 399 * Indicate that the Wi-Fi P2P current device state change. 400 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 401 */ 402 static const std::string COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED; 403 404 /** 405 * Indicate that the Wi-Fi P2P group info is changed. 406 * To subscribe to this common event, your application must have the ohos.permission.GET_WIFI_INFO permission. 407 */ 408 static const std::string COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED; 409 410 /** 411 * Indicates that network traffic statistics have been updated. 412 */ 413 static const std::string COMMON_EVENT_NETMANAGER_NETSTATES_UPDATED; 414 415 /** 416 * Indicates that the network traffic has exceeded the limit. 417 */ 418 static const std::string COMMON_EVENT_NETMANAGER_NETSTATES_LIMITED; 419 420 /** 421 * Indicate the action of a common event about the connection state of Bluetooth handsfree communication. 422 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 423 */ 424 static const std::string COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE; 425 426 /** 427 * Indicate the action of a common event that the device connected to the Bluetooth handsfree is active. 428 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 429 */ 430 static const std::string COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE; 431 432 /** 433 * Indicate the action of a common event that the connection state of Bluetooth A2DP has changed. 434 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 435 */ 436 static const std::string COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE; 437 438 /** 439 * Indicate the action of a common event about the connection state of Bluetooth A2DP. 440 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 441 */ 442 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE; 443 444 /** 445 * Indicate the action of a common event that the device connected using Bluetooth A2DP is active. 446 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 447 */ 448 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE; 449 450 /** 451 * Indicate the action of a common event that the playing state of Bluetooth A2DP has changed. 452 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 453 */ 454 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE; 455 456 /** 457 * Indicate the action of a common event that the AVRCP connection state of Bluetooth A2DP has changed. 458 */ 459 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE; 460 461 /** 462 * Indicate the action of a common event that the audio codec state of Bluetooth A2DP has changed. 463 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 464 */ 465 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE; 466 467 /** 468 * Indicate the action of a common event that a remote Bluetooth device has been discovered. 469 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH and 470 * ohos.permission.LOCATION permissions. 471 */ 472 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED; 473 474 /** 475 * Indicate the action of a common event that the Bluetooth class of a remote Bluetooth device has changed. 476 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 477 */ 478 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE; 479 480 /** 481 * Indicate the action of a common event that a low level (ACL) connection has been established with a remote 482 * Bluetooth device. 483 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 484 */ 485 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED; 486 487 /** 488 * Indicate the action of a common event that a low level (ACL) connection has been disconnected from a remote 489 * Bluetooth device. 490 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 491 */ 492 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED; 493 494 /** 495 * Indicate the action of a common event that the friendly name of a remote Bluetooth device has been retrieved for 496 * the first time or has been changed since the last retrieval. 497 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 498 */ 499 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE; 500 501 /** 502 * Indicate the action of a common event that the connection state of a remote Bluetooth device has changed. 503 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 504 */ 505 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE; 506 507 /** 508 * Indicate the action of a common event that the battery level of a remote Bluetooth device has been retrieved 509 * for the first time or has been changed since the last retrieval. 510 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 511 */ 512 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE; 513 514 /** 515 * Indicate the action of a common event about the SDP state of a remote Bluetooth device. 516 */ 517 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT; 518 519 /** 520 * Indicate the action of a common event about the UUID connection state of a remote Bluetooth device. 521 * To subscribe to this common event, your application must have the ohos.permission.DISCOVER_BLUETOOTH permission. 522 */ 523 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE; 524 525 /** 526 * Indicate the action of a common event about the pairing request from a remote Bluetooth device. 527 * To subscribe to this common event, your application must have the ohos.permission.DISCOVER_BLUETOOTH permission. 528 */ 529 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ; 530 531 /** 532 * Indicate the action of a common event that Bluetooth pairing is canceled. 533 */ 534 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL; 535 536 /** 537 * Indicate the action of a common event about the connection request from a remote Bluetooth device. 538 */ 539 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ; 540 541 /** 542 * Indicate the action of a common event about the response to the connection request from a remote Bluetooth 543 * device. 544 */ 545 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY; 546 547 /** 548 * Indicate the action of a common event that the connection to a remote Bluetooth device has been canceled. 549 */ 550 static const std::string COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL; 551 552 /** 553 * Indicate the action of a common event that the connection state of a Bluetooth handsfree has changed. 554 */ 555 static const std::string COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE; 556 557 /** 558 * Indicate the action of a common event that the audio state of a Bluetooth handsfree has changed. 559 */ 560 static const std::string COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE; 561 562 /** 563 * Indicate the action of a common event that the audio gateway state of a Bluetooth handsfree has changed. 564 */ 565 static const std::string COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT; 566 567 /** 568 * Indicate the action of a common event that the calling state of a Bluetooth handsfree has changed. 569 */ 570 static const std::string COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE; 571 572 /** 573 * Indicate the action of a common event that the state of a Bluetooth adapter has been changed, for example, 574 * Bluetooth has been turned on or off. 575 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 576 */ 577 static const std::string COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE; 578 579 /** 580 * Indicate the action of a common event about the requests for the user to allow Bluetooth to be scanned. 581 */ 582 static const std::string COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE; 583 584 /** 585 * Indicate the action of a common event about the requests for the user to turn on Bluetooth. 586 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 587 */ 588 static const std::string COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE; 589 590 /** 591 * Indicate the action of a common event about the requests for the user to turn off Bluetooth. 592 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 593 */ 594 static const std::string COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE; 595 596 /** 597 * Indicate the action of a common event that the Bluetooth scanning mode of a device has changed. 598 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 599 */ 600 static const std::string COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE; 601 602 /** 603 * Indicate the action of a common event that the Bluetooth scanning has been started on the device. 604 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 605 */ 606 static const std::string COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED; 607 608 /** 609 * Indicate the action of a common event that the Bluetooth scanning is finished on the device. 610 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 611 */ 612 static const std::string COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED; 613 614 /** 615 * Indicate the action of a common event that the Bluetooth adapter name of the device has changed. 616 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 617 */ 618 static const std::string COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE; 619 620 /** 621 * Indicate the action of a common event that the connection state of Bluetooth A2DP Sink has changed. 622 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 623 */ 624 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE; 625 626 /** 627 * Indicate the action of a common event that the playing state of Bluetooth A2DP Sink has changed. 628 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 629 */ 630 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE; 631 632 /** 633 * Indicate the action of a common event that the audio state of Bluetooth A2DP Sink has changed. 634 * To subscribe to this common event, your application must have the ohos.permission.USE_BLUETOOTH permission. 635 */ 636 static const std::string COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE; 637 638 /** 639 * Indicate the action of a common event that the state of the device NFC adapter has changed. 640 * This is a protected common event, which can be sent only by the system. 641 */ 642 static const std::string COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED; 643 644 /** 645 * Indicate the action of a common event that the NFC RF field is detected to be in the enabled state. 646 * To subscribe to this common event, your application must have the ohos.permission.MANAGE_SECURE_SETTINGS 647 * permission. 648 * This is a protected common event, which can be sent only by the system. 649 */ 650 static const std::string COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED; 651 652 /** 653 * Indicate the action of a common event that the NFC RF field is detected to be in the disabled state. 654 * To subscribe to this common event, your application must have the ohos.permission.MANAGE_SECURE_SETTINGS 655 * permission. 656 * This is a protected common event, which can be sent only by the system. 657 */ 658 static const std::string COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED; 659 660 /** 661 * Indicate the action of a common event that the system stops charging the battery. 662 * This is a protected common event, which can be sent only by the system. 663 */ 664 static const std::string COMMON_EVENT_DISCHARGING; 665 666 /** 667 * Indicate the action of a common event that the system starts charging the battery. 668 * This is a protected common event, which can be sent only by the system. 669 */ 670 static const std::string COMMON_EVENT_CHARGING; 671 672 /** 673 * Indicate the action of a common event that the system idle mode has changed. 674 * This is a protected common event, which can be sent only by the system. 675 */ 676 static const std::string COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED; 677 678 /** 679 * Indicate the action of a common event that the power save mode of the system has changed. 680 * This is a protected common event, which can be sent only by the system. 681 */ 682 static const std::string COMMON_EVENT_POWER_SAVE_MODE_CHANGED; 683 684 /** 685 * Indicate the action of a common event that a user has been added to the system. 686 * To subscribe to this common event, your application must have the ohos.permission.MANAGE_USERS permission. 687 */ 688 static const std::string COMMON_EVENT_USER_ADDED; 689 /** 690 * Indicate the action of a common event that a user has been removed from the system. 691 * To subscribe to this common event, your application must have the ohos.permission.MANAGE_USERS permission. 692 */ 693 static const std::string COMMON_EVENT_USER_REMOVED; 694 695 /** 696 * Indicate the action of a common event that an ability has been added. 697 * To subscribe to this common event, your application must have the ohos.permission.LISTEN_BUNDLE_CHANGE 698 * permission. 699 * This is a protected common event, which can be sent only by the system. 700 */ 701 static const std::string COMMON_EVENT_ABILITY_ADDED; 702 703 /** 704 * Indicate the action of a common event that an ability has been removed. 705 * To subscribe to this common event, your application must have the ohos.permission.LISTEN_BUNDLE_CHANGE 706 * permission. 707 * This is a protected common event, which can be sent only by the system. 708 */ 709 static const std::string COMMON_EVENT_ABILITY_REMOVED; 710 711 /** 712 * Indicate the action of a common event that an ability has been updated. 713 * To subscribe to this common event, your application must have the ohos.permission.LISTEN_BUNDLE_CHANGE 714 * permission. 715 * This is a protected common event, which can be sent only by the system. 716 */ 717 static const std::string COMMON_EVENT_ABILITY_UPDATED; 718 719 /** 720 * Indicate the action of a common event that the location mode of the system has changed. 721 * This is a protected common event, which can be sent only by the system. 722 */ 723 static const std::string COMMON_EVENT_LOCATION_MODE_STATE_CHANGED; 724 725 /** 726 * Indicate the action of a common event that the in-vehicle infotainment (IVI) system of a vehicle is sleeping. 727 * This is a protected common event, which can be sent only by the system. 728 */ 729 static const std::string COMMON_EVENT_IVI_SLEEP; 730 731 /** 732 * The ivi is slept and notify the app stop playing. 733 * This is a protected common event that can only be sent by system. 734 */ 735 static const std::string COMMON_EVENT_IVI_PAUSE; 736 737 /** 738 * Indicate the action of a common event that a third-party application is instructed to pause the current work. 739 * This is a protected common event, which can be sent only by the system. 740 */ 741 static const std::string COMMON_EVENT_IVI_STANDBY; 742 743 /** 744 * Indicate the action of a common event that a third-party application is instructed to save its last mode. 745 * This is a protected common event, which can be sent only by the system. 746 */ 747 static const std::string COMMON_EVENT_IVI_LASTMODE_SAVE; 748 749 /** 750 * Indicate the action of a common event that the voltage of the vehicle power system is abnormal. 751 * This is a protected common event, which can be sent only by the system. 752 */ 753 static const std::string COMMON_EVENT_IVI_VOLTAGE_ABNORMAL; 754 755 /** 756 * The ivi temperature is too high. 757 * This is a protected common event that can only be sent by system. 758 * This common event will be delete later, please use COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL. 759 */ 760 static const std::string COMMON_EVENT_IVI_HIGH_TEMPERATURE; 761 762 /** 763 * The ivi temperature is extreme high. 764 * This is a protected common event that can only be sent by system. 765 * This common event will be delete later, please use COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL. 766 */ 767 static const std::string COMMON_EVENT_IVI_EXTREME_TEMPERATURE; 768 769 /** 770 * Indicate the action of a common event that the in-vehicle system has an extreme temperature. 771 * This is a protected common event, which can be sent only by the system. 772 */ 773 static const std::string COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL; 774 775 /** 776 * Indicate the action of a common event that the voltage of the vehicle power system is restored to normal. 777 * This is a protected common event, which can be sent only by the system. 778 */ 779 static const std::string COMMON_EVENT_IVI_VOLTAGE_RECOVERY; 780 781 /** 782 * Indicate the action of a common event that the temperature of the in-vehicle system is restored to normal. 783 * This is a protected common event, which can be sent only by the system. 784 */ 785 static const std::string COMMON_EVENT_IVI_TEMPERATURE_RECOVERY; 786 787 /** 788 * Indicate the action of a common event that the battery service is active. 789 * This is a protected common event, which can be sent only by the system. 790 */ 791 static const std::string COMMON_EVENT_IVI_ACTIVE; 792 793 /** 794 * The usb state changed. 795 * This is a protected common event that can only be sent by system. 796 */ 797 static const std::string COMMON_EVENT_USB_STATE; 798 799 /** 800 * The usb port changed. 801 * This is a protected common event that can only be sent by system. 802 */ 803 static const std::string COMMON_EVENT_USB_PORT_CHANGED; 804 805 /** 806 * Indicate the action of a common event that a USB device has been attached when the user device functions as a USB 807 * host. 808 * This is a protected common event, which can be sent only by the system. 809 */ 810 static const std::string COMMON_EVENT_USB_DEVICE_ATTACHED; 811 812 /** 813 * Indicate the action of a common event that a USB device has been detached when the user device functions as a USB 814 * host. 815 * This is a protected common event, which can be sent only by the system. 816 */ 817 static const std::string COMMON_EVENT_USB_DEVICE_DETACHED; 818 819 /** 820 * Indicate the action of a common event that a USB accessory has been attached. 821 * This is a protected common event, which can be sent only by the system. 822 */ 823 static const std::string COMMON_EVENT_USB_ACCESSORY_ATTACHED; 824 825 /** 826 * Indicate the action of a common event that a USB accessory has been detached. 827 * This is a protected common event, which can be sent only by the system. 828 */ 829 static const std::string COMMON_EVENT_USB_ACCESSORY_DETACHED; 830 831 /** 832 * The storage space is low. 833 * This is a protected common event that can only be sent by system. 834 */ 835 static const std::string COMMON_EVENT_DEVICE_STORAGE_LOW; 836 837 /** 838 * The storage space is normal. 839 * This is a protected common event that can only be sent by system. 840 */ 841 static const std::string COMMON_EVENT_DEVICE_STORAGE_OK; 842 843 /** 844 * The storage space is full. 845 * This is a protected common event that can only be sent by system. 846 */ 847 static const std::string COMMON_EVENT_DEVICE_STORAGE_FULL; 848 849 /** 850 * The network connection was changed. 851 * This is a protected common event that can only be sent by system. 852 */ 853 static const std::string COMMON_EVENT_CONNECTIVITY_CHANGE; 854 855 /** 856 * Indicate the action of a common event that an external storage device was removed. 857 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 858 * ohos.permission.READ_USER_STORAGE permission. 859 * This common event can be published only by system applications. 860 */ 861 static const std::string COMMON_EVENT_DISK_REMOVED; 862 863 /** 864 * Indicate the action of a common event that an external storage device was unmounted. 865 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 866 * ohos.permission.READ_USER_STORAGE permission. 867 * This common event can be published only by system applications. 868 */ 869 static const std::string COMMON_EVENT_DISK_UNMOUNTED; 870 871 /** 872 * Indicate the action of a common event that an external storage device was mounted. 873 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 874 * ohos.permission.READ_USER_STORAGE permission. 875 * This common event can be published only by system applications. 876 */ 877 static const std::string COMMON_EVENT_DISK_MOUNTED; 878 879 /** 880 * Indicate the action of a common event that an external storage device was removed without being unmounted. 881 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 882 * ohos.permission.READ_USER_STORAGE permission. 883 * This common event can be published only by system applications. 884 */ 885 static const std::string COMMON_EVENT_DISK_BAD_REMOVAL; 886 887 /** 888 * Indicate the action of a common event that an external storage device becomes unmountable. 889 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 890 * ohos.permission.READ_USER_STORAGE permission. 891 * This common event can be published only by system applications. 892 */ 893 static const std::string COMMON_EVENT_DISK_UNMOUNTABLE; 894 895 /** 896 * Indicate the action of a common event that an external storage device was ejected. 897 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 898 * ohos.permission.READ_USER_STORAGE permission. 899 * This common event can be published only by system applications. 900 */ 901 static const std::string COMMON_EVENT_DISK_EJECT; 902 903 /** 904 * Indicate the action of a common event that an external storage device was removed. 905 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 906 * ohos.permission.READ_USER_STORAGE permission. 907 * This common event can be published only by system applications. 908 */ 909 static const std::string COMMON_EVENT_VOLUME_REMOVED; 910 911 /** 912 * Indicate the action of a common event that an external storage device was unmounted. 913 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 914 * ohos.permission.READ_USER_STORAGE permission. 915 * This common event can be published only by system applications. 916 */ 917 static const std::string COMMON_EVENT_VOLUME_UNMOUNTED; 918 919 /** 920 * Indicate the action of a common event that an external storage device was mounted. 921 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 922 * ohos.permission.READ_USER_STORAGE permission. 923 * This common event can be published only by system applications. 924 */ 925 static const std::string COMMON_EVENT_VOLUME_MOUNTED; 926 927 /** 928 * Indicate the action of a common event that an external storage device was removed without being unmounted. 929 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 930 * ohos.permission.READ_USER_STORAGE permission. 931 * This common event can be published only by system applications. 932 */ 933 static const std::string COMMON_EVENT_VOLUME_BAD_REMOVAL; 934 935 /** 936 * Indicate the action of a common event that an external storage device was ejected. 937 * To subscribe to this common event, your application must have the ohos.permission.WRITE_USER_STORAGE or 938 * ohos.permission.READ_USER_STORAGE permission. 939 * This common event can be published only by system applications. 940 */ 941 static const std::string COMMON_EVENT_VOLUME_EJECT; 942 943 /** 944 * Indicate the action of a common event that the account visible changed. 945 * To subscribe to this common event, your application must have the ohos.permission.GET_APP_ACCOUNTS permission. 946 * This is a protected common event, which can be sent only by the system. 947 */ 948 static const std::string COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED; 949 950 /** 951 * Indicate the action of a common event that the account is deleted. 952 * To subscribe to this common event, your application must have the ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS 953 * permission. 954 * This is a protected common event, which can be sent only by the system. 955 */ 956 static const std::string COMMON_EVENT_ACCOUNT_DELETED; 957 958 /** 959 * Indicate the action of a common event that the foundation is ready. 960 * To subscribe to this common event, your application must have the ohos.permission.RECEIVER_STARTUP_COMPLETED 961 * permission. 962 * This is a protected common event, which can be sent only by the system. 963 */ 964 static const std::string COMMON_EVENT_FOUNDATION_READY; 965 966 /** 967 * Indicates the action of a common event that the phone SIM card state has changed. 968 * This is a protected common event that can only be sent by system. 969 */ 970 static const std::string COMMON_EVENT_SIM_CARD_DEFAULT_VOICE_SUBSCRIPTION_CHANGED; 971 972 /** 973 * Indicates the action of a common event that the phone SIM card state has changed. 974 * This is a protected common event that can only be sent by system. 975 */ 976 static const std::string COMMON_EVENT_SIM_STATE_CHANGED; 977 978 /** 979 * Indicate the action of a common event that the airplane mode of the device has changed. 980 * This common event can be triggered only by system applications. 981 */ 982 static const std::string COMMON_EVENT_AIRPLANE_MODE_CHANGED; 983 984 /** 985 * Indicate the action of a common event that a new sms bas been received by the device. 986 * This common event can be triggered only by system. 987 */ 988 static const std::string COMMON_EVENT_SMS_RECEIVE_COMPLETED; 989 990 /** 991 * Indicate the action of a common event that a new sms emergency cell broadcast bas been received by the device. 992 * This common event can be triggered only by system. 993 */ 994 static const std::string COMMON_EVENT_SMS_EMERGENCY_CB_COMPLETED; 995 996 /** 997 * Indicate the action of a common event that a new sms normal cell broadcast bas been received by the device. 998 * This common event can be triggered only by system. 999 */ 1000 static const std::string COMMON_EVENT_SMS_CB_RECEIVE_COMPLETED; 1001 1002 /** 1003 * Indicate the action of a common event that a STK command has been received by the device. 1004 * This common event can be triggered only by system. 1005 */ 1006 static const std::string COMMON_EVENT_STK_COMMAND; 1007 1008 /** 1009 * Indicate the action of a common event that STK session end. 1010 * This common event can be triggered only by system. 1011 */ 1012 static const std::string COMMON_EVENT_STK_SESSION_END; 1013 1014 /** 1015 * Indicate the action of a common event that the STK phone card state has changed. 1016 * This common event can be triggered only by system. 1017 */ 1018 static const std::string COMMON_EVENT_STK_CARD_STATE_CHANGED; 1019 1020 /** 1021 * Indicate the action of a common event that an alpha string during call control has been received by the device. 1022 * This common event can be triggered only by system. 1023 */ 1024 static const std::string COMMON_EVENT_STK_ALPHA_IDENTIFIER; 1025 1026 /** 1027 * Indicate the action of a common event that the spn display information has been updated. 1028 * This common event can be triggered only by system. 1029 */ 1030 static const std::string COMMON_EVENT_SPN_INFO_UPDATED; 1031 1032 /** 1033 * Indicate the action of a common event that the NITZ time has been updated. 1034 * This is a protected common event that can only be sent by system. 1035 */ 1036 static const std::string COMMON_EVENT_NITZ_TIME_UPDATED; 1037 1038 /** 1039 * Indicate the action of a common event that the NITZ time zone has been updated. 1040 * This is a protected common event that can only be sent by system. 1041 */ 1042 static const std::string COMMON_EVENT_NITZ_TIMEZONE_UPDATED; 1043 1044 /** 1045 * Only for test case. 1046 */ 1047 static const std::string COMMON_EVENT_TEST_ACTION1; 1048 1049 /** 1050 * Only for test case. 1051 */ 1052 static const std::string COMMON_EVENT_TEST_ACTION2; 1053 1054 public: 1055 /** 1056 * Default constructor used to create an empty CommonEventSupport instance. 1057 */ 1058 CommonEventSupport(); 1059 1060 /** 1061 * Default deconstructor used to deconstruct. 1062 */ 1063 virtual ~CommonEventSupport(); 1064 1065 /** 1066 * Check whether the current common event is a system common event. 1067 * @param str the action of a common event. 1068 * @return whether the current common event is a system common event or not. 1069 */ 1070 bool IsSystemEvent(std::string &str); 1071 1072 private: 1073 void Init(); 1074 1075 private: 1076 std::vector<std::string> commonEventSupport_; 1077 }; 1078 } // namespace EventFwk 1079 } // namespace OHOS 1080 1081 #endif // FOUNDATION_EVENT_CESFWK_KITS_NATIVE_INCLUDE_COMMON_EVENT_SUPPORT_H