Open dbraillon opened 7 years ago
First example involving location module: If Loria needs to tell me something, she must find the best way to contact me. At the moment I'm not home, then she should send me a text or push a notification to my phone not speak on my home speaker nor print a console line in my computer screen.
Second example involving layer interaction module: I'm trying to configure Loria, its late and everyone sleeps home. I'm sending text command to Loria's console. Loria must understand the context, I'm typing on console, and she must answer accordingly, on console, not on speaker!
What I meant by layer interaction is something more like a group of context: IFTTT callback, IFTTT action and phone text are usable for the same context, remote text. It's OK if I ask Loria the weather with an IFTTT action and she answer me by a text. But Voice callback which context is home voice should not be used.
A command should have a context, built from a new interface: IContextBuilder When a listener is building a command, it should call all context builder and start building a context. Every time a context builder add a keyword, every context builder is called one more time. It ends when there is no more keyword to add.
Let's say Davy ask's the weather for tomorrow to Loria by voice.
Finally, the command looks like: weather get -date tomorrow -communication voice -for Davy -location Home -coordinates X,Y
The command will be passed to the weather action and will be performed but it's not finished! The weather action will create a callback by guessing which one is more suitable for the context.
For this example, here the relevant context: -communication voice -location home -for Davy
The best callback would be voice callback because it match 2 keywords: voice and home.
The weather will be tell @ home speaker by voice callback.
There is no use to send a callback to voice module connected to home speaker if I'm not there. It's not really effective to answer me on console if I ask what's the weather by voice.
Loria should be able to deliver message context wisely and to a specific person.