<commit_before>var http = require('http'),
    url = require('url'),
    request = require('request'),
    sensor = {'temperature': '',
              'humidity': '',
               'lamp': ''};

// Get all the sensors every 4 seconds
setInterval(function() {
    // Get the Temperature value
    request('http://localhost:8094/cxf/temp/devices/sensor/temperature', function (error, res, body) {
        if (!error && res.statusCode == 200) {
            sensor['temperature'] = body;
            console.log('Temperature Updated');
        }
    });

    // Get the Humidity value
    request('http://localhost:8094/cxf/humidity/devices/sensor/humidity', function (error, res, body) {
        if (!error && res.statusCode == 200) {
            sensor['humidity'] = body;
            console.log('Humidity Updated');
        }
    });
    
    // Get the Lamp status 
    request('http://localhost:8094/cxf/lamp/devices/actuator/lamp', function (error, res, body) {
        if (!error && res.statusCode == 200) {
            sensor['lamp'] = body;
            console.log('Lamp Updated');
        }
    });
}, 4000);

http.createServer(function(req, res) {
    var path = url.parse(req.url).pathname,
        data = '{"Error":true}';
    
    switch(path){
        case '/sensor/temperature':
            data = sensor['temperature'];
            break;
        case '/sensor/humidity':
            data = sensor['humidity'];
            break;
        case '/actuator/lamp':
            data = sensor['lamp'];
            break;
    }

    console.log('Get JSON requisition of length ' + data.length + ' bytes');
    res.writeHead(200, {<commit_msg>Teste de sistema de Callback internos<commit_after>var http = require('http'),
    url = require('url'),
    request = require('request'),
    sensor = {'temperature': '',
              'humidity': '',
               'lamp': ''};

// Get all the sensors every 4 seconds
setInterval(function() {
    // Get the Temperature value
    request('http://localhost:8094/cxf/temp/devices/sensor/temperature', function (error, res, body) {
        if (!error && res.statusCode == 200) {
            sensor['temperature'] = body;
            console.log('Temperature Updated');
        }
        humi();
    });

    // Get the Humidity value
    function humi(){request('http://localhost:8094/cxf/humidity/devices/sensor/humidity', function (error, res, body) {
        if (!error && res.statusCode == 200) {
            sensor['humidity'] = body;
            console.log('Humidity Updated');
        }
        lamp();
    });}
    
    // Get the Lamp status 
    function lamp(){request('http://localhost:8094/cxf/lamp/devices/actuator/lamp', function (error, res, body) {
        if (!error && res.statusCode == 200) {
            sensor['lamp'] = body;
            console.log('Lamp Updated');
        }
    });}
}, 4000);

http.createServer(function(req, res) {
    var path = url.parse(req.url).pathname,
        data = '{"Error":true}';
    
    switch(path){
        case '/sensor/temperature':
            data = sensor['temperature'];
            break;
        case '/sensor/humidity':
            data = sensor['humidity'];
            break;
        case '/actuator/lamp':
            data = sensor['lamp'];
            break;
    }

    console.log('Get JSON requisition of length ' + data.length + ' bytes');
    res.writeHead(200, {
{'fraction_non_alphanumeric': 0.15997638724911453, 'fraction_numerical': 0.017119244391971666, 'mean_word_length': 2.114889705882353, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2527042', 'n_tokens_mistral': 1029, 'n_tokens_neox': 961, 'n_words': 213}