Add fault codes

This commit is contained in:
Bottersnike 2022-12-26 00:12:00 +00:00
parent b8f8ac759b
commit 9bcd589d03
3 changed files with 11 additions and 62 deletions

View File

@ -14,22 +14,3 @@ use for this codebase, please get in touch first.
This software is provided without warranty of any kind, express or implied. If you use it and
manage to brick an arcade machine or cause similar silly damage, don't come crying.
## Keys
In order to run this code, some encryption keys need loaded in. I have opted to not include them in
this repo because I didn't really feel like doing that. May or may not change that stance later.
For now, copy `eaapi/keys.template.py` to `eaapi/keys.py`, and fill in the blanks. If you're
following along with docs, you already have the values you need. Otherwise, I trust you can figure
out somewhere to find them. `CARDCONV_KEY` is only required if you plan to make use of `cardconv`.
**Note:** If, for whatever reason, you are using this codebase but not interacting with Bemani
games or services, consider instead picking your own keys rather than using the real ones. `EA_KEY`
can be any length, `CARDCONV_KEY` should be 24 bytes.
## Why is `eaapi.server` a submodule?
This repository is intended to serve as an example implementation, and nothing something that
should be used. For that reason, I'm not currently making the parts of the codebase that implement
HTTP, routing, etc. public as they don't further this goal, and would encourage inappropriate use.

View File

@ -52,6 +52,17 @@ CONTENT = (
ARRAY_BIT = 0x40
ARRAY_MASK = ARRAY_BIT - 1
FAULT_BAD_PCBID = "0100"
FAULT_BAD_ARCADE = "0101"
FAULT_BAD_GAME = "0102"
FAULT_OUT_OF_SERVICE = "0117"
FAULT_EA_ENDED = "0121"
FAULT_MALFORMED_REQUEST = "0125"
FAULT_EA_REGISTRATION_NEEDED = "0127"
FAULT_MAINTENANCE = "0128"
FAULT_GAME_OLD = "0133"
FAULT_GAME_UNSUPORTED = "0138"
@dataclass
class _Type:

View File

@ -1,43 +0,0 @@
# eaapi.server
## Quickstart
```py
server = EAMServer("http://127.0.0.1:5000")
@server.handler("message", "get")
def message(ctx):
ctx.resp.append("message", expire="300", status="0")
server.run("0.0.0.0", 5000)
```
```py
EAMServer(
# The URL this server can be access at. Used for services
public_url,
# Add `/<service>/` as a prefix when generating service urls (useful when debugging games)
prefix_services: bool = False,
# If both the URL and the query params match, which one gets the final say?
prioritise_params: bool = False,
# Include e-Amusement specific details of why requests failed in the responses
verbose_errors: bool = False,
# The operation mode in services.get's response
services_mode: eaapi.const.ServicesMode = eaapi.const.ServicesMode.Operation,
# The NTP server to use in services.get
ntp_server: str = "ntp://pool.ntp.org/",
# Keepalive server to use in serices.get. We'll use our own if one is not specified
keepalive_server: str = None
)
@handler(
# Module name to handle. Will curry if method is not provided
module,
# Method name to handle
method=None,
# The datecode prefix to match during routing
dc_prefix=None,
# The service to use. Likely `local` or `local2` when handling game functions
service=None
)
```