Skip to content

Commit

Permalink
Bug fix in parsing of Arduino packets
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanntg committed Sep 12, 2016
1 parent bd7c636 commit 98c64bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions SyllableDetector/ArduinoIO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class DelimitedSerialPacketDescriptor: ORSSerialPacketDescriptor {

// check for proceeding delimiter
// (could be more lenient and just check for the end of the delimiter)
let windowDel = buffer.subdata(in: (buffer.count - i - delimiter.count)..<delimiter.count)
let windowDel = buffer.subdata(in: (buffer.count - i - delimiter.count)..<(buffer.count - i))

// does not match? continue
if windowDel != delimiter {
Expand All @@ -155,7 +155,7 @@ class DelimitedSerialPacketDescriptor: ORSSerialPacketDescriptor {
}

// make window
let window = buffer.subdata(in: (buffer.count - i)..<i)
let window = buffer.subdata(in: (buffer.count - i)..<buffer.count)
if dataIsValidPacket(window) {
return window
}
Expand All @@ -180,8 +180,8 @@ class DelimitedSerialPacketDescriptor: ORSSerialPacketDescriptor {
}

// ensure buffer ends with delimiter
let windowFinalDel = buffer.subdata(in: (buffer.count - delimiter.count)..<delimiter.count)
if !windowFinalDel.elementsEqual(delimiter) {
let windowFinalDel = buffer.subdata(in: (buffer.count - delimiter.count)..<buffer.count)
if windowFinalDel != delimiter {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions SyllableDetector/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.3.0</string>
<string>0.3.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>12</string>
<string>13</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.education</string>
<key>LSMinimumSystemVersion</key>
Expand Down

0 comments on commit 98c64bf

Please sign in to comment.