13 Replies - 823 Views - Last Post: 30 December 2015 - 03:11 PM Rate Topic: -----

#1 dennis.d.elston   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-February 11

Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 08:25 AM

Hello everyone,

I am seeking help with a camera monitor program. At this point I can't post any code, but I first wanted to see IF there was anyone who could help me just by reading the description. A lot of the code is proprietary, so if you feel you can help me based on the description, send me a message and we can discuss what code I can share.

So, the program is a windows application form. It fetches image data from several servers, located at remote sites, and displays them on a monitor program. I previously had the program working, however, our engineering department changed the network architecture and the manner in which images are processed. So now I find myself having to modify the code, but I am stuck and need some help.

Here are the basics.

- All the image process servers are located on a VPN. This isn't really an issue. I had the program working before with the servers on a VPN. The issue now, is that the cameras at each remote location, are routed to the server, at said remote location, through a network switch. But all the cameras are on a Vlan. This is my issue. I can't figure out how to get to the Vlan.

The overall VPN is on a Class B/16 network. The servers have a Class B/24 address and the Cameras are on a Class C/24 Vlan.

I am going to stop here with the network description, because I don't want to make things too complicated.

- The servers image processing is SQL based fetching the image data through a series of procedures and tables. The monitor programs code logs into each servers SQL database and uses several of the procedures and tables to display images on the monitor.

The problem now, is that I used to be able to communicate with each camera directly, when I was logged into the VPN, through my desktop, whether it be ping, or some other form. However, now, with the cameras being on the Vlan, I have to be logged into each individual server in order to communicate with the cameras. This is where I need help.

The monitor program uses a .ini configuration file that has each cameras settings.

For example, "Camera IP, Camera ID, Camera Location"

If you are looking for a challenge, let me know. Please! I need help!

Is This A Good Question/Topic? 0
  • +

Replies To: Help with a camera monitor! This is a challenge for anyone willing

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15360
  • View blog
  • Posts: 61,603
  • Joined: 12-June 08

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 08:31 AM

Is this a 'for pay' job?
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7139
  • View blog
  • Posts: 24,247
  • Joined: 05-May 12

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 08:37 AM

I'm not seeing how this is a C# question.
Was This Post Helpful? 0
  • +
  • -

#4 dennis.d.elston   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-February 11

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 08:46 AM

View PostSkydiver, on 29 December 2015 - 08:37 AM, said:

I'm not seeing how this is a C# question.

The program is written in C#

View Postmodi123_1, on 29 December 2015 - 08:31 AM, said:

Is this a 'for pay' job?


No, this is not a 'for pay' job. Sorry
Was This Post Helpful? 0
  • +
  • -

#5 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7139
  • View blog
  • Posts: 24,247
  • Joined: 05-May 12

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 08:52 AM

View Postdennis.d.elston, on 29 December 2015 - 10:46 AM, said:

View PostSkydiver, on 29 December 2015 - 08:37 AM, said:

I'm not seeing how this is a C# question.

The program is written in C#

So what? I can have a program written in C# be experiencing LDAP query issues. It doesn't make it a C# question, but rather an LDAP question. Based on your description above, your questions are about networking and databases. Nothing there is C# specific.
Was This Post Helpful? 0
  • +
  • -

#6 dennis.d.elston   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-February 11

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 09:05 AM

View PostSkydiver, on 29 December 2015 - 08:52 AM, said:

View Postdennis.d.elston, on 29 December 2015 - 10:46 AM, said:

View PostSkydiver, on 29 December 2015 - 08:37 AM, said:

I'm not seeing how this is a C# question.

The program is written in C#

So what? I can have a program written in C# be experiencing LDAP query issues. It doesn't make it a C# question, but rather an LDAP question. Based on your description above, your questions are about networking and databases. Nothing there is C# specific.

I'm not trying to get into an argument with you. My description is simply letting you know how the program, which is written in C#, is getting to the cameras and retrieving the information that it is posting on the C# based form. Once I can figure out how to the make the code get to the cameras, the modification I will be making to the code, will be written in C#.

So, having said that, you obviously have an issue with the fact that I've posted here. Clearly you have noticed that I am new to the site. So, please, kindly direct me to where you believe I should be posting and will gladly move.
Was This Post Helpful? 0
  • +
  • -

#7 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7139
  • View blog
  • Posts: 24,247
  • Joined: 05-May 12

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 09:47 AM

Post your C# code and the various versions of your attempts to access the cameras on the VLANs.
Post your C# code and the various versions of your attempts to access the different SQL servers on the VLANs.
Was This Post Helpful? 0
  • +
  • -

#8 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7139
  • View blog
  • Posts: 24,247
  • Joined: 05-May 12

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 10:01 AM

Nuts, I forgot that you stated that most of the code is proprietary.

Can you post minimal code that reproduces the problem? (E.g. something like this blog post that demonstrates the LDAP issue I'm encountering)

In your minimal code, can you also show your various attempts to try to access the cameras and SQL servers?

Seriously, though, I think this is more a networking and database issue rather than a C# programming issue. Very likely you'll have to redesign your system so that you'll have a small web service running on each of the VLANs (probably on the same machines hosting the SQL servers) that can forward your requests from your desktop to each of the VLANs... assuming you figure out how to get your desktop to even talk to each of the VLANs.
Was This Post Helpful? 0
  • +
  • -

#9 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7139
  • View blog
  • Posts: 24,247
  • Joined: 05-May 12

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 10:08 AM

Let me know if you want me to move this question to the Networking and Support sub forum, or the databases subforum. I can leave a link here in the C# forum in case somebody has an idea on how to force this by adding extra C# code.
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15360
  • View blog
  • Posts: 61,603
  • Joined: 12-June 08

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 29 December 2015 - 11:01 AM

Okay.. so not 'for pay'.

View Postdennis.d.elston, on 29 December 2015 - 09:25 AM, said:

A lot of the code is proprietary, so if you feel you can help me based on the description, send me a message and we can discuss what code I can share.

Please keep all the help on the forum for all folks to benefit and help with. If you are unable to post relevant questions or code then that will run in conflict.
Was This Post Helpful? 0
  • +
  • -

#11 dennis.d.elston   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-February 11

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 30 December 2015 - 07:20 AM

Ok, so here is what I'm using to query the cameras. As you can see, I attempt to log onto the server and fetch the data through the SQL database. This particular code is what I used, before the Vlan was implemented.
// Type: Raytheon.HTMS.Analysis.CameraQuery
// Assembly: Monitor, Version=1.0.2535.29663, Culture=neutral, PublicKeyToken=null
// MVID: F534827C-BB37-45B3-BA08-4EAA3EB982EF
// Assembly location: C:\Program Files\Raytheon HTMS\CameraMonitor\Monitor.exe

using System;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.IO;
using System.Net;

namespace Raytheon.HTMS.Analysis
{
  public static class CameraQuery
  {
    public static SortedList _CameraList = new SortedList(101);
    public static TipList _TipList = new TipList();
    private static WebClient _theWeb = new WebClient();
    private static SqlConnection _mySqlConnection = new SqlConnection();
    private static SqlCommand _myCommand = new SqlCommand();
    private const string _INSTALL_BASE = "C:\\Program Files\\Raytheon HTMS\\CameraMonitor";
    private static SqlDataReader _myReader;

    public static void InitializeCameraList()
    {
      StreamReader streamReader = new StreamReader("C:\\Program Files\\Raytheon HTMS\\CameraMonitor\\Setup\\Cameras.ini");
      while (!streamReader.EndOfStream)
      {
        string str = streamReader.ReadLine();
        Camera camera = new Camera();
        camera.TIP = str.Split(',').GetValue(0).ToString().Trim();
        camera.Number = str.Split(',').GetValue(1).ToString().Trim();
        camera.Id = str.Split(',').GetValue(2).ToString().Trim();
        CameraQuery._CameraList.Add((object) camera.MakeKey(), (object) camera);
        CameraQuery._TipList.AddTip(camera.TIP, camera.TIP);
      }
      streamReader.Close();
      streamReader.Dispose();
    }

    public static string MakeKey(string tip, string ImageName)
    {
      return tip + "," + ImageName.Substring(0, 3);
    }

    public static void GetCameraData()
    {
      for (int index1 = 0; index1 < CameraQuery._TipList._TheList.Count; ++index1)
      {
        TIP tip = (TIP) CameraQuery._TipList._TheList.GetByIndex(index1);
        CameraQuery._mySqlConnection.ConnectionString = "Address=" + tip._Address + ";User ID=SA;Password=xxxxxxx";
        try
        {
          CameraQuery._mySqlConnection.Open();
          if (CameraQuery._mySqlConnection.State == ConnectionState.Open)
          {
            Console.Write("Quering {0}... ", (object) tip._Address);
            CameraQuery._myCommand.CommandText = "use tpdb;select top (400) IMAGE_NAME, PLATE, PLATE_CONF, from IMAGE_DATA where PLATE_CONF!=0 order by PLZ_TXN_SEQ_NUM desc";
            CameraQuery._myCommand.Connection = CameraQuery._mySqlConnection;
            CameraQuery._myReader = CameraQuery._myCommand.ExecuteReader();
            while (CameraQuery._myReader.Read())
            {
              string string1 = CameraQuery._myReader.GetString(0);
              string string2 = CameraQuery._myReader.GetString(1);
              CameraQuery._myReader.GetString(2);
              int int32 = CameraQuery._myReader.GetInt32(3);
              string string3 = CameraQuery._myReader.GetString(4);
              if (int32 > 0)
              {
                int index2 = CameraQuery._CameraList.IndexOfKey((object) CameraQuery.MakeKey(tip._Address, string3));
                if (index2 >= 0)
                {
                  if (int32 > 600)
                    ((Camera) CameraQuery._CameraList.GetByIndex(index2)).GoodRead();
                  else
                    ((Camera) CameraQuery._CameraList.GetByIndex(index2)).BadRead();
                }
              }
              else
              {
                if (string1.Length > 4)
                {
                  int index2 = CameraQuery._CameraList.IndexOfKey((object) CameraQuery.MakeKey(tip._Address, string1));
                  if (index2 >= 0)
                    ((Camera) CameraQuery._CameraList.GetByIndex(index2)).NotRead();
                  else
                    continue;
                }
                if (string2.Length > 4)
                {
                  int index2 = CameraQuery._CameraList.IndexOfKey((object) CameraQuery.MakeKey(tip._Address, string2));
                  if (index2 >= 0)
                    ((Camera) CameraQuery._CameraList.GetByIndex(index2)).NotRead();
                }
              }
            }
            CameraQuery._myReader.Close();
            for (int index2 = 0; index2 < CameraQuery._CameraList.Count; ++index2)
            {
              Camera camera = (Camera) CameraQuery._CameraList.GetByIndex(index2);
              if (camera.TIP == tip._Address)
              {
                CameraQuery._myCommand.CommandText = "use tpdb;select top (1) IMAGE_NAME, convert(varchar,dateadd(HOUR,-6,add_timestamp),20),PLATE, PLATE_CONF from ocr_result where IMAGE_NAME like '" + camera.Number + "%'and PLATE_CONF!=0 order by add_timestamp desc; ";
                CameraQuery._myCommand.Connection = CameraQuery._mySqlConnection;
                CameraQuery._myReader = CameraQuery._myCommand.ExecuteReader();
                while (CameraQuery._myReader.Read())
                {
                  camera._URL = CameraQuery._myReader.GetString(0);
                  camera._ImageDate = CameraQuery._myReader.GetString(1);
                  camera._Plate = CameraQuery._myReader.GetString(2);
                  camera._Confidence = CameraQuery._myReader.GetInt32(3);
                }
                if (CameraQuery._myReader.HasRows)
                {
                  Stream stream = CameraQuery._theWeb.OpenRead(camera._URL);
                  camera.Image = new Bitmap(stream);
                  stream.Close();
                }
                CameraQuery._myReader.Close();
              }
            }
            Console.WriteLine("done.");
            CameraQuery._mySqlConnection.Close();
          }
        }
        catch (Exception ex)
        {
          Console.WriteLine("    Exception in Sql");
          Console.WriteLine("    {0}", (object) ex.Message.ToString());
        }
      }
    }
  }
}



Any help would be appreciated...

Also, Skydiver, if you feel that my post needs to be moved, or if it would be more beneficial to have it in another location, I'm fine with that. Like I said, I'm new to this.

Thanks!!!
Was This Post Helpful? 0
  • +
  • -

#12 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7139
  • View blog
  • Posts: 24,247
  • Joined: 05-May 12

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 30 December 2015 - 09:28 AM

Thanks for posting your database connection code.

From what I can see, you just pick up the IP address from the .INI file and stick it into your connection string. What were you hoping to happen when that IP address is isolated due to being on a different VLAN? Are you asking us if there is some way to modify that code so that it can somehow bypass the isolation imposed by the network configuration?
Was This Post Helpful? 0
  • +
  • -

#13 dennis.d.elston   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 19-February 11

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 30 December 2015 - 12:11 PM

So what happens, or at least what used to happen is, the the windows form had a box for each camera, at each location, which showed the image from that camera. Now, the windows form still opens, and there is still a box for each camera at each location, but theres no image. I'm sure that it's because of the Vlan. So, before, the .ini file had the "camera ip, camera id, and site name". For example, "192.168.24.16,101,Saline Creek". But like I said before, then, I could access the camera from my desktop. Now, I have to go through the server in order to get to the cameras. So, I'm guessing, the .ini file would have to be setup in a manner where I would have to identify, the server and camera. I was trying to put the Server IP, Camera IP, and Site Name". For example, "10.102.99.11(server ip),192.168.101.71(camera ip on the vlan),site id". But, that doesn't seem to be working.

Does any of this make sense?

I've been using visual studio 2010 to compile the project. If you want I can just attach the whole project and that might give you a better idea of what I'm doing.
Was This Post Helpful? 0
  • +
  • -

#14 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7139
  • View blog
  • Posts: 24,247
  • Joined: 05-May 12

Re: Help with a camera monitor! This is a challenge for anyone willing

Posted 30 December 2015 - 03:11 PM

View Postdennis.d.elston, on 30 December 2015 - 02:11 PM, said:

Now, I have to go through the server in order to get to the cameras. So, I'm guessing, the .ini file would have to be setup in a manner where I would have to identify, the server and camera. I was trying to put the Server IP, Camera IP, and Site Name". For example, "10.102.99.11(server ip),192.168.101.71(camera ip on the vlan),site id". But, that doesn't seem to be working.

Post the version of your code that has these modifications.

In what way is it not working? Are you getting error messages or warnings while compiling? If so what are they?

If your code compiles cleanly, are you getting unexpected behavior? If so describe what is happening and what you were expecting to happen?

As a quick aside, your current string parsing on lines 33-35 is very inefficient. You keep splitting the same line only to pick up different parts of it. And then it looks like there are some unnecessary cast when dealing with your lists and list items. These issues though are orthogonal to your current access issues.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1