BestOwl / MyPhone

Connect your mobile devices (Android/iOS/WindowsPhone) to PC
MIT License
191 stars 37 forks source link

Fix get message notification #6

Closed xtremehpx closed 2 years ago

xtremehpx commented 2 years ago

This fixes issues when getting notification message details. Two main issues fixed: 1) OBEX Body does not have null ending and 2) BT socket stream reader and writer reinitialization during request.

BestOwl commented 2 years ago

The notification problem stills exist, tested on Android and iPhone.

Opcode: GetAlter
Req packet sent. Waiting for reply...1

Stuck on waiting reply.

BestOwl commented 2 years ago

I will merge this PR anyway since the base branch have been changed to xtremehpx/refactor-map-demo.

BestOwl commented 2 years ago

Future commits should be push to xtremehpx/refactor-map-demo branch

xtremehpx commented 2 years ago

The notification problem stills exist, tested on Android and iPhone.

Opcode: GetAlter
Req packet sent. Waiting for reply...1

Stuck on waiting reply.

You are correct, the problem remains. I tried again and here was the reason I thought problem was fixed early. The first time running the code, I have step-by-step debug enabled, specially I set a break point at ReadFromStream. I only need to enable the debug for the first incoming message, and then getting the rest of the incoming messages are fine. I feel like the MNS service needs to be in a standalone service app.

Body: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<MAP-event-report version="1.0"><event type="NewMessage" handle="95F86559724B7A3" folder="telecom/msg/inbox" msg_type="SMS_GSM"/></MAP-event-report>
Sending GetMessage request
Sending request packet: 1
ConnectionId: 19-60-46-30
Opcode: GetAlter
Req packet sent. Waiting for reply...1
ResponseCode: Success
Message received: test get message from notification 2

Opcode: PutAlter
Type: 78-2D-62-74-2F-4D-41-50-2D-65-76-65-6E-74-2D-72-65-70-6F-72-74-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
ApplicationParameters: 0F-01-00
MASInstanceID: 00
EndOfBody: ***
Body: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<MAP-event-report version="1.0"><event type="NewMessage" handle="F294197EE62A05C" folder="telecom/msg/inbox" msg_type="SMS_GSM"/></MAP-event-report>
Sending GetMessage request
Sending request packet: 1
ConnectionId: 19-60-46-30
Opcode: GetAlter
Req packet sent. Waiting for reply...1
ResponseCode: Success
Message received: test get message from notification 3

Opcode: PutAlter
Type: 78-2D-62-74-2F-4D-41-50-2D-65-76-65-6E-74-2D-72-65-70-6F-72-74-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
ApplicationParameters: 0F-01-00
MASInstanceID: 00
EndOfBody: ***
Body: <?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<MAP-event-report version="1.0"><event type="NewMessage" handle="B008F57D7A4E298" folder="telecom/msg/inbox" msg_type="SMS_GSM"/></MAP-event-report>
Sending GetMessage request
Sending request packet: 1
ConnectionId: 19-60-46-30
Opcode: GetAlter
Req packet sent. Waiting for reply...1
ResponseCode: Success
Message received: test get message from notification 4