<commit_before>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ociweb.grove;

import com.ociweb.gl.api.StartupListener;
import com.ociweb.iot.grove.six_axis_accelerometer.*;
import com.ociweb.iot.maker.FogCommandChannel;
import com.ociweb.iot.maker.FogRuntime;

/**
 *
 * @author huydo
 */
public class AccelBehavior implements AccelValsListener,StartupListener,MagValsListener { 
    private final FogCommandChannel ch;
    
    private final SixAxisAccelerometer_Transducer accSensor;
    
    AccelBehavior(FogRuntime runtime){
        this.ch = runtime.newCommandChannel();     
        accSensor = new SixAxisAccelerometer_Transducer(ch,this);
    }
   
    @Override
    public void startup() {
        accSensor.setAccelScale(6);
        accSensor.setMagScale(8);
    }

    @Override
    public void accelerationValues(int x, int y, int z) {
        System.out.println("x: "+x);
        System.out.println("y: "+y);
        System.out.println("z: "+z);
    }

    @Override
    public void magneticValues(int x, int y, int z) {
        double heading = 180*Math.atan2(y, x)/3.14;
        heading = (heading<0)?(heading+360):heading;
        System.out.println("heading: "+heading);
    }
    
}<commit_msg>api change<commit_after>/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ociweb.grove;

import com.ociweb.gl.api.StartupListener;
import com.ociweb.iot.grove.six_axis_accelerometer.*;
import com.ociweb.iot.maker.FogCommandChannel;
import com.ociweb.iot.maker.FogRuntime;

/**
 *
 * @author huydo
 */
public class AccelBehavior implements AccelValsListener, StartupListener, MagValsListener {
    private final FogCommandChannel ch;
    
    private final SixAxisAccelerometer_Transducer accSensor;
    
    AccelBehavior(FogRuntime runtime){
        this.ch = runtime.newCommandChannel();     
        accSensor = new SixAxisAccelerometer_Transducer(ch);
        accSensor.registerListeners(this, this);
    }
   
    @Override
    public void startup() {
        accSensor.setAccelScale(6);
        accSensor.setMagScale(8);
    }

    @Override
    public void accelerationValues(int x, int y, int z) {
        System.out.println("accel x: " + x + " y: " + y + " z: "+ z);
    }

    @Override
    public void magneticValues(int x, int y, int z) {
        double heading = 180.0 * Math.atan2(y, x) / Math.PI;
        heading = (heading<0)?(heading+360):heading;
        System.out.println("heading: " + heading);
    }
}
{'fraction_non_alphanumeric': 0.10972477064220183, 'fraction_numerical': 0.008807339449541285, 'mean_word_length': 3.193846153846154, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5013293', 'n_tokens_mistral': 862, 'n_tokens_neox': 846, 'n_words': 202}