1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 #ifndef HDF_SERVICE_STATUS_H 9 #define HDF_SERVICE_STATUS_H 10 11 #include "hdf_types.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif /* __cplusplus */ 16 17 struct HdfSBuf; 18 struct ServiceStatusListener; 19 20 enum ServiceStatusType { 21 SERVIE_STATUS_START, 22 SERVIE_STATUS_CHANGE, 23 SERVIE_STATUS_STOP, 24 SERVIE_STATUS_MAX, 25 }; 26 27 enum ServiceStatusListenerCmd { 28 SERVIE_STATUS_LISTENER_NOTIFY, 29 SERVIE_STATUS_LISTENER_MAX, 30 }; 31 32 struct ServiceStatus { 33 const char* serviceName; 34 uint16_t deviceClass; /* ref to DeviceClass */ 35 uint16_t status; /* ref to ServiceStatusType */ 36 const char *info; 37 }; 38 39 typedef void (*OnServiceStatusReceived)(struct ServiceStatusListener *, struct ServiceStatus *); 40 41 struct ServiceStatusListener { 42 OnServiceStatusReceived callback; 43 void *priv; 44 }; 45 46 int ServiceStatusMarshalling(struct ServiceStatus *status, struct HdfSBuf *buf); 47 int ServiceStatusUnMarshalling(struct ServiceStatus *status, struct HdfSBuf *buf); 48 49 #ifdef __cplusplus 50 } 51 #endif /* __cplusplus */ 52 53 #endif /* HDF_SERVICE_STATUS_H */