AJA NTV2 SDK  17.5.0.1492
NTV2 SDK 17.5.0.1492
pnp.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #include <assert.h>
9 #include "ajabase/pnp/pnp.h"
10 
11 #if defined(AJA_WINDOWS)
13 #endif
14 
15 #if defined(AJA_LINUX)
17 #endif
18 
19 #if defined(AJA_MAC)
20  #include "ajabase/pnp/mac/pnpimpl.h"
21 #endif
22 
23 
24 std::string AJAPnp::MessageToString (const AJAPnpMessage inMsg) // STATIC
25 {
26  switch (inMsg)
27  {
28  case AJA_Pnp_DeviceAdded: return "AJA_Pnp_DeviceAdded";
29  case AJA_Pnp_DeviceRemoved: return "AJA_Pnp_DeviceRemoved";
30  case AJA_Pnp_DeviceOnline: return "AJA_Pnp_DeviceOnline";
31  case AJA_Pnp_DeviceOffline: return "AJA_Pnp_DeviceOffline";
32  case AJA_Pnp_DeviceGoingToSleep: return "AJA_Pnp_DeviceGoingToSleep";
33  case AJA_Pnp_DeviceWakingUp: return "AJA_Pnp_DeviceWakingUp";
34  }
35  return "";
36 }
37 
39 {
40  mpImpl = new AJAPnpImpl();
41 }
42 
43 
45 {
46  delete mpImpl;
47 }
48 
49 
50 AJAStatus
51 AJAPnp::Install(AJAPnpCallback callback, void* refCon, uint32_t devices)
52 {
53  return mpImpl->Install(callback, refCon, devices);
54 }
55 
56 
59 {
60  return mpImpl->Uninstall();
61 }
62 
63 
66 {
67  return mpImpl->GetCallback();
68 }
69 
70 
71 void*
73 {
74  return mpImpl->GetRefCon();
75 }
76 
77 
78 uint32_t
80 {
81  return mpImpl->GetPnpDevices();
82 }
83 
84 
85 AJAPnp::AJAPnp (const AJAPnp & inObjToCopy)
86 {
87  AJA_UNUSED(inObjToCopy); assert (false && "hidden copy constructor"); // mpImpl=inObjToCopy.mpImpl;
88 }
89 
90 
91 AJAPnp &
92 AJAPnp::operator= (const AJAPnp & inObjToCopy)
93 {
94  if (&inObjToCopy != this)
95  assert (false && "hidden assignment operator"); // mpImpl = inObjToCopy.mpImpl;
96 
97  return *this;
98 
99 } // copy constructor
AJAPnpImpl::Uninstall
AJAStatus Uninstall(void)
Definition: pnpimpl.cpp:62
AJAPnp
This is a platform-agnostic plug-and-play class that notifies a client when AJA devices are attached/...
Definition: pnp.h:50
AJA_Pnp_DeviceGoingToSleep
@ AJA_Pnp_DeviceGoingToSleep
Definition: pnp.h:28
AJAPnpCallback
void(* AJAPnpCallback)(AJAPnpMessage inMessage, void *inRefCon)
If installed (see AJAPnp::Install) in an AJAPnp instance, this function is called when an AJA device ...
Definition: pnp.h:39
AJAPnp::GetCallback
virtual AJAPnpCallback GetCallback() const
Definition: pnp.cpp:65
AJAPnpMessage
AJAPnpMessage
Definition: pnp.h:22
pnpimpl.h
Declares the AJAPnpImpl class.
AJAPnp::GetPnpDevices
virtual uint32_t GetPnpDevices() const
Definition: pnp.cpp:79
AJA_UNUSED
#define AJA_UNUSED(_x_)
Definition: types.h:424
AJAPnp::AJAPnp
AJAPnp()
Default constructor.
Definition: pnp.cpp:38
pnpimpl.h
Declares the AJAPnpImpl class.
AJAPnp::Uninstall
virtual AJAStatus Uninstall()
Uninstalls any previously-installed callback notifier.
Definition: pnp.cpp:58
AJAStatus
AJAStatus
Definition: types.h:378
AJAPnpImpl::GetPnpDevices
uint32_t GetPnpDevices(void) const
Definition: pnpimpl.h:24
AJA_Pnp_DeviceOffline
@ AJA_Pnp_DeviceOffline
Definition: pnp.h:27
AJAPnpImpl::Install
AJAStatus Install(AJAPnpCallback callback, void *refCon, uint32_t devices)
Definition: pnpimpl.cpp:32
AJAPnp::~AJAPnp
virtual ~AJAPnp()
Default destructor.
Definition: pnp.cpp:44
AJA_Pnp_DeviceOnline
@ AJA_Pnp_DeviceOnline
Definition: pnp.h:26
AJAPnp::MessageToString
static std::string MessageToString(const AJAPnpMessage inMsg)
Converts an AJAPnpMessage into a human-readable string.
Definition: pnp.cpp:24
AJA_Pnp_DeviceRemoved
@ AJA_Pnp_DeviceRemoved
Definition: pnp.h:25
AJAPnpImpl
Definition: pnpimpl.h:13
pnp.h
Declares the AJAPnp (plug-and-play) class.
pnpimpl.h
Declares the AJAPnpImpl class.
AJAPnpImpl::GetCallback
AJAPnpCallback GetCallback(void) const
Definition: pnpimpl.h:22
AJA_Pnp_DeviceWakingUp
@ AJA_Pnp_DeviceWakingUp
Definition: pnp.h:29
AJAPnp::Install
virtual AJAStatus Install(AJAPnpCallback pInCallback, void *inRefCon=NULL, uint32_t inDeviceMask=0xFFFFFFFF)
Installs the given plug & play notification callback function, replacing any callback function that m...
Definition: pnp.cpp:51
AJA_Pnp_DeviceAdded
@ AJA_Pnp_DeviceAdded
Definition: pnp.h:24
AJAPnp::GetRefCon
virtual void * GetRefCon() const
Definition: pnp.cpp:72
AJAPnpImpl::GetRefCon
void * GetRefCon(void) const
Definition: pnpimpl.h:23