Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Wed Jan 29, 2020 10:51 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Inbuilt classes
PostPosted: Wed Mar 23, 2011 5:07 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 7:57 am
Posts: 72
Location: Solihull UK
How does one instantiate an inbuilt class (rb) such as udpsocket or must you instantiate a subclass.
I tried and the runtime system complains about the manifest being out of date which I gather is being throw when the plugin loader is loading.

I tried everything including adding the get class call to the plugin entry to cache the class and still it fails

This is driving me nuts I try using a subclass can cannot set the port on a tcpor udp class it fails with false when I call set props.

Any ideas guys

Mark


Top
 Profile  
Reply with quote  
 Post subject: Re: Inbuilt classes
PostPosted: Wed Mar 23, 2011 6:13 am 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
Make a global property called "myUdp" in a window or module.
then in open event of the app or window
myUdp = new UDPSocket


you can also make a subclass or add the class to the window by:
- right-mouseclick on the window your currently editing
- select "add"
- choose "SocketCore"
- select the sub-menu "UDPSocket"
now you have added a class to the window.

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Inbuilt classes
PostPosted: Wed Mar 23, 2011 7:22 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 7:57 am
Posts: 72
Location: Solihull UK
Arghh I tried that defined myUDP as global in the app called the new in the open event
(which I should not need to do as newInst is going to create an obj anyway using the class def as a template
one would think, nope it fails with -1 cannot find class in the REALGetClassRef call.

I am missing something big-time here and I do not know what

static int getDataSocket(void){
int retCode;
short mPort = 5199;

REALclassRef mUDP = REALGetClassRef("myUDP"); // Check for null...
if (mUDP==NULL)
return -1;

REALobject mObj = REALnewInstance( mUDP ); // Check for null...
if (mObj==NULL)
return -2;

retCode=REALSetPropValue(mObj, "Port",mPort);
return retCode;
}


Mark


Top
 Profile  
Reply with quote  
 Post subject: Re: Inbuilt classes (Solved)
PostPosted: Wed Mar 23, 2011 8:19 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 7:57 am
Posts: 72
Location: Solihull UK
Sorted it dude

Followed your instructions again including the instantiation of the classes which (your right) is needed
as the classes are located at runtime ..

it failed arghhhh, then I re-read the docs again and added

void PluginEntry() {
mTCP = REALGetClassRef("TCPSocket");
mUDP = REALGetClassRef("UDPSocket"); // Check for null...

// The Plug In Entry Area
// Register the global all of our Global Methods:

for (UInt32 i = 0; i < sizeof(pluginMethodArray) / sizeof(REALmethodDefinition); ++i)
REALRegisterMethod (&pluginMethodArray[i]);
}


Bingo it worked I can get a handle to the TCP and UDP sockets off now to work how I work with the events and datagrams lol

Thanks for the top tip, I see what was happening now, and why I was getting the runtime error.

It was simple neither the TCP or UDP object existed when I called for them..to resolve their names with the
new instance call


Thanks again

Mark


Top
 Profile  
Reply with quote  
 Post subject: Re: Inbuilt classes
PostPosted: Wed Mar 23, 2011 8:30 am 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
im not a plugin dude but what are you building, are you selling it when
its done?

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Inbuilt classes
PostPosted: Wed Mar 23, 2011 8:38 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 7:57 am
Posts: 72
Location: Solihull UK
It's a decompressor for gsm and nope it will be free
A very specific use however
But nope it will be free gratis and the open source later on
Mark


Top
 Profile  
Reply with quote  
 Post subject: Re: Inbuilt classes
PostPosted: Wed Mar 23, 2011 8:46 am 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
i like gratis (free) but isnt gratis a dutch word.?

what will it actually do wit gsm and decompressor.?

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Inbuilt classes
PostPosted: Wed Mar 23, 2011 10:07 am 
Offline
User avatar

Joined: Thu Jan 07, 2010 7:57 am
Posts: 72
Location: Solihull UK
lol I gather it may be, the dutch are cool anyway I love the netherlands used to watch the
bike racing in Assen every year (well if we were sober enough) lol.

anyway its for a VOIP project I only have a performance issue now I have solved all of my other
issues in the plugin and it works great just that the audio chops up (context switching in and out of RB and the plugin)

Its been a real trip to play with the Plugin api but now the light has come on its clear
just how powerful this really is.

I did have a bit of brain freeze with the Datagram stuff with the UDP packet but then
I spotted that RB has a datagram class (cool) I can use that so I then added a datagram class to the test app
added the necessary support into the plugin and now I have a datagram class no casting
no messing about

RB and OPP rock, my C++ was a bit weak (I am a 'C' man), I have to say also that the guys on this forum
have been fantastic in helping me and being patient with my stupid questions.

There are lots of things I have picked up since this project In a couple of weeks, I will try and post the code for the solutions I have found to help other people, I hope also that my code will be pulled apart as I am always keen
to improve my knowledge.

thanks again for your help to list everyone would be hard and somewhat unfair as I have also read every single post
in depth played and broke things

This does open up a lot of other paths for me personally.

Mark


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group