From 036f9f5d7e27dac685343b4e7ea03c54bce00e64 Mon Sep 17 00:00:00 2001 From: "Dr. Michael Lauer" Date: Fri, 26 Feb 2021 14:36:29 +0100 Subject: [PATCH] LTOBD2AdapterELM327: wrap ATSH (set header arbitration) and ATCRA (set response arbitration). #35 --- .../LTSupportAutomotive/LTOBD2AdapterELM327.m | 29 +++++++++++++++++++ .../include/LTOBD2AdapterELM327.h | 15 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/Sources/LTSupportAutomotive/LTOBD2AdapterELM327.m b/Sources/LTSupportAutomotive/LTOBD2AdapterELM327.m index 3669b70..92f5763 100644 --- a/Sources/LTSupportAutomotive/LTOBD2AdapterELM327.m +++ b/Sources/LTSupportAutomotive/LTOBD2AdapterELM327.m @@ -480,3 +480,32 @@ -(NSString*)formattedResponse } @end + + + +@implementation LTOBD2CommandELM327_SET_HEADER_ARBITRATION + ++(instancetype)commandForId:(NSString*)header +{ + NSString* string = [NSString stringWithFormat:@"ATSH%@", header]; + return [self commandWithRawString:string]; +} + +@end + + + +@implementation LTOBD2CommandELM327_CAN_RECEIVE_ARBITRATION + ++(instancetype)command +{ + return [self commandWithRawString:@"ATCRA"]; +} + ++(instancetype)commandForId:(NSString*)header +{ + NSString* string = [NSString stringWithFormat:@"ATCRA%@", header]; + return [self commandWithRawString:string]; +} + +@end diff --git a/Sources/LTSupportAutomotive/include/LTOBD2AdapterELM327.h b/Sources/LTSupportAutomotive/include/LTOBD2AdapterELM327.h index 729c669..94cd76c 100644 --- a/Sources/LTSupportAutomotive/include/LTOBD2AdapterELM327.h +++ b/Sources/LTSupportAutomotive/include/LTOBD2AdapterELM327.h @@ -58,4 +58,19 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface LTOBD2CommandELM327_SET_HEADER_ARBITRATION : LTOBD2Command + ++(instancetype)commandForId:(NSString*)header; + +@end + +/// CAN-ONLY commands (protocols 6 to C) + +@interface LTOBD2CommandELM327_CAN_RECEIVE_ARBITRATION : LTOBD2Command + ++(instancetype)command; // clear receive arbitration (resets to broadcast) ++(instancetype)commandForId:(NSString*)header; + +@end + NS_ASSUME_NONNULL_END