Sensor values history serialization

Improvement of https://github.com/qreal/qreal/pull/1294
foreach?