summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLProtocolDelegate.h
blob: f3c55902c0c718761e9e4ace10cf3157c6b28305 (plain)
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
//  SDLProtocolDelegate.h
//

#import "SDLProtocolHeader.h"

@class SDLProtocol;
@class SDLProtocolMessage;

NS_ASSUME_NONNULL_BEGIN

@protocol SDLProtocolDelegate <NSObject>

@optional


#pragma mark - Protocol Messages

/// Called when a protocol frame is received.
/// @param msg A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveMessage:(SDLProtocolMessage *)msg;

/// Called when the start service frame succeeds.
/// @discussion This frame can be sent on both the primary and secondary transports
/// @param startServiceACK A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveStartServiceACK:(SDLProtocolMessage *)startServiceACK;

/// Called when the start service frame fails.
/// @discussion This frame can be sent on both the primary and secondary transports
/// @param startServiceNAK A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveStartServiceNAK:(SDLProtocolMessage *)startServiceNAK;

/// Called when the end service frame succeeds.
/// @discussion This frame can be sent on both the primary and secondary transports
/// @param endServiceACK A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveEndServiceACK:(SDLProtocolMessage *)endServiceACK;

/// Called when the end service frame fails.
/// @discussion This frame can be sent on both the primary and secondary transports
/// @param endServiceNAK A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveEndServiceNAK:(SDLProtocolMessage *)endServiceNAK;

#pragma mark Secondary Transport Messages

/// Called when the secondary transport registration frame succeeds.
/// @discussion This frame is only sent on the secondary transport
/// @param registerSecondaryTransportACK A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveRegisterSecondaryTransportACK:(SDLProtocolMessage *)registerSecondaryTransportACK;

/// Called when the secondary transport registration frame fails.
/// @discussion This frame is only sent on the secondary transport
/// @param registerSecondaryTransportNAK A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveRegisterSecondaryTransportNAK:(SDLProtocolMessage *)registerSecondaryTransportNAK;

/// Called when the status or configuration of one or more transports has updated.
/// @discussion This frame is only sent on the primary transport
/// @param transportEventUpdate A SDLProtocolMessage object
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol didReceiveTransportEventUpdate:(SDLProtocolMessage *)transportEventUpdate;

#pragma mark - Transport Lifecycle

/// Called when the transport opens.
/// @param protocol The transport's protocol
- (void)protocolDidOpen:(SDLProtocol *)protocol;

/// Called when the transport closes.
/// @param protocol The transport's protocol
- (void)protocolDidClose:(SDLProtocol *)protocol;

/// Called when the transport errors.
/// @discussion Currently only used by TCP transport.
/// @param error The error
/// @param protocol The transport's protocol
- (void)protocol:(SDLProtocol *)protocol transportDidError:(NSError *)error;

#pragma mark - Deprecated Protocol Messages

/// A ping packet that is sent to ensure the connection is still active and the service is still valid.
/// @discussion Deprecated - requires protocol major version 3
/// @param session The session number
- (void)handleHeartbeatForSession:(Byte)session;

/// Called when the heartbeat frame was recieved successfully.
/// @discussion Deprecated - requires protocol major version 3
- (void)handleHeartbeatACK;



@end

NS_ASSUME_NONNULL_END