We are adding Air Quality Index for US Support. Passing in latitude and longitude you will be able to get accurate AQI Index value. We integrate with AirNow API in the back end.
Start consuming our API here: https://www.mashape.com/fyhao/weather-13
fyhao stuffs
We are adding Air Quality Index for US Support. Passing in latitude and longitude you will be able to get accurate AQI Index value. We integrate with AirNow API in the back end.
Start consuming our API here: https://www.mashape.com/fyhao/weather-13
Just added language detection to Mashape Text Sentiment Analysis API. It will return as part of the result field – lang.
Please test the API here: https://www.mashape.com/fyhao/text-sentiment-analysis-method.
Great Food Tiong Bahru Chicken Rice
Attached Location:
at Eu Tong Sen Street,
See, interesting. A dog teaching a baby how to jump, very cute.
狂妄 vs 自卑。
狂妄可能得到不该属于他的机会。
自卑将永远失去应该属于他的机会。
This saturday night, I would like to take a challenge, to study how Samsung Android IR (Infra Red) Remote control can control my home’s Air Conditional and TV in living room. And when it worked, I would like to integrate it with IVR, meant I can make a call to control my home appliances when I am outside without Internet Access.
The idea is to, have Samsung Android device put on a table pointed to TV, and at the same time make a socket connection to my remote server to receive IR signal command, once get the command just send forward to the TV. And integrate with IVR Freeswitch which provide IVR menu and then send IR signal to the device.
I built a Freeswitch ESL server using Node.JS and have DID linked to Freeswitch. I built a net socket server in the same Node.JS process but listen to different port. Once there is a call reached ESL server, I will trigger a socket event to write special IR command to the connected clients. The connected clients and then forward the IR command to the controlled appliances.
Code snippets of Node.JS ESL Server.
conn.execute('answer');
///http://wiki.freeswitch.org/wiki/Event_List#CHANNEL_APPLICATION
var step1 = function() {
agentutil.prompt(conn, 'Welcome to the Remote Control Service', mainMenu);
}
var mainMenu = function() {
agentutil.prompt(conn, 'To control Air Cond, press 1. To control T V, press 2. Otherwise, press 9.', function() {
agentutil.collectDtmf(conn, function(dtmf) {
if(dtmf == 1) {
control_Aircond();
return true;
}
else if(dtmf == 2) {
control_TV();
}
else if(dtmf == 9) {
bye();
return true;
}
return false;
});
});
};
...........
...........
var control_Aircond = function() {
agentutil.prompt(conn, 'To turn on the Air Con, press 1. To turn off the Dai Kin Air Conditional, press 2. To go back to main menu, press 9.', function() {
agentutil.collectDtmf(conn, function(dtmf) {
if(dtmf == 1) {
irsend('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
..............
..............
var net = require('net');
var sockets = [];
// Start a TCP Server
net.createServer(function (socket) {
.........
.........
}).listen(12345);
........
........
var socket_send = function(data) {
if(sockets.length) {
for(var i in sockets) {
var socket = sockets[i];
if(socket.ended) continue;
socket.write(data);
}
}
}
var irsend = function(data) {
socket_send('irsend:' + data + '\n');
}
I implemented Samsung irDA service on Android. It will register to my Node JS server via TCP socket connection. Once received any IR command, it will just send to the controlled appliances via IR chip.
public void irInit() {
irdaService = this.getSystemService("irda");
Class c = irdaService.getClass();
Class p[] = { String.class };
try {
irWrite = c.getMethod("write_irsend", p);
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
}
public void irSend(String data) {
if (data != null) {
try {
irWrite.invoke(irdaService, data);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
........
........
Socket socket = new Socket(SERVER_IP, SERVER_PORT);
ObjectOutputStream output = new ObjectOutputStream(socket.getOutputStream());
InputStream inputstream = socket.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(inputstream));
String line;
while((line = br.readLine()) != null) {
if(line.startsWith("irsend:")) {
ma.irSend(line.substring("irsend:".length()));
}
}
output.close();
inputstream.close();
socket.close();
Implementing these interface code is easy, the challenge is to find the IR command that match the brand of Air Cond and TV, different manufacturer had different IR code to send, this takes me few hours of digging.
After that, I finally made it. I am very excited and then I quickly demo to my mum and sister. Calling from a mobile, and home telephone, following IVR menu, and then to control the TV in the living room, by power on/off TV and change TV channel, and it just worked!
The limitation is that I had to point the Samsung device either on the TV or Air Cond at one time, after show to my mum and sister they feedback that. The future works maybe using Zigbee? Rasperry PI? Arduino? But will requires TV and Air Cond support the protocol as well, really too far advanced for me.
This saturday morning, I want to take a challenge, to access Freeswitch IVR via DID, as a day past, I just able to access Voxeo IVR via iNUM DID.
I built Kamailio SIP Server and Freeswitch Media server for IVR. By using Freeswitch ESL and Node JS library for ESL, I can code the IVR using Node JS. By using Node JS meant I can leveraging existing Node JS platform to easily glue up various technologies together.
The challenge to getting DID access to Kamailio / Freeswitch SIP Server is the time and money. I had to purchase the DID number, prepare a lot of documents, then forward the calls to SIP address. Had to give up now. But I just realized that I can have a iNUM DID, I am not sure can I get a free iNUM DID myself and do a free SIP call forwarding also. Hopefully, Voxeo IVR (using VXML) is providing free iNUM DID during staging.
In order to achieve the objective to access Freeswitch IVR via DID, I can configure such that an iNUM DID call to Voxeo IVR Server, using VXML to transfer call to a SIP address on Freeswitch IVR.
Realized that I had to make a bridged transfer by setting bridge=”true” for DID access, otherwise, there will be a silent after transfer.
And in order to make a transfer call on Voxeo, I had to open a topic on community support forum, and actually, quite fast, their administrator help me to assign an outbound token privilege for free.
Finally, it worked.
Drone in flight test learns on the fly with special chip