Declaring digital signal

What do you suggest a proper way of comparing the incoming data would be ?

I'd really suggest that you do this one step at a time. Assure that you are indeed getting what you think you are.

Then, when you have a NULL terminated array of chars containing "G28 Xxx Yyy", you can look at the strtok function to get the first token ("G28" when the delimiter set is " "). Compare that token with the constants, using strcmp().