//
//  NXDataEngine.h
//  NXKit
//
//  Created by 徐家骏 on 2020/6/17.
//  Copyright © 2020 徐家骏. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <NXSdwan/NXSdwan.h>
#import "NXDataFrameContext.h"
#import "NXWhiteboard.h"

NS_ASSUME_NONNULL_BEGIN

@protocol NXDataEngineDelegate <NSObject>

- (void)onDataReceived:(NSData *)data withContext:(NXDataFrameContext *)frameContext from:(int64_t)from;

@end

@interface NXDataEngine : NSObject<NXTransportSessionDataDelegate>

@property (nonatomic, weak)  id<NXDataEngineDelegate>     delegate;
@property (nonatomic, strong, nullable) NXTransportSession *transportSession; //后改为strong，因为会引起crash

+ (instancetype)sharedInstance;
- (void)Start;
- (void)Stop;

- (void)sendData:(NSData *)data withContext:(NXDataFrameContext *)frameContext;
- (void)sendData:(NSData *)data withContext:(NXDataFrameContext *)frameContext to:(int64_t)uid;

- (void)registerWhiteboard:(NXWhiteboard *)whiteboard forWid:(int)wid;
- (void)unRegisterWhiteboard:(NXWhiteboard *)whiteboard forWid:(int)wid;

@end

NS_ASSUME_NONNULL_END
