It doesn't seem that the param declares difference but absolute position. It seems it should be something like the switch/case you are using is not appropriate. Maybe something more like (adjust accordingly for how you want to exactly define each case):
if(arg0 <= 90){
new_orentation = 1;
}
else if(arg0 <=180){
//this is reversePortrait
new_orentation = 0;
}
else if(arg0 <= 270){
new_orentation = 2;
}
else{
new_orentation = 0;
}