-
Notifications
You must be signed in to change notification settings - Fork 0
/
AMSerialPort_Deprecated.m
182 lines (153 loc) · 3.21 KB
/
AMSerialPort_Deprecated.m
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
//
// AMSerialPort_Deprecated.m
// AMSerialTest
//
// Created by Andreas on 26.07.06.
// Copyright 2006-2009 Andreas Mayer. All rights reserved.
//
#import "AMSerialPort_Deprecated.h"
#import "AMSerialPortAdditions.h"
@implementation AMSerialPort (Deprecated)
- (id)init:(NSString *)path withName:(NSString *)name
{
return [self init:path withName:name type:@""];
}
// renamed to -options
- (NSDictionary *)getOptions
{
return [self options];
}
// renamed to -speed
- (long)getSpeed
{
return [self speed];
}
// renamed to -dataBits
- (int)getDataBits
{
return [self dataBits];
}
// replaced by -parity
- (BOOL)testParity
{
// NO for "no parity"
return (options->c_cflag & PARENB);
}
// replaced by -parity
- (BOOL)testParityOdd
{
// meaningful only if TestParity == YES
return (options->c_cflag & PARODD);
}
// replaced by -setParity:
- (void)setParityNone
{
options->c_cflag &= ~PARENB;
}
// replaced by -setParity:
- (void)setParityEven
{
options->c_cflag |= PARENB;
options->c_cflag &= ~PARODD;
}
// replaced by -setParity:
- (void)setParityOdd
{
options->c_cflag |= PARENB;
options->c_cflag |= PARODD;
}
// renamed to -stopBits;
- (int)getStopBits
{
return [self stopBits];
}
// replaced by -setStopBits:
- (void)setStopBits2:(BOOL)two
{
// YES for 2 stop bits, NO for 1 stop bit
if (two) {
[self setStopBits:kAMSerialStopBitsTwo];
} else {
[self setStopBits:kAMSerialStopBitsOne];
}
}
// renamed to -echoEnabled
- (BOOL)testEchoEnabled
{
return [self echoEnabled];
}
// renamed to -RTSInputFlowControl
- (BOOL)testRTSInputFlowControl
{
return [self RTSInputFlowControl];
}
// renamed to -DTRInputFlowControl
- (BOOL)testDTRInputFlowControl
{
return [self DTRInputFlowControl];
}
// renamed to -CTSOutputFlowControl
- (BOOL)testCTSOutputFlowControl
{
return [self CTSOutputFlowControl];
}
// renamed to -DSROutputFlowControl
- (BOOL)testDSROutputFlowControl
{
return [self DSROutputFlowControl];
}
// renamed to -CAROutputFlowControl
- (BOOL)testCAROutputFlowControl
{
return [self CAROutputFlowControl];
}
// renamed to -hangupOnClose
- (BOOL)testHangupOnClose
{
return [self hangupOnClose];
}
// renamed to -localMode
- (BOOL)getLocal
{
return [self localMode];
}
// renamed to -setLocalMode:
- (void)setLocal:(BOOL)local
{
return [self setLocalMode:local];
}
// renamed to -bytesAvailable
- (int)checkRead
{
return [self bytesAvailable];
}
// replaced by -readStringUsingEncoding:error:
- (NSString *)readString
{
return [self readStringUsingEncoding:NSMacOSRomanStringEncoding error:NULL];
}
// replaced by -readBytes:usingEncoding:error:
- (NSString *)readStringOfLength:(unsigned int)length
{
return [self readBytes:length usingEncoding:NSMacOSRomanStringEncoding error:NULL];
}
// replaced by -writeString:usingEncoding:error:
- (int)writeString:(NSString *)string
{
int result = 0;
NSError *error;
[self writeString:string usingEncoding:NSMacOSRomanStringEncoding error:&error];
if (error) {
NSDictionary *userInfo = [error userInfo];
if (userInfo) {
result = [[userInfo objectForKey:@"bytesWritten"] intValue];
}
}
return result;
}
// renamed to -flushInput:output:
- (BOOL)flushInput:(BOOL)fIn Output:(BOOL)fOut
{
return [self flushInput:fIn output:fOut];
}
@end