Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GatewayPLC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fischertechnik examples
Training models
GatewayPLC
Commits
2422e064
Commit
2422e064
authored
1 year ago
by
ft-Demo
Browse files
Options
Downloads
Patches
Plain Diff
commit by robo pro coding
parent
85cbfb4c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/Log.blockly
+0
-3
0 additions, 3 deletions
lib/Log.blockly
lib/Nfc.blockly
+2
-2
2 additions, 2 deletions
lib/Nfc.blockly
lib/Nfc.py
+2
-2
2 additions, 2 deletions
lib/Nfc.py
with
4 additions
and
7 deletions
lib/Log.blockly
+
0
−
3
View file @
2422e064
...
...
@@ -98,7 +98,4 @@
</block>
</statement>
</block>
<block type="controls_if" id="QQ49+[F0OOH7_P8_mE*u" disabled="true" x="535" y="118">
<mutation elseif="0" else="1"/>
</block>
</xml>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/Nfc.blockly
+
2
−
2
View file @
2422e064
...
...
@@ -1736,7 +1736,7 @@
</value>
<next>
<block type="util_python" id="W3l!q=q$W!Cq.FN@%GLU">
<field name="value">target_uid = None&#10;try:&#10; for target in nfc_obj.poll(modulations=((pynfc.nfc.NMT_ISO14443A, pynfc.nfc.NBR_424),), times=0x0
1
, delay=1):&#10; &#10; target_uid = target.uid.decode('utf-8')&#10;&#10; #_print_device_target(target)&#10; &#10; if target_uid != None:&#10; break&#10;except Exception as e:&#10; target_uid = None&#10; logging.warning(e)</field>
<field name="value">target_uid = None&#10;try:&#10; for target in nfc_obj.poll(modulations=((pynfc.nfc.NMT_ISO14443A, pynfc.nfc.NBR_424),), times=0x0
5
, delay=1):&#10; &#10; target_uid = target.uid.decode('utf-8')&#10;&#10; #_print_device_target(target)&#10; &#10; if target_uid != None:&#10; break&#10;except Exception as e:&#10; target_uid = None&#10; logging.warning(e)</field>
<next>
<block type="lists_setIndex" id="BY0Bs+xxi5ov5rbx;Sv.">
<mutation at="true"/>
...
...
@@ -1789,7 +1789,7 @@
<field name="value">logging.log(logging.TRACE0_NFC, '->')</field>
<next>
<block type="util_python" id="ntdme()Ckm)RvcZNhFy=">
<field name="value">global tag&#10;def _internal_func_ntag21x():&#10; global tag&#10; target_uid = None&#10; try:&#10; for target in nfc_obj.poll(modulations=((pynfc.nfc.NMT_ISO14443A, pynfc.nfc.NBR_424),), times=0x0
1
, delay=1):&#10; &#10; target_uid = target.uid.decode('utf-8')&#10; nfc_data[0] = target_uid&#10; _print_device_target(target)&#10;&#10; logging.log(logging.DEBUG_NFC, "freefare_get_tags")&#10; tags = freefare_get_tags(nfc_obj.pdevice)&#10; logging.log(logging.DEBUG_NFC, "tags")&#10;&#10; for tag in tags:&#10; logging.log(logging.DEBUG_NFC, "*")&#10; logging.log(logging.DEBUG_NFC, "tag")&#10; logging.log(logging.DEBUG_NFC, "type(tag)")&#10;&#10; logging.log(logging.DEBUG_NFC, 'freefare_get_tag_type')&#10; r_type = freefare_get_tag_type(tag)&#10; logging.log(logging.DEBUG_NFC, r_type)&#10;&#10; # read only NTAG21x tags&#10; if r_type != 7:&#10; logging.log(logging.DEBUG_NFC, "No NTAG21x tag! ", r_type)&#10; friendly_name = ctypes.string_at(freefare_get_tag_friendly_name(tag))&#10; logging.log(logging.DEBUG_NFC, friendly_name)&#10; break&#10;&#10; logging.log(logging.DEBUG_NFC, 'ntag21x_connect')&#10; r = ntag21x_connect(tag)&#10; logging.log(logging.DEBUG_NFC, r)&#10;&#10; if (r >= 0):&#10; logging.log(logging.DEBUG_NFC, 'ntag21x_get_info')&#10; r = ntag21x_get_info(tag)&#10; logging.log(logging.DEBUG_NFC, r)&#10; if (r >= 0):&#10; logging.log(logging.DEBUG_NFC, 'ntag21x_get_subtype')&#10; r_subtype = ntag21x_get_subtype(tag)&#10; logging.log(logging.DEBUG_NFC, r_subtype)&#10;&#10; if r_subtype != NTAG_213:&#10; logging.log(logging.DEBUG_NFC, "Wrong subtype, NTAG_213 expected, ",r_subtype )&#10; break&#10;&#10; logging.log(logging.DEBUG_NFC, '_inner_func ->')&#10;&#10; r = _inner_func()&#10; logging.log(logging.DEBUG_NFC, r) &#10; logging.log(logging.DEBUG_NFC, '_inner_func <-')&#10; &#10; &#10; logging.log(logging.DEBUG_NFC, 'ntag21x_disconnect')&#10; ntag21x_disconnect(tag)&#10;&#10; #read only first tag in tags:&#10; break&#10;&#10; logging.log(logging.DEBUG_NFC, "freefare_free_tags")&#10; freefare_free_tags(tags)&#10;&#10; if target_uid != None:&#10; break&#10; except Exception as e:&#10; target_uid = None&#10; #ntag21x_disconnect(tag)&#10; #freefare_free_tags(tags)&#10; #print_nfc_data()&#10; #traceback.print_exc(file=sys.stdout)&#10; #logging.warning(e)&#10; logging.log(logging.DEBUG_NFC, e)</field>
<field name="value">global tag&#10;def _internal_func_ntag21x():&#10; global tag&#10; target_uid = None&#10; try:&#10; for target in nfc_obj.poll(modulations=((pynfc.nfc.NMT_ISO14443A, pynfc.nfc.NBR_424),), times=0x0
5
, delay=1):&#10; &#10; target_uid = target.uid.decode('utf-8')&#10; nfc_data[0] = target_uid&#10; _print_device_target(target)&#10;&#10; logging.log(logging.DEBUG_NFC, "freefare_get_tags")&#10; tags = freefare_get_tags(nfc_obj.pdevice)&#10; logging.log(logging.DEBUG_NFC, "tags")&#10;&#10; for tag in tags:&#10; logging.log(logging.DEBUG_NFC, "*")&#10; logging.log(logging.DEBUG_NFC, "tag")&#10; logging.log(logging.DEBUG_NFC, "type(tag)")&#10;&#10; logging.log(logging.DEBUG_NFC, 'freefare_get_tag_type')&#10; r_type = freefare_get_tag_type(tag)&#10; logging.log(logging.DEBUG_NFC, r_type)&#10;&#10; # read only NTAG21x tags&#10; if r_type != 7:&#10; logging.log(logging.DEBUG_NFC, "No NTAG21x tag! ", r_type)&#10; friendly_name = ctypes.string_at(freefare_get_tag_friendly_name(tag))&#10; logging.log(logging.DEBUG_NFC, friendly_name)&#10; break&#10;&#10; logging.log(logging.DEBUG_NFC, 'ntag21x_connect')&#10; r = ntag21x_connect(tag)&#10; logging.log(logging.DEBUG_NFC, r)&#10;&#10; if (r >= 0):&#10; logging.log(logging.DEBUG_NFC, 'ntag21x_get_info')&#10; r = ntag21x_get_info(tag)&#10; logging.log(logging.DEBUG_NFC, r)&#10; if (r >= 0):&#10; logging.log(logging.DEBUG_NFC, 'ntag21x_get_subtype')&#10; r_subtype = ntag21x_get_subtype(tag)&#10; logging.log(logging.DEBUG_NFC, r_subtype)&#10;&#10; if r_subtype != NTAG_213:&#10; logging.log(logging.DEBUG_NFC, "Wrong subtype, NTAG_213 expected, ",r_subtype )&#10; break&#10;&#10; logging.log(logging.DEBUG_NFC, '_inner_func ->')&#10;&#10; r = _inner_func()&#10; logging.log(logging.DEBUG_NFC, r) &#10; logging.log(logging.DEBUG_NFC, '_inner_func <-')&#10; &#10; &#10; logging.log(logging.DEBUG_NFC, 'ntag21x_disconnect')&#10; ntag21x_disconnect(tag)&#10;&#10; #read only first tag in tags:&#10; break&#10;&#10; logging.log(logging.DEBUG_NFC, "freefare_free_tags")&#10; freefare_free_tags(tags)&#10;&#10; if target_uid != None:&#10; break&#10; except Exception as e:&#10; target_uid = None&#10; #ntag21x_disconnect(tag)&#10; #freefare_free_tags(tags)&#10; #print_nfc_data()&#10; #traceback.print_exc(file=sys.stdout)&#10; #logging.warning(e)&#10; logging.log(logging.DEBUG_NFC, e)</field>
<next>
<block type="util_python" id="HcOukw^4VRN/XyT3vsVi" inline="true">
<field name="value">logging.log(logging.TRACE0_NFC, '<-')</field>
...
...
This diff is collapsed.
Click to expand it.
lib/Nfc.py
+
2
−
2
View file @
2422e064
...
...
@@ -50,7 +50,7 @@ def nfc_read_uid():
nfc_data
=
[
None
,
None
,
None
,
None
,
[
None
]
*
8
]
target_uid
=
None
try
:
for
target
in
nfc_obj
.
poll
(
modulations
=
((
pynfc
.
nfc
.
NMT_ISO14443A
,
pynfc
.
nfc
.
NBR_424
),),
times
=
0x0
1
,
delay
=
1
):
for
target
in
nfc_obj
.
poll
(
modulations
=
((
pynfc
.
nfc
.
NMT_ISO14443A
,
pynfc
.
nfc
.
NBR_424
),),
times
=
0x0
5
,
delay
=
1
):
target_uid
=
target
.
uid
.
decode
(
'
utf-8
'
)
...
...
@@ -73,7 +73,7 @@ def _wrapper_ntag21x(_inner_func):
global
tag
target_uid
=
None
try
:
for
target
in
nfc_obj
.
poll
(
modulations
=
((
pynfc
.
nfc
.
NMT_ISO14443A
,
pynfc
.
nfc
.
NBR_424
),),
times
=
0x0
1
,
delay
=
1
):
for
target
in
nfc_obj
.
poll
(
modulations
=
((
pynfc
.
nfc
.
NMT_ISO14443A
,
pynfc
.
nfc
.
NBR_424
),),
times
=
0x0
5
,
delay
=
1
):
target_uid
=
target
.
uid
.
decode
(
'
utf-8
'
)
nfc_data
[
0
]
=
target_uid
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment