locked
Ozeki Camera SDK for c#.net Accessing IP camera with no Username/Password RRS feed

  • Question

  • I'm trying to access a Panasonic IP Camera WV-NW502SE using the SDK. When I type the ip address of the camera into the browser, the browser pulls up the device server's main page; but when I try to type that same ip address into the "host" variable of the function, IPCameraFactory.GetCamera(host, userName, password), and enter empty strings for the username and password feilds, nothing happens. No camera is found, but _ipCamera does't equal "null" either. Here's my code.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    using Ozeki.Media.IPCamera;
    using Ozeki.Media.MediaHandlers;
    using Ozeki.Media.MediaHandlers.Video;
    using Ozeki.Media.Video.Controls;
    
    namespace camera_tutorial_3
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            private VideoViewerWPF _videoViewerWPF;
            private BitmapSourceProvider _provider;
            private IIPCamera _ipCamera;
            private WebCamera _webCamera;
            private MediaConnector _connector;
    
            public MainWindow()
            {
                InitializeComponent();
                _connector = new MediaConnector();
                _provider = new BitmapSourceProvider();
                SetVideoViewer();
            }
    
            private void SetVideoViewer()
            {
                _videoViewerWPF = new VideoViewerWPF();
                {
                    HorizontalAlignment = HorizontalAlignment.Stretch;
                    VerticalAlignment = VerticalAlignment.Stretch;
                    Background = Brushes.Black;
                }
                grdCameraBox.Children.Add(_videoViewerWPF);
                _videoViewerWPF.SetImageProvider(_provider);
            }
            
            #region USB Camera Connect/Disconnect
            private void btnUSBConnect_Click(object sender, RoutedEventArgs e)
            {
                _webCamera = WebCamera.GetDefaultDevice();
                if (_webCamera == null) return;
                _connector.Connect(_webCamera, _provider);
                _webCamera.Start();
                _videoViewerWPF.Start();
            }
    
            private void btnUSBDisconnect_Click(object sender, RoutedEventArgs e)
            {
                _videoViewerWPF.Stop();
                _webCamera.Stop();
                _webCamera.Dispose();
                _connector.Disconnect(_webCamera, _provider);
            }
            #endregion
    
            #region IP Camera Connect/Disconnect
            private void btnIPConnect_Click(object sender, RoutedEventArgs e)
            {
                var host = txtHost.Text;
                var userName = txtUserName.Text;
                var password = txtPassword.Text;
    
                _ipCamera = IPCameraFactory.GetCamera(host, userName, password);
                if (_ipCamera == null)
                {
                    return;
                }
                _connector.Connect(_ipCamera.VideoChannel, _provider);
    
                _ipCamera.Start();
                _videoViewerWPF.Start();
            }
    
            private void btnIPDisconnect_Click(object sender, RoutedEventArgs e)
            {
                _videoViewerWPF.Stop();
                _ipCamera.Disconnect();
                _ipCamera.Dispose();
                _connector.Disconnect(_ipCamera.VideoChannel, _provider);
            }
            #endregion
        }
    }
    

    And here's the xaml

    <Window x:Class="camera_tutorial_3.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="Camera Viewer" Height="348" Width="600">
        <Grid x:Name="grdCameraBox">
            <GroupBox x:Name="gbUSBConnection" Header="USB Connection" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Height="162" Width="115">
                <Grid>
                    <Button x:Name="btnUSBConnect" Content="Connect" HorizontalAlignment="Left" Margin="4,10,0,0" VerticalAlignment="Top" Width="75" Click="btnUSBConnect_Click"/>
                    <Button x:Name="btnUSBDisconnect" Content="Disconnect" HorizontalAlignment="Left" Margin="4,35,0,0" VerticalAlignment="Top" Width="75" Click="btnUSBDisconnect_Click"/>
                </Grid>
            </GroupBox>
            <GroupBox x:Name="gbIPConnection" Header="IP Connection" HorizontalAlignment="Left" Margin="130,10,0,0" VerticalAlignment="Top" Height="162" Width="206">
                <Grid>
                    <Label x:Name="lblHost" Content="Host" HorizontalAlignment="Left" VerticalAlignment="Top"/>
                    <Label x:Name="lblUserName" Content="User Name" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,31,0,0"/>
                    <Label x:Name="lblPassword" Content="Password" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,62,0,0"/>
                    <TextBox x:Name="txtHost" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120" Margin="74,4,0,0"/>
                    <TextBox x:Name="txtUserName" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120" Margin="74,35,0,0"/>
                    <TextBox x:Name="txtPassword" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120" Margin="74,66,0,0"/>
                    <Button x:Name="btnIPConnect" Content="Connect" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="74,94,0,0" Click="btnIPConnect_Click"/>
                    <Button x:Name="btnIPDisconnect" Content="Disconnect" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="74,120,0,0" Click="btnIPDisconnect_Click"/>
                </Grid>
            </GroupBox>
        </Grid>
    </Window>
    

    • Moved by Fred Bao Tuesday, March 31, 2015 6:07 AM
    Monday, March 30, 2015 7:01 PM

Answers

  • This forum is for questions about using the .Net Framework class libraries. Your question appears to be about how to use your camera's SDK. You would probably be better off finding a site that supports the SDK.
    • Proposed as answer by Just Karl Tuesday, April 14, 2015 8:52 PM
    • Marked as answer by Just Karl Thursday, April 23, 2015 9:53 PM
    Monday, March 30, 2015 7:17 PM

All replies

  • This forum is for questions about using the .Net Framework class libraries. Your question appears to be about how to use your camera's SDK. You would probably be better off finding a site that supports the SDK.
    • Proposed as answer by Just Karl Tuesday, April 14, 2015 8:52 PM
    • Marked as answer by Just Karl Thursday, April 23, 2015 9:53 PM
    Monday, March 30, 2015 7:17 PM
  • Hi gmcarlson518,

    Like Blackwood said, This forum is for questions about using the .Net Framework class libraries. I am afraid your question is out of our support.

    About Ozeki Camera SDK is the third-party product. Please open a new thread in their official website.

    Thanks for your understanding.

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 31, 2015 6:03 AM
  • I hadn't thought about that. Thanks for the advice. If it helps anyone else, I found that the camera did have a username and password after all, even though I still couldn't get it to work. I'd take this to their web sight like you suggested but at this point I just need to make something work with the internship before it's over. Thanks again.
    Tuesday, April 7, 2015 5:09 PM