Cruisers Forum
 


Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 09-04-2012, 09:10   #46
Registered User

Join Date: Sep 2011
Posts: 205
Re: OpenCPN PlugIn Development

Hello Dave,

thanks for implementing JSON.

for the logbook would be also interesting:

the active route,
names of the routes

best regards,
konni
konni is offline   Reply With Quote
Old 09-04-2012, 09:51   #47
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,735
Re: OpenCPN PlugIn Development

Just to remind that Kees' NMEA2000 interface delivers a JSON stream as well.

(Blind talking about colors)

bcn
bcn is online now   Reply With Quote
Old 11-04-2012, 13:56   #48
Registered User

Join Date: Apr 2012
Posts: 8
Re: OpenCPN PlugIn Development

Well hello,

actually I shall develope a plug-in. But I'm not able to compile OpenCPN, because of several failures, which I don't want to mention now. I know, that opencpn.lib is necessary to build plugins. So my simple question is, whether someone can please upload or send me this file, so that I can work.
Would this be possible?
Thank you!

Best regards,
Philipp
Trip2k is offline   Reply With Quote
Old 12-04-2012, 01:21   #49
Registered User

Join Date: Mar 2010
Location: Normandy, France
Boat: Flush Poker, 8.25m (Point Barre)
Posts: 340
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by bdbcat View Post
nohal & sethdart:
The JSON message stream will soon be available.
Any event-based messages from the core that particularly interest you?
Hi,

I'd like to see the whole "en-route" panel moved to the dashboard plugin (the one you get when you goto a waypoint or activate a route: XTE, BRG, VMG, RNG, TTG + display)
This would perfectly fit the purpose of the dashboard plugin. This would probably be a separate & un-removable dashboard (maybe also deny to hide it while a route is activated).
Do you agree? Is current JSON data enough to do this?

Thanks,
Jean-Eudes
SethDart is offline   Reply With Quote
Old 12-04-2012, 04:49   #50
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,395
Re: OpenCPN PlugIn Development

Jean Eudes....

It may be a good idea to move the enroute console to a plugin for advanced features and display. However, I would like to retain the function in the core code as well, so that it is always available as a known functionality.

Perhaps they could be exclusive. That is, if the dashboard variety is available, then the core version will not be used. Then, the dashboard version could be developed and improved independently.

Its a good test of the JSON message system to see if it could be done. We should test this by trying a simple dashboard enroute console soon.

Dave
bdbcat is online now   Reply With Quote
Old 15-04-2012, 04:13   #51
mrm
Registered User

Join Date: Feb 2011
Location: Poland, EU
Boat: crew on Bavaria 38 Cruiser
Posts: 654
Re: OpenCPN PlugIn Development

Dave,

in another thread http://www.cruisersforum.com/forums/...tml#post931514 I came across a scenario in which it would be useful if a plugin could request the core to dynamically update its bitmap in a toolbar.

The general pattern which seems to emerge here is any situation where plugins running in the background need to notify a user about some condition, without requiring an immediate action from a user.

A good example would be a GRIB plugin. It can display meaningful data only if available data is valid for a current time period. If - by means of a periodic background check action - plugin notices that there is no valid data available, it might opt to change its icon to notify the user about this condition.

An idea for consideration I guess...

Marius
mrm is offline   Reply With Quote
Old 20-03-2013, 14:18   #52
Registered User

Join Date: Jul 2008
Location: Palm Beach Gardens, FL
Boat: Spindrift 43
Posts: 28
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by ActiveCaptain View Post
I know that this puts it in a gray area and seems to tweak the conscience of some open source purists. It just seems odd to me that OCPN would allow for the obvious income generation and proprietary nature of most non-US charts and yet limit the availability of things like our free data because we want to protect it from abuse and provide next generation features with some amount of control.
I am not sure this has been mentioned anywhere. While a plugin to OCPN may need to be licensed to the gpl that does not limit the possibilities.

My understanding is that the API part is what needs to be GPL, while the ABI does not. This is how the Nvidia driver works. They use an open interface to the kernel and X while using their binary blob to do the actual work. I am an open source purest and I have used the Nvidia drivers for years. For most hardware vendors this would work just fine. After all they are still selling the hardware, maybe more of it.

How this applies to Active Captain is the same as using an open source browser. The plugin to pull the data would be GPL, the data stays under the same copyright as it is on the website, there would not be any rights dilution.

If the GPL caused the license to be carried to the website content the web would be a very lame place.
alsobrsp is offline   Reply With Quote
Old 22-03-2013, 19:52   #53
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 7,395
Re: OpenCPN PlugIn Development

alsobrsp...

Thanks for the comment.

I think there are several ways in which to bring proprietary data (e.g.Active Captain) into OCPN without violating GPL while simultaneously protecting the integrity of the third party content.

We do this already with the BSB4 PlugIn, for instance. A proprietary dll is used to decrypt licensed charts for ordinary display within OCPN. Everybody is happy.

Binary blobs with a GPL compatible shim layer are yet another way, ala nVidia. While normally considered in the context of hardware support, I see no reason why the concept could not expand to data-only solutions.

As always, we stand ready to support all new proprietary data providers by means of GPLv2 compatible PlugIns.

Thanks for your support
Dave
bdbcat is online now   Reply With Quote
Old 25-03-2013, 14:14   #54
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,627
Images: 2
Re: OpenCPN PlugIn Development

Also isn't NV-charts plugin another example. I don't understand all of the legal / technical details, but it seems to me like there are a number of examples available. -It's not unusual that we look for other reasons not to do something... Hopefully Active Captain will find all the Right reasons for doing it! -This is a very strong community that has the power to help Active Captain too.
rgleason is offline   Reply With Quote
Old 16-06-2014, 01:18   #55
Registered User

Join Date: Mar 2014
Posts: 8
Re: OpenCPN PlugIn Development

Hi~ developers.
I am making a plugin which plays audio and video files.
The plugin can play audio files(mp3, ogg), but can't play video files.
I used the wxMediaCtrl and I am sure I installed codecs.
The plugin loaded the video file because I could print out the size, rate and volume.


And when my plugin are loaded the error message are printed in my console.
(opencpn:6537): Gtk-CRITICAL **: IA__gtk_range_set_range: assertion 'min < max' failed

best regards,
onecue
onecue is offline   Reply With Quote
Old 16-06-2014, 01:52   #56
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,207
Re: OpenCPN PlugIn Development

onecue...
You kind of forgot to show us your code, so we can't help you much...
The only thing I can suggest is that you try to build the mediaplayer sample from "wx2.8-examples" package (called like that on Debian/Ubuntu, if you are using other distro, it could differ).
It plays videos just fine on my system, so I suppose that wxMediaCtrl is not completely broken. And it causes exactly the same harmless
Code:
(mediaplayer:28623): Gtk-CRITICAL **: IA__gtk_range_set_range: assertion 'min < max' failed
Nothing to worry about.

Pavel
nohal is offline   Reply With Quote
Old 16-06-2014, 03:36   #57
Registered User

Join Date: Mar 2014
Posts: 8
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by nohal View Post
onecue...
You kind of forgot to show us your code, so we can't help you much...
The only thing I can suggest is that you try to build the mediaplayer sample from "wx2.8-examples" package (called like that on Debian/Ubuntu, if you are using other distro, it could differ).
It plays videos just fine on my system, so I suppose that wxMediaCtrl is not completely broken. And it causes exactly the same harmless
Code:
(mediaplayer:28623): Gtk-CRITICAL **: IA__gtk_range_set_range: assertion 'min < max' failed
Nothing to worry about.

Pavel
Sorry for missing code.
Code:
#include "LauncherUIDialog.h"
///////////////////////////////////////////////////////////////////////////


LauncherUIDialog::LauncherUIDialog( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
    this->SetSizeHints( wxDefaultSize, wxDefaultSize );

	wxBoxSizer* main_sizer;
	main_sizer = new wxBoxSizer( wxVERTICAL );	
	m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL );
    m_scrolledWindow->SetScrollRate( 5, 5 );    
    button_sizer = new wxBoxSizer( wxVERTICAL );
    m_scrolledWindow->SetSizer( button_sizer );
    m_scrolledWindow->Layout();
    button_sizer->Fit( m_scrolledWindow );
    main_sizer->Add( m_scrolledWindow, 1, wxALL | wxEXPAND, 5 );
    this->SetSizer( main_sizer );
    this->Layout();
    this->Centre( wxBOTH ); 
        
    wxPanel *panel = new wxPanel(this, -1);    
    button_sizer->Add(panel, 1, wxALL | wxEXPAND, 5 );    
    
    media = new wxMediaCtrl(panel, wxID_MEDIACTRL, wxT(""), wxPoint(10, 200), wxSize(640,480));
    media->ShowPlayerControls();
    
    
    LauncherButton *btnLoad = new LauncherButton( panel, wxID_ANY, _T("Load"), wxPoint(10,10), wxDefaultSize, 0 );    
    btnLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LauncherUIDialog::OnLoadClick ), NULL, this );  
    
    LauncherButton *btnPlay = new LauncherButton( panel, wxID_ANY, _T("Play"), wxPoint(110,10), wxDefaultSize, 0 );
    btnPlay->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LauncherUIDialog::OnPlayClick ), NULL, this );  
    
    LauncherButton *btnPause = new LauncherButton( panel, wxID_ANY, _T("Pause"), wxPoint(210,10), wxDefaultSize, 0 );    
    btnPause->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LauncherUIDialog::OnPauseClick ), NULL, this );   
        
    LauncherButton *btnStop = new LauncherButton( panel, wxID_ANY, _T("Stop"), wxPoint(310,10), wxDefaultSize, 0 );
    btnStop->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( LauncherUIDialog::OnStopClick ), NULL, this );  
    
    this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_LOADED, wxMediaEventHandler(LauncherUIDialog::OnMediaLoaded),
                  (wxObject*)0, this);



    //play list              
    m_playlist = new wxMediaPlayerListCtrl();
    m_playlist->Create(panel, wxID_ANY, wxPoint(700,200),
                    wxSize(400,400),
                    wxLC_REPORT // wxLC_LIST
                    | wxSUNKEN_BORDER);


    m_playlist->SetBackgroundColour(*wxWHITE);

    
    wxListItem col0;
    col0.SetId(0);
    col0.SetText( _("") );
    col0.SetWidth(50);
    m_playlist->InsertColumn(0, col0);
    
    wxListItem col1;
    col1.SetId(1);
    col1.SetText( _("File") );
    col1.SetWidth(200);
    m_playlist->InsertColumn(1, col1);
    
    wxListItem col2;
    col2.SetId(2);
    col2.SetText( _("Length") );
    col2.SetWidth(50);
    m_playlist->InsertColumn(2, col2);
    
    m_slider = new wxSlider(panel, wxID_ANY, 0, // init
                            0, // start
                            1, // end, dummy but must be greater than start
                            wxPoint(10, 100), wxSize(250,20),
                            wxSL_HORIZONTAL );
    
    m_timer = new wxMediaPlayerTimer(this);
    m_timer->Start(500);
    
    m_volSlider = new wxSlider(panel, wxID_ANY, 100, // init
                            0, // start
                            100, // end
                            wxPoint(300,100), wxSize(20,100),
                            wxSL_VERTICAL );
                            
	m_volSlider->Connect(wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler(LauncherUIDialog::OnVolChange), NULL, this);

}

void LauncherUIDialog::CreateButtons( const wxArrayString& labels, const wxArrayString& commands )
{
    for ( size_t i = 0; i < labels.Count(); i++ )
    {
        AddButton( labels[i], commands[i] );
    }
    this->m_scrolledWindow->Layout();
    this->button_sizer->Fit( m_scrolledWindow );
    this->Layout();
}

void LauncherUIDialog::AddButton( const wxString& label, const wxString& command )
{

}


LauncherUIDialog::~LauncherUIDialog()
{

}
void LauncherUIDialog::OnLoadClick( wxCommandEvent& event )
{
	printf("load\n");
	
	wxFileDialog* OpenDialog = new wxFileDialog(this, _T("Choose a file to open"), wxEmptyString, wxEmptyString, _T("All files (*.*)|*.*"), wxFD_OPEN, wxDefaultPosition);
	
	if (OpenDialog->ShowModal() == wxID_OK) 
	{

		if( !media->Load(OpenDialog->GetPath())){
			 printf("Couldn't load file!\n");
		}else{
			printf("load file\n");
			printf("%s\n", (const char*)OpenDialog->GetPath().mb_str());
			m_playlist->AddToPlayList(OpenDialog->GetPath());
		}		
	}
    
    OpenDialog->Destroy();
}

void LauncherUIDialog::OnPauseClick( wxCommandEvent& event )
{
    if( !media->Pause()){
		printf("Couldn't Pause!\n");
	}else{
		printf("pause!\n");
	}
}

void LauncherUIDialog::OnPlayClick( wxCommandEvent& event )
{
	wxListItem listitem;
	m_playlist->GetSelectedItem(listitem);
	
	media->Load((*((wxString*)listitem.GetData())));
	
    if( !media->Play()){
		printf("Couldn't play file!\n");
	}else{
		printf("play file!\n");
	}
}

void LauncherUIDialog::OnStopClick( wxCommandEvent& event )
{
    if( !media->Stop()){
		printf("Couldn't stop!\n");
	}else{
		printf("stop!\n");
	}
}

void LauncherUIDialog::OnMediaLoaded(wxMediaEvent& WXUNUSED(evt))
{
		
	if( !media->Play()){
		printf("Couldn't play file!\n");
	}else{
		printf("play file!\n");
		printf("size : (%i,%i), Play back Rate : %lf, vol : %lf\n",media->GetBestSize().GetWidth(), media->GetBestSize().GetHeight(), media->GetPlaybackRate(), media->GetVolume());
	}
	
}

void LauncherUIDialog::OnVolChange(wxScrollEvent& event)
{
	media->SetVolume(m_volSlider->GetValue() / 100.0);
}


void LauncherUIDialog::SetPositionFix( double Lat, double Lon, double Cog, double Sog, double Var, time_t FixTime, int nSats )
{

}


void wxMediaPlayerTimer::Notify()
{   
	printf("timer\n");
    // Number of minutes/seconds total
    wxLongLong llLength = m_dlg->media->Length();
    int nMinutes = (int) (llLength / 60000).GetValue();
    int nSeconds = (int) ((llLength % 60000)/1000).GetValue();

    // Duration string (i.e. MM:SS)
    wxString sDuration;
    sDuration.Printf(wxT("%2i:%02i"), nMinutes, nSeconds);


    // Number of minutes/seconds total
    wxLongLong llTell = m_dlg->media->Tell();
    nMinutes = (int) (llTell / 60000).GetValue();
    nSeconds = (int) ((llTell % 60000)/1000).GetValue();
    
    printf("%i(m)  %i(s)\n",nMinutes, nSeconds);

    // Position string (i.e. MM:SS)
    wxString sPosition;
    sPosition.Printf(wxT("%2i:%02i"), nMinutes, nSeconds);


    m_dlg->m_slider->SetRange(0, (int)(llLength / 1000).GetValue());

        m_dlg->m_slider->SetValue((long)(llTell / 1000).GetValue());


    wxSize videoSize = m_dlg->media->GetBestSize();


}
onecue is offline   Reply With Quote
Old 16-06-2014, 07:59   #58
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,207
Re: OpenCPN PlugIn Development

onecue...
Either post some minimal example to illustrate the problem or make an account on github.com and put your whole plugin code there. Nobody, at least not me, has time to go through 200+ lines of unknown code which can't be used and look for a problem that perhaps does not even exist generally.

Sorry

Pavel
nohal is offline   Reply With Quote
Old 16-06-2014, 23:08   #59
Registered User

Join Date: Mar 2014
Posts: 8
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by nohal View Post
onecue...
Either post some minimal example to illustrate the problem or make an account on github.com and put your whole plugin code there. Nobody, at least not me, has time to go through 200+ lines of unknown code which can't be used and look for a problem that perhaps does not even exist generally.

Sorry

Pavel
The problem was a virtualBox. When I tested the code in my laptop, everything was fine.

Next time, I will summarize error code as a matter of convenience.

Thanks nohal for interest on my post.
onecue is offline   Reply With Quote
Old 17-06-2014, 01:55   #60
Registered User

Join Date: Aug 2009
Location: oriental
Boat: crowther trimaran 33
Posts: 4,417
Re: OpenCPN PlugIn Development

Quote:
Originally Posted by rgleason View Post
Also isn't NV-charts plugin another example. I don't understand all of the legal / technical details, but it seems to me like there are a number of examples available. -It's not unusual that we look for other reasons not to do something... Hopefully Active Captain will find all the Right reasons for doing it! -This is a very strong community that has the power to help Active Captain too.
Active Captain is a special case, because the author does not want anyone to be able to fork the data. This is technically impossible to stop even with a closed source program, consider the case of ge2kap. If the plugin is open, then it can be achieved more easily without the need to script automatic key presses and mouse clicks. It is probably more worthwhile in the long run to work on a free alternative instead.
seandepagnier is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Marina Development in China GordMay Pacific & South China Sea 4 29-09-2009 04:33
New Battery Research & Development BlueSovereign Electrical: Batteries, Generators & Solar 7 31-07-2009 14:47
Nautical Development 39 (Morgan 39?) riptide Monohull Sailboats 1 22-07-2009 11:53
Turks and Caicos Development Petition Canibul Atlantic & the Caribbean 5 24-04-2008 18:15

Advertise Here


All times are GMT -7. The time now is 06:59.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.