interfacing between transports written in different programming languages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

80 lines
3.4 KiB

#import <Foundation/Foundation.h>
#import "PEPObjCTypes.h"
#import "PEPTransportStatusCode.h"
@class PEPTransportConfig;
@class PEPSession;
@class PEPTransport;
@class PEPMessage;
NS_ASSUME_NONNULL_BEGIN
@protocol PEPTransportSendToResultDelegate <NSObject>
- (void)signalSendToResultWithTransportID:(PEPTransportID)transportID
messageID:(NSString *)messageID
address:(NSString *)address
statusCode:(PEPTransportStatusCode)statusCode;
@end
@protocol PEPTransportIncomingMessageDelegate <NSObject>
- (void)signalIncomingMessageWithTransportID:(PEPTransportID)transportID
statusCode:(PEPTransportStatusCode)statusCode;
@end
@protocol PEPTransportStatusChangeDelegate <NSObject>
- (void)signalStatusChangeWithTransportID:(PEPTransportID)transportID
statusCode:(PEPTransportStatusCode)statusCode;
@end
/// Idea in a nutshell:
/// - Init with callbacks and callbackExecutionType
/// - configure
/// - startup
/// - listen to status changes (e.g. connected aka "PEPTransportStatusCodeReady"
/// - use it:
/// - send message
/// - listen to- and handle sendMessageResult (e.g. done sending aka "PEPTransportStatusCodeMessageDelivered")
/// - listen to incomingMessage delegate
/// - call nextMessage to get it
/// shutdown
@protocol PEPTransportProtocol <NSObject>
@property (weak, nonatomic) id<PEPTransportSendToResultDelegate> signalSendToResultDelegate;
@property (weak, nonatomic) id<PEPTransportIncomingMessageDelegate> signalIncomingMessageDelegate;
@property (weak, nonatomic) id<PEPTransportStatusChangeDelegate> signalStatusChangeDelegate;
- (instancetype)init;
/// Convenience initializer.
- (_Nullable instancetype)initWithSignalStatusChangeDelegate:(id<PEPTransportStatusChangeDelegate> _Nullable)signalStatusChangeDelegate
signalSendToResultDelegate:(id<PEPTransportSendToResultDelegate> _Nullable)signalSendToResultDelegate
signalIncomingMessageDelegate:(id<PEPTransportIncomingMessageDelegate> _Nullable)signalIncomingMessageDelegate
error:(NSError * _Nullable * _Nullable)error;
- (BOOL) configure:(PEPTransport * _Nullable)pEptransport
withConfig:(PEPTransportConfig *)config
transportStatusCode:(out PEPTransportStatusCode * _Nullable)tsc
error:(NSError * _Nullable * _Nullable)error;
- (BOOL) startup:(PEPTransport * _Nullable)pEptransport
transportStatusCode:(out PEPTransportStatusCode*)tsc
error:(NSError * _Nullable * _Nullable)error;
- (BOOL) shutdown:(PEPTransport * _Nullable)pEptransport
transportStatusCode:(out PEPTransportStatusCode * _Nullable)tsc
error:(NSError * _Nullable * _Nullable)error;
- (BOOL) sendMessage:(PEPMessage *)msg pEpSession:(PEPSession * _Nullable)pEpSession
transportStatusCode:(out PEPTransportStatusCode * _Nullable)tsc
error:(NSError * _Nullable * _Nullable)error;
- (PEPMessage * _Nullable)nextMessageWithPEPSession:(PEPSession * _Nullable)pEpsession
transportStatusCode:(out PEPTransportStatusCode * _Nullable)tsc
error:(NSError * _Nullable * _Nullable)error;
@end
NS_ASSUME_NONNULL_END