Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
MiczFlor authored Sep 10, 2018
2 parents 0eae2b2 + 684da9e commit 28ebcd3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
13 changes: 5 additions & 8 deletions htdocs/fileUpload.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,14 @@
// if not, see if we have a new folder to create
isset($post['folderNew'])
&& $post['folderNew'] != ""
&& ! file_exists($Audio_Folders_Path.'/'.$post['folderNew'])
&& ! file_exists($Audio_Folders_Path."/".$post['folderNew'])
){
// yes, valid new folder
$messageAction .= "Will create new folder and move files to: '".$post['folderNew']."'";
// create folder
$exec = 'sudo mkdir "'.$Audio_Folders_Path.'/'.$post['folderNew'].'"; sudo chown -R pi:www-data "'.$Audio_Folders_Path."/".$post['folderNew'].'"; sudo chmod 775 "'.$Audio_Folders_Path."/".$post['folderNew'].'"';
print $exec;
//exec($exec);
$moveFolder = $post['folderNew'];
exec($exec);
$moveFolder = $Audio_Folders_Path."/".$post['folderNew'];
} else {
$messageWarning .= "<p>No folder selected nor a valid new folder specified.</p>";
}
Expand All @@ -99,13 +98,11 @@
foreach($uFiles['ufile'] as $key => $values) {
$targetName = $moveFolder.'/'.$values['name'];
$exec = 'sudo mv "'.$values['tmp_name'].'" "'.$targetName.'"; sudo chown -R pi:www-data "'.$targetName.'"; sudo chmod 775 "'.$targetName.'"';
print $exec;
//exec($exec);
//print $exec;
exec($exec);
}
$messageSuccess = "<p>Files were successfully uploaded.</p>";
}


}

/*******************************************
Expand Down
1 change: 0 additions & 1 deletion htdocs/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@

// go through all folders
foreach($audiofolders as $audiofolder) {

// increase ID counter
$idcounter++;

Expand Down
44 changes: 44 additions & 0 deletions scripts/Reader_RDM6300.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
"""
Support for the RDM6300 serial RFID module
1.) Connect the RDM6300 module
------------------------------
Connect the RDM6300 module to the serial GPIO pins 14 and 15.
2.) Enable GPIO serial port
---------------------------
Edit the /boot/config.txt (sudo nano /boot/config.txt) and add the following line:
enable_uart=1
3.) Install dependecies
-----------------------
Be aware not to install the "serial" module, install "pyserial" instead and the RPi.GPIO module:
pip install pyserial RPi.GPIO
4.) Replace the default Reader.py
---------------------------------
Replace the Reader.py file with the Reader_RDM6300.py:
mv Reader.py Reader_default.py; mv Reader_RDM6300.py Reader.py
"""


import RPi.GPIO as GPIO
import serial
import string


class Reader:
def __init__(self):
GPIO.setmode(GPIO.BCM)
self.rfid_serial = serial.Serial('/dev/ttyS0', 9600)

def readCard(self):
while True:
card_id = ''
read_byte = self.rfid_serial.read()
if read_byte == b'\x02':
while read_byte != b'\x03':
read_byte = self.rfid_serial.read()
card_id += read_byte.decode('utf-8')
card_id = ''.join(x for x in card_id if x in string.printable)
return card_id

0 comments on commit 28ebcd3

Please sign in to comment.