forked from ueckoken/KM4K
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from ueckoken/flat-layout
flat layout
- Loading branch information
Showing
16 changed files
with
191 additions
and
184 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import os | ||
from datetime import timedelta | ||
|
||
import redis | ||
from RPi import GPIO | ||
|
||
import km4k2.rb303 as servo | ||
from km4k2.card_sdk import CardSDK | ||
from km4k2.km4k import start_system | ||
from km4k2.redis_cache_aside_card_verifier import RedisCacheAsideCardVerifier | ||
|
||
|
||
def main(): | ||
isopen = False | ||
okled_pin = 19 | ||
ngled_pin = 26 | ||
# 有効期間1週間 | ||
cache_expires_delta = timedelta(weeks=1) | ||
|
||
# Redisに接続 | ||
conn = redis.StrictRedis( | ||
host=os.environ["REDIS_HOST"], | ||
port=os.environ["REDIS_PORT"], | ||
db=os.environ["REDIS_DB"], | ||
) | ||
api_verifier = CardSDK("https://card.ueckoken.club", os.environ["API_KEY"]) | ||
redis_cached_api_verifier = RedisCacheAsideCardVerifier( | ||
api_verifier, | ||
conn, | ||
cache_expires_delta, | ||
) | ||
|
||
servo.reset() | ||
GPIO.setmode(GPIO.BCM) | ||
GPIO.setup(okled_pin, GPIO.OUT) | ||
GPIO.setup(ngled_pin, GPIO.OUT) | ||
|
||
try: | ||
print("Welcome to Koken Kagi System") | ||
start_system(isopen, okled_pin, ngled_pin, redis_cached_api_verifier) | ||
except Exception as e: # noqa: BLE001 | ||
print("An error has occured!") | ||
print(e) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
File renamed without changes.
12 changes: 6 additions & 6 deletions
12
card_verifier_interface.py → km4k2/card_verifier_interface.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from typing_extensions import Protocol | ||
|
||
|
||
class CardVerifierInterface(Protocol): | ||
def verify(self, idm: str) -> bool: | ||
... | ||
from typing_extensions import Protocol | ||
|
||
|
||
class CardVerifierInterface(Protocol): | ||
def verify(self, idm: str) -> bool: | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from km4k2.rb303 import lock | ||
|
||
if __name__ == "__main__": | ||
lock() |
This file was deleted.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.