// File: /workspace/github_c_makefile_star2_O0/STMicroelectronics[P]STMems_Android_Sensor_HAL_Input/sensors.cpp
// Function: sensors_poll_context_t::sensors_poll_context_t()
sensors_poll_context_t::sensors_poll_context_t()
{
#if (SENSORS_MAGNETIC_FIELD_ENABLE == 1)
	mSensors[magn] = new MagnSensor();
	mPollFds[magn].fd = mSensors[magn]->getFd();
	mPollFds[magn].events = POLLIN;
	mPollFds[magn].revents = 0;
#endif

#if (SENSORS_GYROSCOPE_ENABLE == 1)
	mSensors[gyro] = new GyroSensor();
	mPollFds[gyro].fd = mSensors[gyro]->getFd();
	mPollFds[gyro].events = POLLIN;
	mPollFds[gyro].revents = 0;
#endif

#if (SENSORS_VIRTUAL_GYROSCOPE_ENABLE == 1)
	mSensors[virtual_gyro] = new VirtualGyroSensor();
	mPollFds[virtual_gyro].fd = mSensors[virtual_gyro]->getFd();
	mPollFds[virtual_gyro].events = POLLIN;
	mPollFds[virtual_gyro].revents = 0;
#endif

#if (SENSORS_ACCELEROMETER_ENABLE == 1)
	mSensors[accel] = new AccelSensor();
	mPollFds[accel].fd = mSensors[accel]->getFd();
	mPollFds[accel].events = POLLIN;
	mPollFds[accel].revents = 0;
#endif

#if (SENSOR_FUSION_ENABLE == 1)
	mSensors[inemo] = new iNemoEngineSensor();
	mPollFds[inemo].fd = mSensors[inemo]->getFd();
	mPollFds[inemo].events = POLLIN;
	mPollFds[inemo].revents = 0;
#endif

#if ((SENSORS_PRESSURE_ENABLE == 1) || (SENSORS_TEMP_PRESS_ENABLE == 1))
	mSensors[press] = new PressSensor();
	mPollFds[press].fd = mSensors[press]->getFd();
	mPollFds[press].events = POLLIN;
	mPollFds[press].revents = 0;
#endif

#if (SENSORS_TEMP_ENABLE == 1)
	mSensors[temperature] = new TempSensor();
	mPollFds[temperature].fd = mSensors[temperature]->getFd();
	mPollFds[temperature].events = POLLIN;
	mPollFds[temperature].revents = 0;
#endif

#if ((SENSORS_TILT_ENABLE == 1) && (ANDROID_VERSION >= ANDROID_L))
	mSensors[tilt] = new TiltSensor();
	mPollFds[tilt].fd = mSensors[tilt]->getFd();
	mPollFds[tilt].events = POLLIN;
	mPollFds[tilt].revents = 0;
#endif

#if (SENSORS_STEP_COUNTER_ENABLE == 1)
	mSensors[step_c] = new StepCounterSensor();
	mPollFds[step_c].fd = mSensors[step_c]->getFd();
	mPollFds[step_c].events = POLLIN;
	mPollFds[step_c].revents = 0;
#endif

#if (SENSORS_STEP_DETECTOR_ENABLE == 1)
	mSensors[step_d] = new StepDetectorSensor();
	mPollFds[step_d].fd = mSensors[step_d]->getFd();
	mPollFds[step_d].events = POLLIN;
	mPollFds[step_d].revents = 0;
#endif

#if (SENSORS_SIGN_MOTION_ENABLE == 1)
	mSensors[sign_m] = new SignMotionSensor();
	mPollFds[sign_m].fd = mSensors[sign_m]->getFd();
	mPollFds[sign_m].events = POLLIN;
	mPollFds[sign_m].revents = 0;
#endif

#if (SENSORS_TAP_ENABLE == 1)
	mSensors[tap] = new TapSensor();
	mPollFds[tap].fd = mSensors[tap]->getFd();
	mPollFds[tap].events = POLLIN;
	mPollFds[tap].revents = 0;
#endif

#if ((SENSORS_HUMIDITY_ENABLE == 1) || (SENSORS_TEMP_RH_ENABLE == 1))
	mSensors[humidity] = new HumiditySensor();
	mPollFds[humidity].fd = mSensors[humidity]->getFd();
	mPollFds[humidity].events = POLLIN;
	mPollFds[humidity].revents = 0;
#endif

#if (ANDROID_VERSION >= ANDROID_JBMR2)
	int FlushFds[2];
	int err = pipe(FlushFds);
	if (err < 0) {
		ALOGE("Failed to create pipe for flush sensor.");
	} else {
		fcntl(FlushFds[0], F_SETFL, O_NONBLOCK);
		fcntl(FlushFds[1], F_SETFL, O_NONBLOCK);
		mWriteFlushPipe = FlushFds[1];
		mPollFds[flushFD].fd = FlushFds[0];
		mPollFds[flushFD].events = POLLIN;
		mPollFds[flushFD].revents = 0;
	}
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x11b0, %edi           # imm = 0x11B0
callq 0x5210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x28(%rbp)
callq 0x5250
jmp 0x601f
movq -0x30(%rbp), %rax
movq -0x28(%rbp), %rcx
movq %rcx, 0x120(%rax)
movq 0x120(%rax), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0xe0(%rax)
movw $0x1, 0xe4(%rax)
movw $0x0, 0xe6(%rax)
movl $0x1570, %edi           # imm = 0x1570
callq 0x5210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x38(%rbp)
callq 0x51c0
jmp 0x6077
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, 0x128(%rax)
movq 0x128(%rax), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0xe8(%rax)
movw $0x1, 0xec(%rax)
movw $0x0, 0xee(%rax)
movl $0x10c8, %edi           # imm = 0x10C8
callq 0x5210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
callq 0x5170
jmp 0x60cf
movq -0x30(%rbp), %rax
movq -0x40(%rbp), %rcx
movq %rcx, 0x130(%rax)
movq 0x130(%rax), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0xf0(%rax)
movw $0x1, 0xf4(%rax)
movw $0x0, 0xf6(%rax)
movl $0x10d0, %edi           # imm = 0x10D0
callq 0x5210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x48(%rbp)
callq 0x5270
jmp 0x6127
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x138(%rax)
movq 0x138(%rax), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0xf8(%rax)
movw $0x1, 0xfc(%rax)
movw $0x0, 0xfe(%rax)
movl $0x10c8, %edi           # imm = 0x10C8
callq 0x5210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x50(%rbp)
callq 0x5030
jmp 0x617f
movq -0x30(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x140(%rax)
movq 0x140(%rax), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x100(%rax)
movw $0x1, 0x104(%rax)
movw $0x0, 0x106(%rax)
movl $0x10c8, %edi           # imm = 0x10C8
callq 0x5210
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x58(%rbp)
callq 0x5240
jmp 0x61d7
movq -0x30(%rbp), %rax
movq -0x58(%rbp), %rcx
movq %rcx, 0x148(%rax)
movq 0x148(%rax), %rdi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x108(%rax)
movw $0x1, 0x10c(%rax)
movw $0x0, 0x10e(%rax)
leaq -0x1c(%rbp), %rdi
callq 0x52c0
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jge 0x62e6
movq 0x7d5a(%rip), %rax      # 0xdf88
movq (%rax), %rdi
leaq 0x41e4(%rip), %rsi      # 0xa41c
leaq 0x4216(%rip), %rdx      # 0xa455
movl $0x403, %ecx            # imm = 0x403
movb $0x0, %al
callq 0x5320
jmp 0x6336
movq -0x28(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x5200
jmp 0x633c
movq -0x38(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x5200
jmp 0x633c
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x5200
jmp 0x633c
movq -0x48(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x5200
jmp 0x633c
movq -0x50(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x5200
jmp 0x633c
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
callq 0x5200
jmp 0x633c
movl -0x1c(%rbp), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
movb $0x0, %al
callq 0x5140
movl -0x18(%rbp), %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
movb $0x0, %al
callq 0x5140
movq -0x30(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, 0x118(%rax)
movl -0x1c(%rbp), %ecx
movl %ecx, 0x110(%rax)
movw $0x1, 0x114(%rax)
movw $0x0, 0x116(%rax)
addq $0x60, %rsp
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0x53d0
nopw %cs:(%rax,%rax)