mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 23:06:05 +00:00
fhem.pl: add createUniqueId for betateilchen (Forum #31932)
git-svn-id: https://svn.fhem.de/fhem/trunk@7537 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
0c4bae9ff5
commit
ded6eaf871
16
fhem/fhem.pl
16
fhem/fhem.pl
@ -100,6 +100,7 @@ sub computeClientArray($$);
|
|||||||
sub concatc($$$);
|
sub concatc($$$);
|
||||||
sub configDBUsed();
|
sub configDBUsed();
|
||||||
sub createNtfyHash();
|
sub createNtfyHash();
|
||||||
|
sub createUniqueId();
|
||||||
sub devspec2array($);
|
sub devspec2array($);
|
||||||
sub doGlobalDef($);
|
sub doGlobalDef($);
|
||||||
sub escapeLogLine($);
|
sub escapeLogLine($);
|
||||||
@ -111,6 +112,7 @@ sub fhemTzOffset($);
|
|||||||
sub getAllAttr($);
|
sub getAllAttr($);
|
||||||
sub getAllGets($);
|
sub getAllGets($);
|
||||||
sub getAllSets($);
|
sub getAllSets($);
|
||||||
|
sub getUniqueId();
|
||||||
sub latin1ToUtf8($);
|
sub latin1ToUtf8($);
|
||||||
sub myrename($$);
|
sub myrename($$);
|
||||||
sub notifyRegexpChanged($$);
|
sub notifyRegexpChanged($$);
|
||||||
@ -4009,12 +4011,22 @@ getUniqueId()
|
|||||||
{
|
{
|
||||||
my ($err, $uniqueID) = getKeyValue("uniqueID");
|
my ($err, $uniqueID) = getKeyValue("uniqueID");
|
||||||
return $uniqueID if(defined($uniqueID));
|
return $uniqueID if(defined($uniqueID));
|
||||||
srand(time);
|
my ($uniqueID) = createUniqueId();
|
||||||
$uniqueID = join "",map { unpack "H*", chr(rand(256)) } 1..16;
|
|
||||||
setKeyValue("uniqueID", $uniqueID);
|
setKeyValue("uniqueID", $uniqueID);
|
||||||
return $uniqueID;
|
return $uniqueID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $srandUsed;
|
||||||
|
sub
|
||||||
|
createUniqueId()
|
||||||
|
{
|
||||||
|
my $uniqueID;
|
||||||
|
srand(time) if(!$srandUsed);
|
||||||
|
$srandUsed = 1;
|
||||||
|
$uniqueID = join "",map { unpack "H*", chr(rand(256)) } 1..16;
|
||||||
|
return $uniqueID;
|
||||||
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
getKeyValue($)
|
getKeyValue($)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user