Quality of Service Optimization in an IoT-Driven Intelligent Transportation System