add database support and collect device data.