Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alex037yang
OpenXG-RAN
Commits
ca38ed3b
Commit
ca38ed3b
authored
Apr 28, 2021
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update of the AT-based module control for automation
parent
1998d6ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
8 deletions
+23
-8
ci-scripts/ci_ctl_qtel.py
ci-scripts/ci_ctl_qtel.py
+23
-8
No files found.
ci-scripts/ci_ctl_qtel.py
View file @
ca38ed3b
...
...
@@ -24,6 +24,9 @@
#
#---------------------------------------------------------------------
#usage example:
#sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 wup
#sudo python3 ci_ctl_qtel.py /dev/ttyUSB2 detach
import
sys
...
...
@@ -44,28 +47,40 @@ class qtel_ctl:
self
.
__send_command
(
ser
,
"AT+CFUN={}
\r
"
.
format
(
state
))
def
__send_command
(
self
,
ser
,
com
):
if
ser
.
inWaiting
()
>
0
:
ser
.
flushInput
()
ser
.
write
(
com
.
encode
())
time
.
sleep
(
0.1
)
ret
=
[]
while
ser
.
inWaiting
()
>
0
:
print
(
"waiting"
)
msg
=
ser
.
readline
()
msg
=
msg
.
decode
(
"utf-8"
)
msg
=
msg
.
replace
(
"
\r
"
,
""
)
msg
=
msg
.
replace
(
"
\n
"
,
""
)
print
(
msg
)
if
msg
!=
""
:
ret
.
append
(
msg
)
else
:
print
(
"msg empty"
)
return
ret
#--------------
#public methods
#--------------
def
wup
(
self
):
#sending AT+CFUN=0, then AT+CFUN=1
self
.
__set_modem_state
(
self
.
modem
,
0
)
self
.
__set_modem_state
(
self
.
modem
,
'0'
)
time
.
sleep
(
3
)
self
.
__set_modem_state
(
self
.
modem
,
1
)
self
.
__set_modem_state
(
self
.
modem
,
'1'
)
def
detach
(
self
):
#sending AT+CFUN=0
self
.
__set_modem_state
(
self
.
modem
,
0
)
self
.
__set_modem_state
(
self
.
modem
,
'0'
)
if
__name__
==
"__main__"
:
#argv[1] : usb port
#argv[2] : qtel command (see function pointers dict "wup", "detach" etc ...)
#argv[1] : usb port
#argv[2] : qtel command (see function pointers dict "wup", "detach" etc ...)
command
=
sys
.
argv
[
2
]
Module
=
qtel_ctl
(
sys
.
argv
[
1
])
#calling the function to be applied
#calling the function to be applied
Module
.
cmd_dict
[
command
]()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment