Spin crossover based functional devices: Molecular switches and sensors