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

Add application version compatibility check. #5253

Closed

Conversation

cslashm
Copy link
Contributor

@cslashm cslashm commented Mar 7, 2019

No description provided.

if (minor < MINIMAL_MINOR_APP_VERSION) {
ASSERT_X(false, MINIMAL_VERSION_ERROR_MESSAGE);
}
#undef MINIMAL_VERSION
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want MINIMAL_VERSION_ERROR_MESSAGE here

}

#define MINIMAL_VERSION_ERROR_MESSAGE \
"Unsuppotred device application version: "<<major<<"."<<minor<<"."<<micro<<"."\
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsupported


#define MINIMAL_VERSION_ERROR_MESSAGE \
"Unsuppotred device application version: "<<major<<"."<<minor<<"."<<micro<<"."\
" At least " << MINIMAL_MAJOR_APP_VERSION<<"."<<MINIMAL_MINOR_APP_VERSION<<"."<<MINIMAL_MICRO_APP_VERSION << " is requiered."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required

}
if (minor < MINIMAL_MINOR_APP_VERSION) {
ASSERT_X(false, MINIMAL_VERSION_ERROR_MESSAGE);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems wrong. It will fail once you get to 2.0.0.
Maybe, eg:

 ASSERT_X(major*65536+minor*256+micro >= 0x010200, MINIMAL_VERSION_ERROR_MESSAGE);

(untested)
And you also get only one line with it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right!.
I will take your approach with shift: (major<<24) | (minor<<16) | micro

this->exchange();
this->exchange();

ASSERT_X(this->length_recv>=3, "Communication error, less than tow three bytes received. Check your application version.");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tow ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major, minor, micro : three

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I mean the "tow" seems like it's extra unneeded word here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG yes. It seems I'am a bit tired 😪

@cslashm cslashm closed this Mar 13, 2019
@cslashm cslashm deleted the AddVersionCheck branch March 21, 2019 15:14
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