It would be easiest to create icons for each state and add the correct icon to the map (as long as you don't have tons of variations).
the icons
- icon_online_camera-on.gif
- icon_online_camera-off.gif
- icon_offline_camera-on.gif
- icon_offline_camera-off.gif
when adding a marker for a position, add the correct icon.
EDIT
In light of the new information, here is another idea ...
You have a dedicated space for the icons. Maybe /images/device_icons/
Use server side language to create image file name in consistent format
DEVICE-ID_ONLINE_CAMERA_OTHER-THING_LAST-THING.gif 3_1_0_1_3.gif // device - 3, online, camera off, other thing - 1, last thing -3
Then check for the badge.
If it exists, use the previously created version; if it does not exist, use whatever language you use to create the icon and save it. Thus, it will be easy to add devices and statuses, and you will not create the same icons on every page load, as if you were using javascript.
source share