Doubt regarding JSON ControlType Image

Hello.

I’m trying to integrate a camera view in my plugin UI, so that it takes pictures being refreshed automatically, so I took D_DigitalSecurityCamera1.json as a model. If I create the device using D_DigitalSecurityCamera1.xml and I configure the URL parameter, everything works fine, I get image from my camera. But what I need is the camera image being a part of my plugin UI, so I had a look at D_DigitalSecurityCamera1.json and found this bit:


                        { 
				"ControlGroup":"3",
				"ControlType": "image",
				"top": "0",
				"left": "0",
				"Display": {
					"url": "?id=request_image&cam=",
					"Top": 0,
					"Left": 0,
					"Width": 320,
					"Height": 240
				}
			},

I tried putting this in my json file. I’m not sure how this ControlType really works, since I found no explanation in the wiki. By doing this I got the frame for the camera view but no image at all, instead: URL not valid. I configured the URL state variable (I put S_Camera1.xml as part of my description XML among others), but still URL not valid. I don’t really understand how “url”: “?id=request_image&cam=” is used by the controltype, and how URL Camera1 variable affects it. I guess somehow lul_device is appended to that in order to form an http camera request for the correct device, but this is very dark for me.

Also, is there any possibility of getting the files shared.js and plugins.js referenced at javascript tabs in D_DigitalSecurityCamera1.json. Are they in the filesystem? I could not find them. They could be very helpful for me. I want to see how ‘advanced’ and ‘settings’ tab are generated in the camera plugin. Regarding “advanced” tab, it would seem that the js function takes every state variable I use in my implementation code and puts it as an user configurable input box in the tab.

Thanks a lot
and best regards.

Actually I’m seeing this in the logs:

01 05/25/12 2:59:01.938 Generic_IP_Camera_Manager::GetUrlFromArguments no URL for url:(null) ip:(null) cam:23 <0x5c12>
01 05/25/12 2:59:01.939 Generic_IP_Camera_Manager::REQ_Image can’t get URL <0x5c12>
02 05/25/12 2:59:01.944 Generic_IP_Camera_Manager::ReturnImage /etc/cmh-lu/bad_url.jpg=4290 LEAK this:4096 start:77824 to 0x8fb000 <0x5c12>
02 05/25/12 2:59:14.011 LOG_CHECK_MEMORY_LEAK pMem start 0x8fa000 now 0x8fb000 last 0x8fa000 leaked 4096

URL null, IP null… but they are configured in my Advanced tab for the device. Where’s that function getting those parameters from? I’m sure I’m missing something obvious here.

Thanks
and best regards.

As I said here, camera devices are partly hardcoded in the UI, so they aren’t reusable (at least not easily). I stand by my previous suggestion to use a custom javascript tab to show the image from the camera.

OK. So if I understood well, Controltype Image is basicly useless for developers. It’s no longer a choice for us in the json UI.

What if I only wanted to display a pic in my flash control UI? Just a static pic. No refresh. Considering your words I guess the solution still would to be go to necessarily go to javascript solution.

Also, can anyone recommend me a plugin that is a good reference to start with javascript approach? By the way, are shared.js and plugins.js available for developers?

Thanks
and best regards.

While thinking about this I had another doubt. It would be possible to continue using my flash control UI and just someway embed a javascript bit on it for the camera view? Or will this limitation obligue me to redo all my control UI in a fresh javascript tab? I’m saying this because my control UI is mostly finished and atm I just need the camera to work.

Thanks and best regards.

My plugins have some JavaScript tabs: CurrentCost; Caddx Security System. There is also dataMine and Home Care.

Yeah, it kinda is.

[quote=“floyderman3d, post:4, topic:171613”]What if I only wanted to display a pic in my flash control UI? Just a static pic. No refresh. Considering your words I guess the solution still would to be go to necessarily go to javascript solution.

Also, can anyone recommend me a plugin that is a good reference to start with javascript approach?[/quote]

Yes, Javascript is the best solution. I attached a modified motion sensor Json. I added a tab Image of type javascript that just displays an image. The function is in J_Image.js (I had to rename it to .txt because it wouldn’t allow me to upload it).

These files have been included in cpanel_data.js. Open this file and search for shared.js and plugins.js.

Hi!

futzle: Thanks a lot for your recommendations. I’ll definitely check them!

mcvflorin: Thank you very much also for your reply and for the attachments. Unfortunately for some reason I cannot see the attachments in the post. Are you sure they are correctly uploaded?

Apparently the attachments were lost when I reposted.

Thanks again for the example!