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 #include <cstdint> 17 #include <unistd.h> 18 19 #include "device_manager_log.h" 20 #include "device_manager_errno.h" 21 #include "hichain_connector.h" 22 #include "server_stub.h" 23 #include "server_init.h" 24 #include "samgr_lite.h" 25 #include "softbus_adapter.h" 26 27 using namespace OHOS::DistributedHardware; 28 Server_Init()29void Server_Init() 30 { 31 const int32_t DM_SERVICE_INIT_DELAY = 2; 32 33 sleep(DM_SERVICE_INIT_DELAY); 34 SAMGR_Bootstrap(); 35 36 if (SoftbusAdapter::Init() != DEVICEMANAGER_OK) { 37 DMLOG(DM_LOG_ERROR, "softbus adapter init failed"); 38 return; 39 } 40 if (HichainConnector::GetInstance().Init() != DEVICEMANAGER_OK) { 41 DMLOG(DM_LOG_ERROR, "hichain connector init failed"); 42 return; 43 } 44 45 DMLOG(DM_LOG_INFO, "DM server Init success"); 46 } 47