build-ipa/max/template/playbtest/playbtest/PlayB/XUDPClient.h
2025-11-05 10:31:30 +08:00

41 lines
770 B
Objective-C

//
// XUDPClient.h
// xcmd
//
// Created by mac on 2025/2/17.
//
#ifndef XUDPClient_h
#define XUDPClient_h
#import <Foundation/Foundation.h>
#import "CocoaAsyncSocket.h"
@interface XUDPClient : NSObject<GCDAsyncUdpSocketDelegate>
// ⭐️ 单例方法
+ (instancetype)sharedInstance;
// 阻止使用 init 创建新实例
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
// 启动/停止
- (void)start;
- (void)stop;
// 发送方法
- (void)onShow:(NSDictionary *)data toPort:(uint16_t)port;
- (void)onEnd:(NSDictionary *)data toPort:(uint16_t)port;
- (void)send:(NSString *)msg toPort:(uint16_t)port;
// 接收消息回调
@property (nonatomic, copy, nullable) void(^hintBlock)(NSString *message);
@end
#endif /* XUDPClient_h */