Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug scheduling messages in the unsollicited response callback #113

Open
Dond96 opened this issue Dec 7, 2021 · 8 comments
Open

Bug scheduling messages in the unsollicited response callback #113

Dond96 opened this issue Dec 7, 2021 · 8 comments

Comments

@Dond96
Copy link

Dond96 commented Dec 7, 2021

I ran into a bug where it's not possible to schedule a message from the unscollicited response callback. The message was sent in a function that was scheduled in the unsollicited response callback. In the scheduled function the d7ap_send function was called and returned code 0 (SUCCESS) the message would be scheduled but never send. When scheduling the function with the timer_post_task_delay function the message would be sent.

@Dond96
Copy link
Author

Dond96 commented Dec 7, 2021

Example:

void scheduled_function()
{
d7ap_send(message); // Returns 0 in both cases
}

bool unsolicited_cb(args)
{
sched_post_task(&scheduled_function); // Doesn't work
timer_post_task_delay(&scheduled_function, delay); // Does work
return false;
}

@LOorts-Aloxy
Copy link
Member

this is a bit of a weird use case to me, you want to transmit a message when getting an unsolicited message, but you don't want to answer it in the same dialog? I think now you're trying to start a new dialog while the previous one is still wrapping up, however it should indeed not return SUCCESS.

@Dond96
Copy link
Author

Dond96 commented Dec 7, 2021

I don't respond in the dialog because I'm switching access classes to go from background scanning to continious forground scanning.

@LOorts-Aloxy
Copy link
Member

won't it be better to first answer and then switch classes? I think you still want to transmit to the same device?

@Dond96
Copy link
Author

Dond96 commented Dec 7, 2021

I do answer first. The scheduled function just sends the next message using the new access class.

@LOorts-Aloxy
Copy link
Member

so you're scheduling two d7 messages at the same time? Sorry, just trying to get a grasp of the situation. alp never directly schedules an independent answer right after it got some unsollicited message

@Dond96
Copy link
Author

Dond96 commented Dec 7, 2021

Well the message gets send in a function thats called by the scheduler so it should be send outside the scope of the unsolicited callback. I think the message did end up in the message queue but it didn't get send. I could trigger the function by pressing a button on another board and after pressing it a couple of times the d7ap_send funciton would return an error code but the messages were never transmitted. (I think the error code was caused because the buffer was full)

@LOorts-Aloxy
Copy link
Member

LOorts-Aloxy commented Dec 7, 2021

ok, weird, we'll have to look into that. We haven't seen this happen using alp above d7.

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

No branches or pull requests

2 participants