use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MCNearbyServiceAdvertiser;
);
extern_conformance!(
unsafe impl NSObjectProtocol for MCNearbyServiceAdvertiser {}
);
impl MCNearbyServiceAdvertiser {
extern_methods!(
#[cfg(feature = "MCPeerID")]
#[unsafe(method(initWithPeer:discoveryInfo:serviceType:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithPeer_discoveryInfo_serviceType(
this: Allocated<Self>,
my_peer_id: &MCPeerID,
info: Option<&NSDictionary<NSString, NSString>>,
service_type: &NSString,
) -> Retained<Self>;
#[unsafe(method(startAdvertisingPeer))]
#[unsafe(method_family = none)]
pub unsafe fn startAdvertisingPeer(&self);
#[unsafe(method(stopAdvertisingPeer))]
#[unsafe(method_family = none)]
pub unsafe fn stopAdvertisingPeer(&self);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn MCNearbyServiceAdvertiserDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn MCNearbyServiceAdvertiserDelegate>>,
);
#[cfg(feature = "MCPeerID")]
#[unsafe(method(myPeerID))]
#[unsafe(method_family = none)]
pub unsafe fn myPeerID(&self) -> Retained<MCPeerID>;
#[unsafe(method(discoveryInfo))]
#[unsafe(method_family = none)]
pub unsafe fn discoveryInfo(&self) -> Option<Retained<NSDictionary<NSString, NSString>>>;
#[unsafe(method(serviceType))]
#[unsafe(method_family = none)]
pub unsafe fn serviceType(&self) -> Retained<NSString>;
);
}
impl MCNearbyServiceAdvertiser {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait MCNearbyServiceAdvertiserDelegate: NSObjectProtocol {
#[cfg(all(feature = "MCPeerID", feature = "MCSession", feature = "block2"))]
#[unsafe(method(advertiser:didReceiveInvitationFromPeer:withContext:invitationHandler:))]
#[unsafe(method_family = none)]
unsafe fn advertiser_didReceiveInvitationFromPeer_withContext_invitationHandler(
&self,
advertiser: &MCNearbyServiceAdvertiser,
peer_id: &MCPeerID,
context: Option<&NSData>,
invitation_handler: &block2::DynBlock<dyn Fn(Bool, *mut MCSession)>,
);
#[optional]
#[unsafe(method(advertiser:didNotStartAdvertisingPeer:))]
#[unsafe(method_family = none)]
unsafe fn advertiser_didNotStartAdvertisingPeer(
&self,
advertiser: &MCNearbyServiceAdvertiser,
error: &NSError,
);
}
);