added and updated few database APIs to use
replace all direct database queries to database APIs created for application
incorporated last development of getting logs to this new database APIs
added device type catagory to update it self while adding device
added download file routine
debug log routine added for easy debuggin
optiomized code for database queries
typo correction in devices.php to use device_vendor name