Skip to content

Conversation

@itsmojo
Copy link
Contributor

@itsmojo itsmojo commented Dec 2, 2019

Part of fix for #569

@itsmojo itsmojo changed the title Record pod responses before trying to parse to ensure they get logged Record pod responses even if they can't be successfully parsed Dec 11, 2019
@ps2
Copy link
Owner

ps2 commented Dec 17, 2019

Do you have any examples of what this caught for you?

@itsmojo
Copy link
Contributor Author

itsmojo commented Dec 17, 2019

// Attempt to do a combined cancel TB and set TB message which unfortunately is
// disallowed by the pod firmware and so it returns an 06 error response with error code 07
2019-12-11 09:37:32 +0000 send 1f057550142d1f05af9d53d6001a0eaf9d53d601007b01384000010001160e0000000a0aba9500
// The 06 error response with error code 07 that originally would not getting logged without this
// change because of a parsing error with any error response except with an 0x14 bad nonce code
// (which also needs to be fixed, see issue #569)
2019-12-11 09:37:37 +0000 receive 1f05755018050603070008813f

// The corresponding Xcode debug output from the same run where the
// "Error Recv(Hex)" line indicates that this logging resulted from this change.
2019-12-11 01:37:37.092842-0800 Loop[2164:2542591] [PeripheralManager+RileyLink] RL Recv(single): dd2cd51f057550e81f05755018050603070008813f50
2019-12-11 01:37:37.094937-0800 Loop[2164:2542591] [PeripheralManager+RileyLink] RileyLink response: PacketResponse(code: RileyLinkBLEKit.ResponseCode.success, packet: Optional(RFPacket(-51, 213, 1f057550e81f05755018050603070008813f50)))
2019-12-11 01:37:37.100532-0800 Loop[2164:2542543] [PodMessageTransport] Error Recv(Hex): 1f05755018050603070008813f
2019-12-11 01:37:37.106344-0800 Loop[2164:2542543] [PodMessageTransport] Error during communication with POD: parsingError(offset: 0, data: 5 bytes, error: OmniKit.MessageError.unknownValue(value: 7, typeDescription: "ErrorReponseType"))

@itsmojo itsmojo changed the title Record pod responses even if they can't be successfully parsed Record all non-garbage Pod responses Dec 23, 2019
@ps2 ps2 merged commit 4b099a7 into ps2:dev Dec 23, 2019
ps2 pushed a commit that referenced this pull request Oct 1, 2020
…596)

* Decode and treat as a certain failure all non-nonce error responses
Along with rileylink_ios PR #571, remaining portion of fix for issue #569:
Pod non badNonce Error Responses are not decoded, logged or treated as a certain failure

* Reworked ErrorResponse to use enum case with parameters
Add a new test case for a non bad nonce error response
Treat a PodCommsError.commandError as a certain failure
Updated commenting and send() logic

* Comment out failureReason definition to fix merge conflict

* Update PodCommsError LocalizedError commandError description string to match

* Remove unneeded & incorrect errorResponse handling in sendMessage()

* Update PodCommsSession.swift

Formatting clean up

* Update PodCommsSession.swift

Change PodCommsError.commandError to more specific invalidMessage

* Use rejectedMessage for new PodCommsError error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants