Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move IAP EndpointInfo and ConnectionInfo #3199

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions cpp/include/Ice/Connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,68 @@ namespace Ice
{
}
};

/**
* Provides access to the connection details of an IAP connection
* \headerfile Ice/Ice.h
*/
class IAPConnectionInfo final : public ConnectionInfo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't update the Swift code yet even though this renaming makes an update necessary.

I am curious to see if the Swift CI will fail.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems we are not building for iOS, there is some commented out code in the ci workflow:

# # Xcode SDK builds
# # TODO - Should we also test the debug config here as well?
# - macos-15
# config: "xcodesdk"
# working_directory: "cpp"
# build_flags: "CONFIGS=xcodesdk PLATFORMS=iphonesimulator"
# test_flags: "--config=xcodesdk --platform=iphonesimulator --controller-app"
# build_cpp_and_python: true

{
public:
~IAPConnectionInfo() final;
IAPConnectionInfo(const IAPConnectionInfo&) = delete;
IAPConnectionInfo& operator=(const IAPConnectionInfo&) = delete;

/**
* The accessory name.
*/
const std::string name;

/**
* The accessory manufacturer.
*/
const std::string manufacturer;

/**
* The accessory model number.
*/
const std::string modelNumber;

/**
* The accessory firmware revision.
*/
const std::string firmwareRevision;

/**
* The accessory hardware revision.
*/
const std::string hardwareRevision;

/**
* The protocol used by the accessory.
*/
const std::string protocol;

// internal constructor
IAPConnectionInfo(
std::string adapterName,
std::string connectionId,
std::string name,
std::string manufacturer,
std::string modelNumber,
std::string firmwareRevision,
std::string hardwareRevision,
std::string protocol)
: ConnectionInfo{false, std::move(adapterName), std::move(connectionId)},
name{std::move(name)},
manufacturer{std::move(manufacturer)},
modelNumber{std::move(modelNumber)},
firmwareRevision{std::move(firmwareRevision)},
hardwareRevision{std::move(hardwareRevision)},
protocol{std::move(protocol)}
{
}
};
}

#if defined(__clang__)
Expand Down
59 changes: 59 additions & 0 deletions cpp/include/Ice/Endpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,65 @@ namespace Ice
}
};

/**
* Provides access to an IAP endpoint information.
* \headerfile Ice/Ice.h
*/
class IAPEndpointInfo final : public EndpointInfo
{
public:
~IAPEndpointInfo() final;
IAPEndpointInfo(const IAPEndpointInfo&) = delete;
IAPEndpointInfo& operator=(const IAPEndpointInfo&) = delete;

std::int16_t type() const noexcept final { return _type; }
bool secure() const noexcept final { return _secure; }

/**
* The accessory manufacturer or empty to not match against
* a manufacturer.
*/
const std::string manufacturer;
/**
* The accessory model number or empty to not match against
* a model number.
*/
const std::string modelNumber;
/**
* The accessory name or empty to not match against
* the accessory name.
*/
const std::string name;
/**
* The protocol supported by the accessory.
*/
const std::string protocol;

// internal constructor
IAPEndpointInfo(
int timeout,
bool compress,
std::string manufacturer,
std::string modelNumber,
std::string name,
std::string protocol,
std::int16_t type,
bool secure)
: EndpointInfo{timeout, compress},
manufacturer{std::move(manufacturer)},
modelNumber{std::move(modelNumber)},
name{std::move(name)},
protocol{std::move(protocol)},
_type{type},
_secure{secure}
{
}

private:
const std::int16_t _type;
const bool _secure;
};

/**
* Provides access to the details of an opaque endpoint.
* @see Endpoint
Expand Down
5 changes: 0 additions & 5 deletions cpp/include/Ice/Ice.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@
# include "Ice/RemoteLogger.h"
# include "Ice/Router.h"

// Include Apple iAP headers if building for iOS
# if defined(__APPLE__) && TARGET_OS_IPHONE != 0
# include "ios/iAPConnectionInfo.h"
# include "ios/iAPEndpointInfo.h"
# endif
#endif

#endif
76 changes: 0 additions & 76 deletions cpp/include/Ice/ios/iAPConnectionInfo.h

This file was deleted.

74 changes: 0 additions & 74 deletions cpp/include/Ice/ios/iAPEndpointInfo.h

This file was deleted.

1 change: 1 addition & 0 deletions cpp/src/Ice/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Ice::ConnectionInfo::~ConnectionInfo() {}
Ice::TCPConnectionInfo::~TCPConnectionInfo() {}
Ice::UDPConnectionInfo::~UDPConnectionInfo() {}
Ice::WSConnectionInfo::~WSConnectionInfo() {}
Ice::IAPConnectionInfo::~IAPConnectionInfo() {}

Ice::Connection::~Connection() {}

Expand Down
2 changes: 2 additions & 0 deletions cpp/src/Ice/EndpointI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Ice::UDPEndpointInfo::~UDPEndpointInfo() {}

Ice::WSEndpointInfo::~WSEndpointInfo() {}

Ice::IAPEndpointInfo::~IAPEndpointInfo() {}

Ice::OpaqueEndpointInfo::~OpaqueEndpointInfo() {}

void
Expand Down
8 changes: 1 addition & 7 deletions cpp/src/Ice/ios/iAPEndpointI.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
# include "Ice/OutputStream.h"
# include "Ice/Properties.h"
# include "Ice/RegisterPlugins.h"
# include "Ice/ios/iAPConnectionInfo.h"
# include "Ice/ios/iAPEndpointInfo.h"
# include "iAPConnector.h"
# include "iAPEndpointI.h"

Expand Down Expand Up @@ -76,10 +74,6 @@ ICEIAP_API void registerIceIAP(bool loadOnInitialize)
}
}

// Implement virtual destructors out of line to avoid weak vtables.
IceIAP::ConnectionInfo::~ConnectionInfo() {}
IceIAP::EndpointInfo::~EndpointInfo() {}

IceObjC::iAPEndpointI::iAPEndpointI(
const ProtocolInstancePtr& instance,
const string& m,
Expand Down Expand Up @@ -135,7 +129,7 @@ ICEIAP_API void registerIceIAP(bool loadOnInitialize)
IceObjC::iAPEndpointI::getInfo() const noexcept
{
return make_shared<
IceIAP::EndpointInfo>(_timeout, _compress, _manufacturer, _modelNumber, _name, protocol(), type(), secure());
Ice::IAPEndpointInfo>(_timeout, _compress, _manufacturer, _modelNumber, _name, protocol(), type(), secure());
}

int16_t
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/ios/iAPTransceiver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ - (void)stream:(NSStream*)stream handleEvent:(NSStreamEvent)eventCode
IceObjC::iAPTransceiver::getInfo(bool incoming, string adapterName, string connectionId) const
{
assert(!incoming);
assert(adapterName.empty());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #3197.


return make_shared<IceIAP::ConnectionInfo>(
return make_shared<Ice::IAPConnectionInfo>(
std::move(adapterName),
std::move(connectionId),
[_session.accessory.name UTF8String],
[_session.accessory.manufacturer UTF8String],
Expand Down