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

In CS104_Slave Mode, I have a question on the function handleMessage() #93

Open
tangkai-prc opened this issue May 6, 2021 · 0 comments

Comments

@tangkai-prc
Copy link

#1 On what purpose why do your team not use semaphore lock when received a U frame and before send response? For I see when you used that way in Master-side like this:
if (buffer[2] == 0x43) { /* Check for TESTFR_ACT message */
DEBUG_PRINT("Send TESTFR_CON\n");
#if (CONFIG_USE_SEMAPHORES == 1)
Semaphore_wait(self->socketWriteLock);
#endif
writeToSocket(self, TESTFR_CON_MSG, TESTFR_CON_MSG_SIZE);
#if (CONFIG_USE_SEMAPHORES == 1)
Semaphore_post(self->socketWriteLock);
#endif
}

#2 May I suggest when handleMessage use in cs104_slave mode, if S frame was received set if (buffer[2] == 0x01 && buffer[3] == 0x00) ,it will be better than just judge buffer[2] == 0x01

#3 when processing U or S Frame, is it better to judge the size of the message first?
if (msgSize > 6) {
DEBUG_PRINT("Received U msg more than 6 bytes!");
return false;
}

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

1 participant