1 /*
2 * Copyright (c) 2022 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 #include "messenger.h"
17 #include "messenger_impl.h"
18
CreateMessenger(const MessengerConfig * config)19 Messenger *CreateMessenger(const MessengerConfig *config)
20 {
21 return CreateMessengerImpl(config);
22 }
23
DestroyMessenger(Messenger * messenger)24 void DestroyMessenger(Messenger *messenger)
25 {
26 DestroyMessengerImpl(messenger);
27 }
28
IsMessengerReady(const Messenger * messenger)29 bool IsMessengerReady(const Messenger *messenger)
30 {
31 return IsMessengerReadyImpl(messenger);
32 }
33
SendMsgTo(const Messenger * messenger,uint64_t transNo,const DeviceIdentify * devId,const uint8_t * msg,uint32_t msgLen)34 void SendMsgTo(const Messenger *messenger, uint64_t transNo, const DeviceIdentify *devId, const uint8_t *msg,
35 uint32_t msgLen)
36 {
37 SendMsgToImpl(messenger, transNo, devId, msg, msgLen);
38 }
39
GetDeviceOnlineStatus(const Messenger * messenger,const DeviceIdentify * devId,uint32_t * devType)40 bool GetDeviceOnlineStatus(const Messenger *messenger, const DeviceIdentify *devId, uint32_t *devType)
41 {
42 return GetDeviceOnlineStatusImpl(messenger, devId, devType);
43 }
44
GetSelfDeviceIdentify(const Messenger * messenger,DeviceIdentify * devId,uint32_t * devType)45 bool GetSelfDeviceIdentify(const Messenger *messenger, DeviceIdentify *devId, uint32_t *devType)
46 {
47 return GetSelfDeviceIdentifyImpl(messenger, devId, devType);
48 }
49
ForEachDeviceProcess(const Messenger * messenger,const DeviceProcessor processor,void * para)50 void ForEachDeviceProcess(const Messenger *messenger, const DeviceProcessor processor, void *para)
51 {
52 ForEachDeviceProcessImpl(messenger, processor, para);
53 }
54
GetDeviceStatisticInfo(const Messenger * messenger,const DeviceIdentify * devId,StatisticInformation * info)55 bool GetDeviceStatisticInfo(const Messenger *messenger, const DeviceIdentify *devId, StatisticInformation *info)
56 {
57 return GetDeviceStatisticInfoImpl(messenger, devId, info);
58 }