Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

SAS protocol

by MarSkv267 (Novice)
on Jan 13, 2022 at 08:37 UTC ( [id://11140421]=perlquestion: print w/replies, xml ) Need Help??

MarSkv267 has asked for the wisdom of the Perl Monks concerning the following question:

I have few questions about SAS protocol.

I managed to upgrade the Perl Win32 :: SerialPort module and with the kind help of Marshall I made a working GUI RS232 terminal.

Now I would like to upgrade the RS232 terminal to be able to communicate with the gaming machine on SAS.

I have a Python script that communicates with the slot machine; I would like to know how Python does this and how to transfer it to Perl.

Unfortunately I have no idea about Python and I can't run Python script in Komodo IDE because it tells me it can't find PIP.

I read in the SAS documentation that you need to adjust the parity before sending the code to the slot machine, but the Win32 :: SerialPort documentation is not too generous with explanations, so I'm asking for a little help.

I'd really like to avoid dealing with Python :) so I wonder if anyone has already resolved communication with SAS in Perl?

Thanks in advance for you help!

Replies are listed 'Best First'.
Re: SAS protocol
by marto (Cardinal) on Jan 13, 2022 at 08:54 UTC

    "I have few questions about SAS protocol."

    SAS? If not which protocol are you talking about?

    "Unfortunately I have no idea about Python and I can't run Python script in Komodo IDE because it tells me it can't find PIP."

    You don't need to run it to be able to see what it is doing, looking at the code alone should allow you to walk through it, if you have problems breaking down each line one at a time shouldn't be too difficult.

    "I read in the SAS documentation that you need to adjust the parity before sending the code to the slot machine, but the Win32::SerialPort documentation is not too generous with explanations, so I'm asking for a little help."

    Initialization:

    "parity

    One of the following: "none", "odd", "even", "mark", "space". If you select anything except "none", you will need to set parity_enable."

    Update: fixed typo, thanks LanX.

Re: SAS protocol
by Discipulus (Canon) on Jan 13, 2022 at 08:54 UTC
    Hello MarSkv267,

    this SAS?

    L*

    PS Cross Posted?

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: SAS protocol
by Marshall (Canon) on Jan 13, 2022 at 15:52 UTC
    My guess is that you are talking about IGT's proprietary SAS - Slot Accounting System - protocol for casino gaming machines. Of course it is better if you volunteer this info up front so that we don't have to guess at all.

    It looks to me like these guys are pretty tight lipped about the details of the protocol. A gaming machine manufacturer has to sign some form of NDA (Non Disclosure Agreement). That wouldn't happen if this was a "open" protocol. Anyway, I have no clue about any details of this protocol. Where did you get this SAS documentation?

    I am hoping that you have some 2nd hand machine that was bought on the open market and you want to play with it. I would contact the manufacturer of that machine and see what help they can give you (if any).

    parity adjustment seems straight forward:
    From the docs:

    $PortObj->baudrate(9600); $PortObj->parity("odd"); $PortObj->databits(8); $PortObj->stopbits(1);
    Of course Wiki for Serial Ports will get you up to speed on the lingo. Parity is probably "odd" or "even". I doubt "none" or "mark" or "space" would be used in an app like this.

    update: Read IGT's doc above. It talks about GSA (Gaming Standards Association) and their adoption of this protocol as a standard. I leave searching around on the net for documentation to you - I don't think anybody here cares - that should be part of your work.

      I did several Raspberry Pi projects and one of them is establishing communication with an ancient slot machine (1995). I've found "documentation" about SAS on one of websites for Raspberry Pi (or Arduino): is a 10 lines code snippet in C++, one of lines is serialPort1.Parity = Parity.Mark; and there's another line with parity which is not "odd" or "even". I'm trying to translate that to Perl script with GUI.

        "one of lines is serialPort1.Parity = Parity.Mark; and there's another line with parity which is not "odd" or "even". I'm trying to translate that to Perl script with GUI."

        Unsurprisingly, specifically mentioned in the documentation, which I showed you here.

        There are 3 basic parity options:
        1. Don't send parity bit ("none")
        2. Calculate and send parity bit, ("odd","even")
        3. Send a fixed value for the parity bit, ("mark"- logical 1, "space"- logical 0)

        You can go faster if you don't send the parity bit. Most applications send a calculated parity bit (calculation done by the RS-232 chip) with either odd or even parity.

        Sending a fixed value for the parity is a "weird duck". This might be done to essentially "add a 9th data bit", or to force a parity error for some framing reason. When doing that, usually the chip is re-configured just temporarily for a single data byte. So options are "mark","space","none","odd","even". I have no idea why the SAS protocol would send a "mark" for the parity - the rationale for that is protocol dependent. Parity is configured by one of those 5 strings as marto's post explained.

Re: SAS protocol
by MarSkv267 (Novice) on Jan 13, 2022 at 09:36 UTC

    It seems there are three diferent SAS-es: one for databases (?) (www.sas.com), one for SCSI - and the one I'm asking about, the SAS which communicates with slot machines.

      Hello MarSkv267,

      First I hate hazard games involving money, but this is another concern..

      That said more effort you put asking questions here at the monastery, better chances you have to get back good answers.

      If you had provided some more information perhaps tybalt89 would produced a regex for this, LanX a debug session ( PS or futile pics of Tuskens..), haukex some benchmarks, Corion a plethora of automations, Marshall a complete working program and me a oneliner to provide a zillion of dollars to the 42th casual user..

      L*

      There are no rules, there are no thumbs..
      Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

        While my first instinct was that "Win32::SerialPort is of no use for covert military actions", a lot of military equipment does use RS232. Like most GPS modules. And there are some quite big military things using/have used Windows as well.

        The mere possibility that another failed Windows 10 update could accidentally start a war is somewhat frightening. Or the possibility that the backup to the primary navigation system is Bing Maps...

        perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'
Re: SAS protocol
by Anonymous Monk on Jan 14, 2022 at 01:23 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11140421]
Approved by LanX
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2024-04-25 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found