Meh. Wasn't all that bad, but I'm not pulling out any of the diagnostic type data yet either. If anyone cares, here's the parser code for Objective-C/Foundation on Mac OS X:
<pre class="ip-ubbcode-code-pre">
- (void) parseTelnetOutput: (NSString *) stokerOutput
{
if ([stokerOutput rangeOfString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
":"].location != NSNotFound) // must have : after device ID or it's garbage
{
NSString *deviceID = nil;
NSString *tempC = nil;
NSString *tempUser = nil;
NSString *tempTarget = nil;
NSString *blower = nil;
NSScanner *scanner = [NSScanner scannerWithString:stokerOutput];
// first string (up to colon) is the Device ID
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
":" intoString:&deviceID];
if ([deviceID length] != 16) // bad deviceID
return;
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
" " intoString:nil]; // skip past the colon
for (int i = 0; i < 7; i++) // skip past the v0-v6 debug variables
{
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
" " intoString:nil];
}
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
" " intoString:&tempC]; // get the two temp variables
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
" " intoString:&tempUser];
if ([stokerOutput rangeOfString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
"PID"].location != NSNotFound) // if there's a PID string, then there's blower data
{
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
"tgt:" intoString:nil]; // skip past the tgt:
[scanner scanString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
"tgt:" intoString:nil];
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
" " intoString:&tempTarget]; // get the value
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
"blwr:" intoString:nil]; // skip past the blwr:
[scanner scanString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
"blwr:" intoString:nil];
[scanner scanUpToString
![Mad :@ :@](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f621.png)
" " intoString:&blower]; // get the value
}
NSLog (@"Stoker: parseTelnetOutput, deviceID: %@, tempUser: %@, target: %@, blower: %@", deviceID, tempUser, tempTarget, blower);
}
}
</pre>
Hmm. This software doesn't do a very nice job with code posting.
joe