This commit is contained in:
Vincent BENOIT
2023-01-03 14:34:24 +01:00
3 changed files with 26 additions and 187 deletions

184
README.md
View File

@@ -1,182 +1,16 @@
# KineIntercom
Programme Python pour l'intercom des Kines
Programme Python central pour l'intercom des Kines
## Commandes AT nécessaires :
![architecture](/assets/images/architecture.png)
#### AT+CGMI Request Manufacturer Identification
```
AT+CGMI
SIMCOM_Ltd
### Dépendances python nécessaires
OK
```
* [RPi.GPIO](https://pypi.org/project/RPi.GPIO/) : Allumer ou éteindre le module GNSS HAT
* [jsonschema](https://pypi.org/project/jsonschema/) : Confirmer la base de données écrite en JSON
* [pyserial](https://pypi.org/project/pyserial/) : Communiquer avec le module GNSS HAT
* [APScheduler](https://pypi.org/project/APScheduler/) : Gerer le programmateur du module GNSS HAT
#### AT+CGMM: AT+CGMM Request Model Identification
```
AT+CGMM
SIMCOM_SIM868
OK
```
#### AT+CGMR: Request TA Revision Identification of Software Release
```
AT+CGMR
Revision:1418B02SIM868M32_BT_EAT
OK
```
#### AT+COPS Operator Selection
+COPS: <mode>[,<format>, <oper>]
OK
<oper> Refer to [27.007]
operator in format as per <format>
<mode>
0. Automatic mode; <oper> field is ignored
1. Manual (<oper> field shall be present, and <AcT>
optionally)
2. manual deregister from network
3. set only <format> (for read Command +COPS?) - not shown in Read Command response
4. Manual/automatic (<oper> field shall be present); if manual selection fails, automatic mode (<mode>=0) is entered
<format>
0. Long format alphanumeric <oper>
1. Short format alphanumeric <oper>
2. Numeric <oper>; GSM Location Area Identification
```
AT+COPS?
+COPS: 0,0,"SFR"
OK
```
#### AT+CSQ Signal Quality Report
+CSQ: <rssi>,<ber>
<rssi>
* 0 -115 dBm or less
* 1 -111 dBm
* 2...30 -110... -54 dBm
* 31 -52 dBm or greater
* 99 not known or not detectable
<ber> (in percent):
* 0...7 As RXQUAL values in the table in GSM 05.08 [20] subclause 7.2.4
* 99 Not known or not detectable
Value RSSI dBm Condition
2 -109 Marginal
3 -107 Marginal
4 -105 Marginal
5 -103 Marginal
6 -101 Marginal
7 -99 Marginal
8 -97 Marginal
9 -95 Marginal
10 -93 OK
11 -91 OK
12 -89 OK
13 -87 OK
14 -85 OK
15 -83 Good
16 -81 Good
17 -79 Good
18 -77 Good
19 -75 Good
20 -73 Excellent
21 -71 Excellent
22 -69 Excellent
23 -67 Excellent
24 -65 Excellent
25 -63 Excellent
26 -61 Excellent
27 -59 Excellent
28 -57 Excellent
29 -55 Excellent
30 -53 Excellent
```
AT+CSQ
+CSQ: 19,0
OK
```
#### AT+CREG Network Registration
+CREG: <n>,<stat>
<n>
* 0 Disable network registration unsolicited result code
* 1 Enable network registration unsolicited result code +CREG: <stat>
* 2 Enable network registration unsolicited result code with location information +CREG: <stat>[,<lac>,<ci>]
<stat>
* 0 Not registered, MT is not currently searching a new operator to register to
* 1 Registered, home network
* 2 Not registered, but MT is currently searching a new operator to register to
* 3 Registration denied
* 4 Unknown
* 5 Registered, roaming
```
AT+CREG?
+CREG: 1,1
OK
```
#### AT+CSMINS SIM Inserted Status Reporting
+CSMINS: <n>,<sim inserted>
<n> A numeric parameter to show an unsolicited event code indicating whether the SIM has been inserted or removed.
* 0 Disable
* 1 Enable
<SIM inserted> A numeric parameter which indicates whether SIMcard has been inserted.
* 0 Not inserted
* 1 Inserted
```
AT+CSMINS?
+CSMINS: 0,1
OK
```
#### AT+CSPN Get Service Provider Name from SIM
+CSPN: <spn>,<display mode>
<spn> String type(string should be included in quotation marks); service provider name on SIM
<display mode>
* 0 Not display PLMN. Already registered on PLMN
* 1 Display PLMN
```
AT+CSPN?
+CSPN: "La Poste Mobile",0
OK
```
#### AT+CGSN Request Product Serial Number Identification (Identical with +GSN)
```
AT+CGSN
864866057705260
OK
```
#### AT+CCALR Call Ready Query
<mode> A numeric parameter which indicates whether the module is ready for phone call.
* 0 Module is not ready for phone call
* 1 Module is ready for phone call
```
AT+CCALR?
+CCALR: 1
OK
```
### Yocto
La recette de ce processus est présent dans le [meta-kineintercom](https://git.nas.benserv.fr/vincent/meta-kineintercom)

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 KiB

View File

@@ -852,18 +852,23 @@ def main():
try:
ser.flushInput() #flush input buffer, discarding all its contents
ser.flushOutput() #flush output buffer, aborting current output
# send AT command to test the connection
ret, _ = send_at_cmd(cmd='AT', timeout=0.5, serObj=ser, logger=logger)
if ret == 2:
logger.error("Erreur d'envoie de la commande AT")
ser.close()
sys.exit(1)
elif ret == 1:
logger.warning("Pas de réponse du module GSM HAT")
GSM_MODULE_STATE = False
else:
logger.info("Module GSM HAT allumé ...")
GSM_MODULE_STATE = True
idx = 0
while idx < 5:
# send AT command to test the connection
ret, _ = send_at_cmd(cmd='AT', timeout=0.5, serObj=ser, logger=logger)
if ret == 2:
logger.error("Erreur d'envoie de la commande AT")
ser.close()
sys.exit(1)
elif ret == 1:
logger.warning("Pas de réponse du module GSM HAT ({}/5)".format(idx + 1))
GSM_MODULE_STATE = False
else:
logger.info("Module GSM HAT allumé ...")
GSM_MODULE_STATE = True
break
idx += 1
time.sleep(1)
except Exception as e:
logger.error("Erreur de com série: {}".format(e))
ser.close()