Multitasking arduino with CAN bus inputs

Work got busy so I wasn't able to get to trying this till yesterday. I have tried a few different approaches with no luck. My question is how much of my code needs to be changed to accommodate with switch case method?

I've noticed I cant use a 'void loop' and a 'void task' in the same code will not compile. Would I need to get rid of everything after 'void loop' and use 'void task' with switch case? I'm confused because of the sensors I'm using I have to call for the ID and byte

if (Serial.available() > 0) { // This is only set to 0 the very first time when the function is called
        static int state = 0;
      }
    }
  }

  switch (0x600 )
  {
    case a:

      if (0x20)
        // do something only once
        digitalWrite(7, HIGH);

      break;

    case b:
      // do something until if condition is true
      if (0x600  != 0x20)
      {
        digitalWrite(7, LOW);
      }
      break;

    default:

      state = 0;

      break;
  }

  switch (0x500)
  {
    case 'A':

      if (0x10)
        // do something only once
        digitalWrite(6, HIGH);

      break;

    case B:
      // do something until if condition is true
      if (0x500 != 0x00)
      {
        digitalWrite(6, LOW);
      }
      break;

    default:

      state = 0;

      break;
  }
}