//
//  RYError.h
//  SDK
//
//  Created by ldc on 2024/6/3.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, RYErrorCode) {
    RYErrorCodeExternAccessoryDidDisconnect = 0,
    RYErrorCodeCentralManagerStatePoweredOff,
    RYErrorCodeReadData,
    RYErrorCodeWriteData,
#if TARGET_OS_OSX
    RYErrorCodeRFCOMMChannelClosed = 1000,
    RYErrorCodeUSBAccessoryRemoved,
#endif
};

extern NSErrorDomain RYErrorDomain;

extern NSErrorUserInfoKey RYInnerErrorUserInfoKey;

NSError *RYErrorFromCode(RYErrorCode code);

NSError *RYErrorFromCodeWithInnerError(RYErrorCode code, NSError * _Nullable error);

NSError *RYErrorFromPackageError(NSInteger status);

NS_ASSUME_NONNULL_END
