Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
domotikad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
domotika
domotikad
Commits
205e858a
Commit
205e858a
authored
Oct 13, 2014
by
nextime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix chrome voice recognition
parent
91985a0e
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
303 additions
and
45 deletions
+303
-45
domotika.js
Web/htdocs/gui/js/domotika.js
+20
-14
speech.js
Web/htdocs/gui/js/speech.js
+278
-30
combined.min.js
Web/resources/gui/js/combined.min.js
+1
-1
words.py
domotika/voiceui/filters/words.py
+4
-0
No files found.
Web/htdocs/gui/js/domotika.js
View file @
205e858a
...
...
@@ -217,6 +217,16 @@
$
.
post
(
"/rest/v1.2/actions/speech_text/json"
,
spobj
.
serialize
(),
speechResult
);
}
function
setSpeechText
(
terms
)
{
// XXX Sistema sta cosa!
console
.
debug
(
"SpeechRecognized: "
+
terms
);
$
(
"#speech [name=text]"
).
val
(
terms
);
$
(
"#speechsm [name=text]"
).
val
(
terms
);
sendSpeech
(
$
(
"#speech"
));
}
// Test SpeechAPI
var
speechStartWord
=
'*terms'
;
if
((
speechEnabled
==
'touch'
&&
document
.
createElement
(
'input'
).
webkitSpeech
==
undefined
)
||
speechEnabled
==
'continuous'
)
...
...
@@ -226,6 +236,7 @@
if
(
window
.
annyang
)
{
$
(
"#speechbutton"
).
show
();
// it isn't chrome with webkit-speech attribute, but it support WEB Speech API
annyang
.
setCatchAll
(
setSpeechText
);
}
else
{
...
...
@@ -234,38 +245,33 @@
}
}
else
{
$
(
"#speechbutton"
).
hide
();
speechStartWord
=
'ok domotica *terms'
;
if
(
window
.
annyang
)
annyang
.
addCommands
({
'ok domotica *terms'
:
setSpeechText
});
}
}
else
{
speechEnabled
=
'touch-chrome'
;
}
function
setSpeechText
(
terms
)
{
// XXX Sistema sta cosa!
$
(
"#speech [name=text]"
).
val
(
terms
);
$
(
"#speechsm [name=text]"
).
val
(
terms
);
console
.
debug
(
"SpeechRecognized: "
+
terms
)
sendSpeech
(
$
(
"#speech"
));
}
var
commands
=
{
speechStartWord
:
setSpeechText
'hello domotica'
:
function
(){
console
.
debug
(
'hello domotika!'
);}
};
if
(
speechEnabled
==
'touch'
||
speechEnabled
==
'continuous'
)
{
try
{
annyang
.
init
(
commands
);
annyang
.
addCommands
(
commands
);
}
catch
(
err
)
{
annyang
=
null
;
}
if
(
annyang
)
{
annyang
.
setLanguage
(
'<?=$_DOMOTIKA['
speechlang
']?>'
);
if
(
speechEnabled
==
'continuous'
)
annyang
.
start
();
annyang
.
start
(
{
autoRestart
:
true
}
);
else
if
(
speechEnabled
==
'touch'
)
annyang
.
setContinuous
(
false
);
//annyang.setContinuous(false);
$
(
"#speechbutton"
).
click
(
function
()
{
annyang
.
start
({
autoRestart
:
false
});
});
}
else
{
$
(
"#speechbutton"
).
hide
();
speechEnabled
=
'no'
;
...
...
Web/htdocs/gui/js/speech.js
View file @
205e858a
This diff is collapsed.
Click to expand it.
Web/resources/gui/js/combined.min.js
View file @
205e858a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
domotika/voiceui/filters/words.py
View file @
205e858a
...
...
@@ -32,9 +32,11 @@ IT_ACTIONS={
"giu"
:
c
.
IKAP_ACT_DOWN
,
"apri"
:
c
.
IKAP_ACT_OPEN
,
"aprire"
:
c
.
IKAP_ACT_OPEN
,
"apre"
:
c
.
IKAP_ACT_OPEN
,
"aprimi"
:
c
.
IKAP_ACT_OPEN
,
"chiudi"
:
c
.
IKAP_ACT_CLOSE
,
"chiudere"
:
c
.
IKAP_ACT_CLOSE
,
"chiude"
:
c
.
IKAP_ACT_CLOSE
,
"chiudimi"
:
c
.
IKAP_ACT_CLOSE
,
"alza"
:
c
.
IKAP_ACT_UP
,
"alzare"
:
c
.
IKAP_ACT_UP
,
...
...
@@ -43,9 +45,11 @@ IT_ACTIONS={
"abbassare"
:
c
.
IKAP_ACT_DOWN
,
"abbassami"
:
c
.
IKAP_ACT_DOWN
,
"accendi"
:
c
.
IKAP_ACT_ON
,
"accende"
:
c
.
IKAP_ACT_ON
,
"accendere"
:
c
.
IKAP_ACT_ON
,
"spegni"
:
c
.
IKAP_ACT_OFF
,
"spegnere"
:
c
.
IKAP_ACT_OFF
,
"spegne"
:
c
.
IKAP_ACT_OFF
,
"accendimi"
:
c
.
IKAP_ACT_ON
,
"spegnimi"
:
c
.
IKAP_ACT_OFF
,
"off"
:
c
.
IKAP_ACT_OFF
,
...
...
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