<?php

Class Signal extends CI_Model
{

	public $DateTime;
	public $IMEI;
	public $number;
	public $messageType;
	public $lat;
	public $long;
	public $posdatatime;
	public $postype;
	public $status;
	public $interval;
	public $speed;
	public $checksum;


	function __construct()
	{
		$this->load->helper(array('form', 'url'));
		$this->mysql = $this->load->database('mysql',true);
	}


	function send_signals()
	{
		$data['DateTime'] = $this->DateTime;
		$data['IMEI'] = $this->IMEI;
		$data['number'] = $this->number;
		$data['messageType'] = $this->messageType;
		$data['lat'] = $this->lat;
		$data['long'] = $this->long;
		$data['posdatatime'] = $this->posdatatime;
		$data['postype'] = $this->postype;
		$data['status'] = $this->status;
		$data['interval'] = $this->interval;
		$data['speed'] = $this->speed;
		$data['checksum'] = $this->checksum;
		$data['create_date'] = date('Y-m-d H:i:s');

		$this->mysql->insert('location', $data);
	}

	function get_device_type()
	{
		return $this->mysql->select('*')->from('operators')->where([ 'number' => $this->number ])->get()->first_row('array');
	}
}