Tong
2021-09-06 5017131971e6ac8f31adc2ed1e25583738b420a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
using System;
using CoreBluetooth;
using Foundation;
using ObjCRuntime;
 
namespace HdlBlufi
{
    #region espclient
    // @interface BlufiConstants : NSObject
    [BaseType(typeof(NSObject))]
    interface BlufiConstants
    {
    }
 
    // @interface BlufiStatusResponse : NSObject
    [BaseType(typeof(NSObject))]
    interface BlufiStatusResponse
    {
        // @property (assign, nonatomic) OpMode opMode;
        [Export("opMode", ArgumentSemantic.Assign)]
        OpMode OpMode { get; set; }
 
        // @property (assign, nonatomic) SoftAPSecurity softApSecurity;
        [Export("softApSecurity", ArgumentSemantic.Assign)]
        SoftAPSecurity SoftApSecurity { get; set; }
 
        // @property (assign, nonatomic) int softApConnectionCount;
        [Export("softApConnectionCount")]
        int SoftApConnectionCount { get; set; }
 
        // @property (assign, nonatomic) int softApMaxConnection;
        [Export("softApMaxConnection")]
        int SoftApMaxConnection { get; set; }
 
        // @property (assign, nonatomic) int softApChannel;
        [Export("softApChannel")]
        int SoftApChannel { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull softApPassword;
        [Export("softApPassword", ArgumentSemantic.Strong)]
        string SoftApPassword { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull softApSsid;
        [Export("softApSsid", ArgumentSemantic.Strong)]
        string SoftApSsid { get; set; }
 
        // @property (assign, nonatomic) int staConnectionStatus;
        [Export("staConnectionStatus")]
        int StaConnectionStatus { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull staBssid;
        [Export("staBssid", ArgumentSemantic.Strong)]
        string StaBssid { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull staSsid;
        [Export("staSsid", ArgumentSemantic.Strong)]
        string StaSsid { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull staPassword;
        [Export("staPassword", ArgumentSemantic.Strong)]
        string StaPassword { get; set; }
 
        // -(BOOL)isStaConnectWiFi;
        [Export("isStaConnectWiFi")]
        //[Verify(MethodToProperty)]
        bool IsStaConnectWiFi { get; }
 
        // -(NSString * _Nonnull)getStatusInfo;
        [Export("getStatusInfo")]
        //[Verify(MethodToProperty)]
        string StatusInfo { get; }
    }
 
    // @interface BlufiScanResponse : NSObject
    [BaseType(typeof(NSObject))]
    interface BlufiScanResponse
    {
        // @property (assign, nonatomic) int type;
        [Export("type")]
        int Type { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull ssid;
        [Export("ssid", ArgumentSemantic.Strong)]
        string Ssid { get; set; }
 
        // @property (assign, nonatomic) int8_t rssi;
        [Export("rssi")]
        sbyte Rssi { get; set; }
    }
 
    // @interface BlufiVersionResponse : NSObject
    [BaseType(typeof(NSObject))]
    interface BlufiVersionResponse
    {
        // @property (assign, nonatomic) Byte bigVer;
        [Export("bigVer")]
        byte BigVer { get; set; }
 
        // @property (assign, nonatomic) Byte smallVer;
        [Export("smallVer")]
        byte SmallVer { get; set; }
 
        // -(NSString * _Nonnull)getVersionString;
        [Export("getVersionString")]
        //[Verify(MethodToProperty)]
        string VersionString { get; }
    }
 
    // @interface BlufiConfigureParams : NSObject
    [BaseType(typeof(NSObject))]
    interface BlufiConfigureParams
    {
        // @property (assign, nonatomic) OpMode opMode;
        [Export("opMode", ArgumentSemantic.Assign)]
        OpMode OpMode { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull staBssid;
        [Export("staBssid", ArgumentSemantic.Strong)]
        string StaBssid { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull staSsid;
        [Export("staSsid", ArgumentSemantic.Strong)]
        string StaSsid { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull staPassword;
        [Export("staPassword", ArgumentSemantic.Strong)]
        string StaPassword { get; set; }
 
        // @property (assign, nonatomic) SoftAPSecurity softApSecurity;
        [Export("softApSecurity", ArgumentSemantic.Assign)]
        SoftAPSecurity SoftApSecurity { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull softApSsid;
        [Export("softApSsid", ArgumentSemantic.Strong)]
        string SoftApSsid { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull softApPassword;
        [Export("softApPassword", ArgumentSemantic.Strong)]
        string SoftApPassword { get; set; }
 
        // @property (assign, nonatomic) NSInteger softApChannel;
        [Export("softApChannel")]
        nint SoftApChannel { get; set; }
 
        // @property (assign, nonatomic) NSInteger softApMaxConnection;
        [Export("softApMaxConnection")]
        nint SoftApMaxConnection { get; set; }
    }
 
    // @interface BlufiClient : NSObject
    [BaseType(typeof(NSObject))]
    interface BlufiClient
    {
        [Wrap("WeakBlufiDelegate")]
        [NullAllowed]
        BlufiDelegate BlufiDelegate { get; set; }
 
        // @property (nonatomic, weak) id<BlufiDelegate> _Nullable blufiDelegate;
        [NullAllowed, Export("blufiDelegate", ArgumentSemantic.Weak)]
        NSObject WeakBlufiDelegate { get; set; }
 
        // @property (nonatomic, weak) id<CBCentralManagerDelegate> _Nullable centralManagerDelete;
        [NullAllowed, Export("centralManagerDelete", ArgumentSemantic.Weak)]
        CBCentralManagerDelegate CentralManagerDelete { get; set; }
 
        [Wrap("WeakPeripheralDelegate")]
        [NullAllowed]
        CBPeripheralDelegate PeripheralDelegate { get; set; }
 
        // @property (nonatomic, weak) id<CBPeripheralDelegate> _Nullable peripheralDelegate;
        [NullAllowed, Export("peripheralDelegate", ArgumentSemantic.Weak)]
        NSObject WeakPeripheralDelegate { get; set; }
 
        // @property (assign, nonatomic) NSInteger postPackageLengthLimit;
        [Export("postPackageLengthLimit")]
        nint PostPackageLengthLimit { get; set; }
 
        // -(void)connect:(NSString * _Nonnull)identifier;
        [Export("connect:")]
        void Connect(string identifier);
 
        // -(void)close;
        [Export("close")]
        void Close();
 
        // -(void)negotiateSecurity;
        [Export("negotiateSecurity")]
        void NegotiateSecurity();
 
        // -(void)requestCloseConnection;
        [Export("requestCloseConnection")]
        void RequestCloseConnection();
 
        // -(void)requestDeviceVersion;
        [Export("requestDeviceVersion")]
        void RequestDeviceVersion();
 
        // -(void)requestDeviceStatus;
        [Export("requestDeviceStatus")]
        void RequestDeviceStatus();
 
        // -(void)requestDeviceScan;
        [Export("requestDeviceScan")]
        void RequestDeviceScan();
 
        // -(void)configure:(BlufiConfigureParams * _Nonnull)params;
        [Export("configure:")]
        void Configure(BlufiConfigureParams @params);
 
        // -(void)postCustomData:(NSData * _Nonnull)data;
        [Export("postCustomData:")]
        void PostCustomData(NSData data);
    }
 
    // @protocol BlufiDelegate <NSObject>
    [Protocol, Model(AutoGeneratedName = true)]
    [BaseType(typeof(NSObject))]
    interface BlufiDelegate
    {
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client gattPrepared:(BlufiStatusCode)status service:(CBService * _Nullable)service writeChar:(CBCharacteristic * _Nullable)writeChar notifyChar:(CBCharacteristic * _Nullable)notifyChar;
        [Export("blufi:gattPrepared:service:writeChar:notifyChar:")]
        void Blufi_gattPrepared(BlufiClient client, BlufiStatusCode status, [NullAllowed] CBService service, [NullAllowed] CBCharacteristic writeChar, [NullAllowed] CBCharacteristic notifyChar);
 
        // @optional -(BOOL)blufi:(BlufiClient * _Nonnull)client gattNotification:(NSData * _Nonnull)data packageType:(PackageType)pkgType subType:(SubType)subType;
        [Export("blufi:gattNotification:packageType:subType:")]
        bool Blufi_gattNotification(BlufiClient client, NSData data, PackageType pkgType, uint subType);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didReceiveError:(NSInteger)errCode;
        [Export("blufi:didReceiveError:")]
        void Blufi_didReceiveError(BlufiClient client, nint errCode);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didNegotiateSecurity:(BlufiStatusCode)status;
        [Export("blufi:didNegotiateSecurity:")]
        void Blufi_didNegotiateSecurity(BlufiClient client, BlufiStatusCode status);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didPostConfigureParams:(BlufiStatusCode)status;
        [Export("blufi:didPostConfigureParams:")]
        void Blufi_didPostConfigureParams(BlufiClient client, BlufiStatusCode status);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didReceiveDeviceVersionResponse:(BlufiVersionResponse * _Nullable)response status:(BlufiStatusCode)status;
        [Export("blufi:didReceiveDeviceVersionResponse:status:")]
        void Blufi_didReceiveDeviceVersionResponse(BlufiClient client, [NullAllowed] BlufiVersionResponse response, BlufiStatusCode status);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didReceiveDeviceStatusResponse:(BlufiStatusResponse * _Nullable)response status:(BlufiStatusCode)status;
        [Export("blufi:didReceiveDeviceStatusResponse:status:")]
        void Blufi_didReceiveDeviceStatusResponse(BlufiClient client, [NullAllowed] BlufiStatusResponse response, BlufiStatusCode status);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didReceiveDeviceScanResponse:(NSArray<BlufiScanResponse *> * _Nullable)scanResults status:(BlufiStatusCode)status;
        [Export("blufi:didReceiveDeviceScanResponse:status:")]
        void Blufi_didReceiveDeviceScanResponse(BlufiClient client, [NullAllowed] BlufiScanResponse[] scanResults, BlufiStatusCode status);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didPostCustomData:(NSData * _Nonnull)data status:(BlufiStatusCode)status;
        [Export("blufi:didPostCustomData:status:")]
        void Blufi_didPostCustomData(BlufiClient client, NSData data, BlufiStatusCode status);
 
        // @optional -(void)blufi:(BlufiClient * _Nonnull)client didReceiveCustomData:(NSData * _Nonnull)data status:(BlufiStatusCode)status;
        [Export("blufi:didReceiveCustomData:status:")]
        void Blufi_didReceiveCustomData(BlufiClient client, NSData data, BlufiStatusCode status);
    }
    #endregion
 
    #region 搜索蓝牙到客户端
    // @interface ESPPeripheral : NSObject
    [BaseType(typeof(NSObject))]
    interface ESPPeripheral
    {
        // @property (nonatomic, strong) CBPeripheral * _Nonnull peripheral;
        [Export("peripheral", ArgumentSemantic.Strong)]
        CBPeripheral Peripheral { get; set; }
 
        // @property (nonatomic, strong) NSString * _Nonnull name;
        [Export("name", ArgumentSemantic.Strong)]
        string Name { get; set; }
 
        // @property (nonatomic, strong) NSUUID * _Nonnull uuid;
        [Export("uuid", ArgumentSemantic.Strong)]
        NSUuid Uuid { get; set; }
 
        // @property (assign, nonatomic) int rssi;
        [Export("rssi")]
        int Rssi { get; set; }
 
        // -(instancetype _Nonnull)initWithPeripheral:(CBPeripheral * _Nonnull)peripheral;
        [Export("initWithPeripheral:")]
        IntPtr Constructor(CBPeripheral peripheral);
    }
 
    // @interface HdlBluWi : NSObject
    [BaseType(typeof(NSObject))]
    interface HdlBluWi
    {
        // @property (copy, nonatomic) FBYBleDeviceBackBlock bleScanSuccessBlock;
        [Export("bleScanSuccessBlock", ArgumentSemantic.Copy)]
        FBYBleDeviceBackBlock BleScanSuccessBlock { get; set; }
 
        // +(instancetype)share;
        [Static]
        [Export("share")]
        HdlBluWi Share();
 
        // -(void)stopScan;
        [Export("stopScan")]
        void StopScan();
 
        // -(void)startScan:(FBYBleDeviceBackBlock)device;
        [Export("startScan:")]
        void StartScan(FBYBleDeviceBackBlock device);
    }
 
    // typedef void (^FBYBleDeviceBackBlock)(ESPPeripheral *);
    delegate void FBYBleDeviceBackBlock(ESPPeripheral arg0);
    #endregion
 
}