1 /* 2 * Copyright (C) 2023 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 NATIVE_NMEA_CALLBACK_HOST_H 17 #define NATIVE_NMEA_CALLBACK_HOST_H 18 19 #include <string> 20 21 #include "iremote_stub.h" 22 #include "message_option.h" 23 #include "message_parcel.h" 24 25 #include "constant_definition.h" 26 #include "i_nmea_message_callback.h" 27 #include "string_ex.h" 28 29 namespace OHOS { 30 namespace Location { 31 typedef void (* NmeaUpdate)(int64_t timestamp, const std::string msg); 32 33 typedef struct { 34 NmeaUpdate nmeaUpdate; 35 } GnssNmeaCallbackIfaces; 36 37 class NativeNmeaCallbackHost : public IRemoteStub<INmeaMessageCallback> { 38 public: 39 virtual int OnRemoteRequest( 40 uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override; 41 void OnMessageChange(int64_t timestamp, const std::string msg) override; 42 GetCallback()43 inline GnssNmeaCallbackIfaces GetCallback() const 44 { 45 return nmeaCallback_; 46 } 47 SetCallback(const GnssNmeaCallbackIfaces & nmeaCallback)48 inline void SetCallback(const GnssNmeaCallbackIfaces& nmeaCallback) 49 { 50 nmeaCallback_ = nmeaCallback; 51 } 52 53 private: 54 GnssNmeaCallbackIfaces nmeaCallback_; 55 }; 56 } // namespace Location 57 } // namespace OHOS 58 #endif // NATIVE_NMEA_CALLBACK_HOST_H 59