r1pper / GoPro.Hero

a lightweight c# library to access and control GoPro HERO Action cameras

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot connect to my GoPro

Krusty93 opened this issue · comments

Hi,
I'm using this library to share videos from GoPro to WP smartphone and I've got a problem during connection.

I copied your sample from other discussion and I put default IP address (10.5.5.9) in Camera.Create method.
But VS report me twice System.ArgumentException, so I "followed" stack methods. So I was able to discover that the problem is in this line:
"var response = await request.GetResponseAsync() as HttpWebResponse;"
You can find it in SendRequestAsynchronous method, in CommandRequest class.

Why I cannot connect phone and cam?
Obviously they're connected via WiFi

Thanks you for support
Bye

Hello @Krusty93

I'm glad you found the Library useful
Unfortunately I don't own a WP8 device , I tested it with provided Emulator, Here is the code I used

    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();

            Connect();
        }

        private void Connect()
        {
            var thread = new Thread(CreateCamera);
            thread.Start();
        }

        private void CreateCamera()
        {
            var camera = GoPro.Hero.Camera.Create<GoPro.Hero.Hero3.Hero3Camera>("10.5.5.9");

            var poweredOn = camera.PowerAsync().Result;

            if (!poweredOn)
            {
                camera.PowerOn();
                Thread.Sleep(8000);//warm up if camera was off (mostly for media browser)
            }

            var name = camera.Information().Name;
            var camVersion = camera.Information().Version;
            var firmware = camera.BacpacInformation().FirmwareVersion;
            var bootloader = camera.BacpacInformation().BootloaderVersion;

            Dispatcher.BeginInvoke(() => MessageBox.Show(string.Format("Name: {0}",name)));
            Dispatcher.BeginInvoke(() => MessageBox.Show(string.Format("Camera Version: {0}",camVersion)));
            Dispatcher.BeginInvoke(() => MessageBox.Show(string.Format("Firmware Version: {0}.{1}.{2} Build {3}", firmware.Major,firmware.Minor,firmware.Revision,firmware.Build)));
            Dispatcher.BeginInvoke(() => MessageBox.Show(string.Format("Bootloader Version: {0}.{1}.{2} Build {3}", bootloader.Major, bootloader.Minor, bootloader.Revision, bootloader.Build)));

            camera.Mode(Mode.Photo);

            var browser =camera.Browse<GoPro.Hero.Browser.Media.GoProMediaBrowser>();
            var contents = browser.Contents();
            Dispatcher.BeginInvoke(() => MessageBox.Show(string.Format("Contents Count: {0}",contents.Count())));

            var first=browser.Contents().First();
            Dispatcher.BeginInvoke(() => MessageBox.Show(string.Format("Name: {0}, Size: {1}",first.Name,first.Size)));
        }
    }

I couldn't replicate the problem, Different Firmware and Versions may cause it, so I suggest you to test it On your PC and Emulator to verify the problem, it would be great if you could send me the URI of the failed requests (from GetUri() in CommandRequest).

Camera used for Testing

Hero 3 Black
Version: HD3.03.03.00
Firmware: 3.4.0 Build 2
Bootloader: 0.2.18 Build 2

Best Regards

Hi,
thanks you for reply.

I've copied and pasted your code, but I've got an other problem, during connection as well.

In "GetFilterProfile(String name)" method (class FilterGeneric) , stream is null and can't return.
I tried also to replace "Assembly.getExecutingAssembly().getManifestResourceStream(name)" with "System.Reflection.Assembly.GetExecutingAssembly().FullName.Split(',')[1].Split('=')[1];", but it doesn't work.

Any ideas?
I used phone and emulator as well.
GoPro is Hero 3 White
Version HD3.09.03.03 (read on official GoPro app WP)

@Krusty93 I got a Nokia Lumia 520, a hero3 black and hero2. I can test if you want :)

@KonradIT so test, thank you a lot :) Copy and paste r1pper code in WP project
Thanks!

@Krusty93

Do you have Hero3FilterScheme.xml in Hero3 folder (GoPro.Hero.Hero3)(and build action should be Embedded Resource)?

I think some files are missing here,please get the project again or download entire repository as zip and check if the problem persists

@r1pper I downloaded again your zip files, but when I open it, VS notify a lot of error and not compile.
How can I do?
Create a new personal project and imports all your classes? With wich .NET framework? If the problem are missing files, a your easily and quick tutorial can help me a lot :)

Thanks as usual

edit: yes, xml files have build action on Embedded Resource

@Krusty93

I checked the source again (from repository) and it compiles without any modification with Visual Studio 2012 ( the only problem is, the Winform sample is removed which you can safely ignore it)

What version of Visual Studio are you using?

the library is a PCL assembly, so you need Visual Studio 2012 Professional or Higher to compile the source (Express editions are not supported) but you can use the compiled assembly with any edition

for Visual studio 2013 professional or Higher:

1- Update Nuget package Manager (from Tools -> Extensions and Updates)
2- Type Update-Package in package manager console
3- Clean Solution
4-Build
5-run some simple unit test like CheckSoptMeter to verify library
5-Remember some projects may need Microsoft.Bcl.Build from nuget

Best Regards

Sorry for delay to reply, but I was engaged with university in this days.
So, I tried only now, and finally works :)

But I tried this time with VS 2012 Pro, instead of VS2013 Pro. But I've not tried with 2013 version yet (and I need this because my app is a plugin for already existing WP8.1 app)

Thanks you very much.

P.S. How I can contact you without open a new "issue" again? Thanks again
P.P.S Where can I find some documentation? :)