kodi
ZeroconfAndroid.h
1 /*
2  * Copyright (C) 2017 Christian Browet
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "network/Zeroconf.h"
12 #include "threads/CriticalSection.h"
13 
14 #include "platform/android/activity/JNIXBMCNsdManagerRegistrationListener.h"
15 
16 #include <androidjni/NsdManager.h>
17 #include <androidjni/NsdServiceInfo.h>
18 
20 {
21 public:
23  ~CZeroconfAndroid() override;
24 
25  // CZeroconf interface
26 protected:
27  bool doPublishService(const std::string& fcr_identifier, const std::string& fcr_type, const std::string& fcr_name, unsigned int f_port, const std::vector<std::pair<std::string, std::string>>& txt) override;
28  bool doForceReAnnounceService(const std::string& fcr_identifier) override;
29  bool doRemoveService(const std::string& fcr_ident) override;
30  void doStop() override;
31 
32 private:
33  jni::CJNINsdManager m_manager;
34 
35  //lock + data (accessed from runloop(main thread) + the rest)
36  CCriticalSection m_data_guard;
37  struct tServiceRef
38  {
39  jni::CJNINsdServiceInfo serviceInfo;
41  int updateNumber;
42  };
43  typedef std::map<std::string, struct tServiceRef> tServiceMap;
44  tServiceMap m_services;
45 };
Definition: ZeroconfAndroid.h:19
Definition: JNIXBMCNsdManagerRegistrationListener.h:17
this class provides support for zeroconf while the different zeroconf implementations have asynchrono...
Definition: Zeroconf.h:28