void Processstuff(byte[] message) { MemoryStream stream = new MemoryStream(message); BinaryReader br = new BinaryReader(stream); MobilEyeID camID = (MobilEyeID)br.ReadInt32(); MobilEyeMessageID msgID = (MobilEyeMessageID)br.ReadInt32(); br.ReadInt32(); switch (msgID) { case MobilEyeMessageID.ME_Obs: MobilEyeObstaclePacket obs = new MobilEyeObstaclePacket(); obs.id = camID; obs.carTime = br.ReadDouble(); obs.numObstacles = br.ReadInt32(); obs.obstacles = new MobilEyeWorldObstacle[obs.numObstacles]; for (int i = 0; i < obs.numObstacles; i++) { obs.obstacles[i].obstacleID = br.ReadInt32(); obs.obstacles[i].obstacleDistZ = br.ReadSingle(); obs.obstacles[i].confidence = br.ReadInt32(); obs.obstacles[i].path = (VehiclePath)br.ReadInt32(); obs.obstacles[i].currentInPathVehicle = br.ReadBoolean(); obs.obstacles[i].obstacleDistXDirection = br.ReadBoolean(); obs.obstacles[i].obstacleDistX = br.ReadSingle(); if (!(obs.obstacles[i].obstacleDistXDirection)) { obs.obstacles[i].obstacleDistX *= -1; } else { Console.Write("."); } obs.obstacles[i].obstacleWidth = br.ReadSingle(); obs.obstacles[i].scaleChange = br.ReadSingle(); obs.obstacles[i].velocity = br.ReadSingle(); obs.obstacles[i].bottomRect = br.ReadInt32(); obs.obstacles[i].leftRect = br.ReadInt32(); obs.obstacles[i].topRect = br.ReadInt32(); obs.obstacles[i].rightRect = br.ReadInt32(); } if (GotMobilEyeObstaclePacket != null) { GotMobilEyeObstaclePacket(this, new MobilEyeObstaclePacketEventArgs(obs, camID)); } break; } }
public MobilEyeObstaclePacketEventArgs(MobilEyeObstaclePacket obs, MobilEyeID id) { this.obs = obs; this.id = id; }