MLGenericSerial problems

Repository of MainLobby Server plug-ins and updates not available in the current installation.
bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

MLGenericSerial problems

Postby bigDvette » Sun Sep 07, 2008 6:00 pm

Ok,

I installed MLGenericSerial. I get data (in debug and the log)

I receive HEX data so I checked that box. I put 2A in the wildcard box on the screen.

I've setup a Map Command called IncomingData.

When I click LEARN I get the following string

5AFFAA0F1902100B120008007A000000708D4A0000F04004F9

Now the 5AFFAA0F part is always the same and DA is my terminating character.

If I remove everything after 5AFFAA0F, each time a command comes in every 2 seconds), my command I've stipulated runs. it is

SetVariable|Donald~<<*1>>

No what I want to do is get all the data after 5AFFAA0F so I though by reading the wiki and everything in teh forum I would change my input stream to 5AFFAA0F2A

When I do that the command never fires. However, when it does fire when just using 5AFFAA0F as the input, my variable just says *1 or #1 or x1 depending on what I use there between the << >>.

If I leave the entire response of 5AFFAA0F1902100B120008007A000000708D4A0000F04004F9 in the input box, it works until the minute changes on the pool controller and then it no longer maps.

It seems it is the wildcard that is not working, but i just can't figure this out.

Thanks in advance, I'm not using GenericDevice because it doesn't support HEX.

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Mon Sep 08, 2008 1:58 pm

Is this the right forum for MLGenericSerial by the way?

BUMP

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Wed Sep 10, 2008 2:13 pm

bump again - anyone?

MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

Postby MurrayW » Wed Sep 10, 2008 4:59 pm

bigDvette wrote:Ok,

I installed MLGenericSerial. I get data (in debug and the log)

I receive HEX data so I checked that box. I put 2A in the wildcard box on the screen.

I've setup a Map Command called IncomingData.

When I click LEARN I get the following string

5AFFAA0F1902100B120008007A000000708D4A0000F04004F9

Now the 5AFFAA0F part is always the same and DA is my terminating character.

If I remove everything after 5AFFAA0F, each time a command comes in every 2 seconds), my command I've stipulated runs. it is

SetVariable|Donald~<<*1>>

No what I want to do is get all the data after 5AFFAA0F so I though by reading the wiki and everything in teh forum I would change my input stream to 5AFFAA0F2A

When I do that the command never fires. However, when it does fire when just using 5AFFAA0F as the input, my variable just says *1 or #1 or x1 depending on what I use there between the << >>.

If I leave the entire response of 5AFFAA0F1902100B120008007A000000708D4A0000F04004F9 in the input box, it works until the minute changes on the pool controller and then it no longer maps.

It seems it is the wildcard that is not working, but i just can't figure this out.

Thanks in advance, I'm not using GenericDevice because it doesn't support HEX.
Just want to make sure I understand this correctly. When you say "If I remove everything after 5AFFAA0F, each time a command comes in every 2 seconds), my command I've stipulated runs."

Does this mean that you only need to figure out how to strip off the "5AFFAA0F" from 5AFFAA0F1902100B120008007A000000708D4A0000F04004F9 leaving you with 1902100B120008007A000000708D4A0000F04004F9 (or whatever the new value is)?

If so, couldn't you use MLStrings right and len functions along with MLMath to set a new variable that is equal to the rightmost x characters? If the returned string length is always the same, then it would be even easier and you would not have to use the len function to determine the length of the string.

Something like this:
1. Set a variable called pool_controller_return_string_full = to the value that is returned.
2. Set a variable called pool_controller_return_string_length = to the length of the variable from #1 using MLStrings len function:

Code: Select all

MLServeCmd.MLStrings|Len~pool_controller_return_string_length ~{{pool_controller_return_string_full}}

3. Use MLMath to determine how many of the characters of the full string are after "5AFFAA0F":

Code: Select all

MLMath|Subtract~pool_controller_return_string_length_stripped~{{pool_controller_return_string_length}}~8

4. Set a new variable that contains only the characters after "5AFFAA0F" using MLStrings left function:

Code: Select all

MLServeCmd.MLStrings|Right~pool_controller_return_string_stripped~{{pool_controller_return_string_full}}~{{pool_controller_return_string_length_stripped}}

5. Use the {{pool_controller_return_string_stripped}} variable in your command map.

Here's another thread where the same concept is being used:
http://forum.cinemaronlineforums.com/viewtopic.php?t=12889&highlight=mlmath&sid=19c52dd41b371fab3264a01d901d1725

If MLStrings will allow you to replace a string with nothing (I've never tried so don't know if it can), then you could knock out a few steps above by using the replace function of MLStrings.

1. Same as above.
2. Replace 5AFFA0F with nothing using MLStrings:

Code: Select all

MLServeCmd.MLStrings|Replace~pool_controller_return_string_stripped~{{pool_controller_return_string_full}}~5AFFAA0F~

3. Same as #5 above.

Hopefully this will help (unless I misinterpreted what response you are getting and what you need to send).

Good luck,
Murray

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Wed Sep 10, 2008 7:00 pm

Nowhat I am saying is that mlgenericserial has you use a mask to tell it when a certain kind of message has been received.

For me that is defined by the first 4 bytes of the hex data.

If I pull off the first 4 bytes, then the command map fires, but I can't figure out how to get the remaining 22 bytes from the actual message to sent do MLStrings or anything else.

I thought you basically put a 2A at the end of the message mask to tell it this and use the <<*1>> to get the remaining data, but this isn't working for me.

MurrayW
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1198
Joined: Sun Mar 07, 2004 1:05 pm
Location: Austin, TX
Contact:

Postby MurrayW » Wed Sep 10, 2008 8:20 pm

bigDvette wrote:Nowhat I am saying is that mlgenericserial has you use a mask to tell it when a certain kind of message has been received.

For me that is defined by the first 4 bytes of the hex data.

If I pull off the first 4 bytes, then the command map fires, but I can't figure out how to get the remaining 22 bytes from the actual message to sent do MLStrings or anything else.

I thought you basically put a 2A at the end of the message mask to tell it this and use the <<*1>> to get the remaining data, but this isn't working for me.
I must be a little dense tonight. So you are struggling reading the string returned into a variable? If that is the case, I am not sure how to do it.

On a side note, I did test the MLStrings|Replace function and it does allow you to replace characters with nothing, so doing what I described above (even though it might not help you with your problem) could be done in fewer steps using Replace rather than the Len/MLMath/Right sequence.

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Thu Sep 11, 2008 8:56 pm

bump for anyone that can help me with MLGenericSerial. My issue is not what to do with the data, it is how to pull it from the string.

stjoh
New Member
New Member
Posts: 33
Joined: Mon Jan 10, 2005 11:52 pm
Contact:

Postby stjoh » Thu Nov 13, 2008 8:17 pm

Did anybody figure this one out?
stjoh


Return to “MLServer Plug-Ins”

Who is online

Users browsing this forum: No registered users and 1 guest