|
|
|
@ -358,7 +358,7 @@ Java_com_xypower_mpapp_MicroPhotoService_notifyToTakePhoto(
|
|
|
|
|
JNIEnv* env,
|
|
|
|
|
jobject pThis, jlong handler, jint channel, jint preset, jlong scheduleTime, jboolean photoOrVideo) {
|
|
|
|
|
|
|
|
|
|
if (channel < 1 || channel > 0xFF)
|
|
|
|
|
if (channel < 1 || channel > 0x1FF)
|
|
|
|
|
{
|
|
|
|
|
return JNI_FALSE;
|
|
|
|
|
}
|
|
|
|
@ -371,7 +371,16 @@ Java_com_xypower_mpapp_MicroPhotoService_notifyToTakePhoto(
|
|
|
|
|
unsigned char type = photoOrVideo ? 0 : 1;
|
|
|
|
|
// std::thread th(&Runner::RequestCapture, pTerminal, (unsigned int)channel, (unsigned int)preset, type, (unsigned long)scheduleTime, 0, true);
|
|
|
|
|
// th.detach();
|
|
|
|
|
pTerminal->RequestCapture((unsigned int)channel, (unsigned int)preset, type, (unsigned long)scheduleTime, 0, true);
|
|
|
|
|
if (channel < 0x100)
|
|
|
|
|
{
|
|
|
|
|
pTerminal->RequestCapture((uint32_t)channel, (unsigned int)preset, type, (unsigned long)scheduleTime, 0, true);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
uint32_t packetType = channel;
|
|
|
|
|
packetType &= 0xFF;
|
|
|
|
|
pTerminal->RequestSampling(packetType, (unsigned long)scheduleTime, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return JNI_TRUE;
|
|
|
|
|
}
|
|
|
|
@ -612,7 +621,7 @@ Java_com_xypower_mpapp_MicroPhotoService_getPhotoTimeData(
|
|
|
|
|
|
|
|
|
|
unsigned int scheduleTime = 0;
|
|
|
|
|
time_t zeroPointTime = 0;
|
|
|
|
|
std::vector<std::pair<unsigned char, unsigned char> > channelsAndPresets;
|
|
|
|
|
std::vector<std::pair<uint16_t, uint8_t> > channelsAndPresets;
|
|
|
|
|
if (!pTerminal->GetAndRefreshLatestScheduleTime(startTime, zeroPointTime, scheduleTime, channelsAndPresets))
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
@ -631,13 +640,13 @@ Java_com_xypower_mpapp_MicroPhotoService_getPhotoTimeData(
|
|
|
|
|
dataArray.push_back((jlong)channelsAndPresets.size());
|
|
|
|
|
|
|
|
|
|
unsigned long val = 0;
|
|
|
|
|
for (std::vector<std::pair<unsigned char, unsigned char> >::const_iterator it = channelsAndPresets.cbegin(); it != channelsAndPresets.cend(); ++it)
|
|
|
|
|
for (std::vector<std::pair<uint16_t, uint8_t> >::const_iterator it = channelsAndPresets.cbegin(); it != channelsAndPresets.cend(); ++it)
|
|
|
|
|
{
|
|
|
|
|
val = (unsigned long)scheduleTime << 24;
|
|
|
|
|
val = (unsigned long)scheduleTime << 28;
|
|
|
|
|
// channel
|
|
|
|
|
val |= ((unsigned long)(it->first)) << 16;
|
|
|
|
|
val |= ((unsigned long)(it->first)) << 12;
|
|
|
|
|
// preset
|
|
|
|
|
val |= ((unsigned long)(it->second)) << 8;
|
|
|
|
|
val |= ((unsigned long)(it->second)) << 4;
|
|
|
|
|
|
|
|
|
|
dataArray.push_back((jlong)val);
|
|
|
|
|
}
|
|
|
|
@ -735,75 +744,6 @@ Java_com_xypower_mpapp_MicroPhotoService_recoganizePicture(
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
extern "C" JNIEXPORT jlongArray JNICALL
|
|
|
|
|
Java_com_xypower_mpapp_MicroPhotoService_getNextScheduleItem(
|
|
|
|
|
JNIEnv* env,
|
|
|
|
|
jobject pThis, jlong handler) {
|
|
|
|
|
|
|
|
|
|
CTerminal* pTerminal = reinterpret_cast<CTerminal *>(handler);
|
|
|
|
|
if (pTerminal == NULL)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
map<unsigned char, vector<unsigned int>> photoTime;
|
|
|
|
|
if (!pTerminal->GetPhotoTime(photoTime) || photoTime.empty())
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t numberOfData = photoTime.size() * photoTime.begin()->second.size();
|
|
|
|
|
if (numberOfData == 0)
|
|
|
|
|
{
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
vector<jlong> dataArray;
|
|
|
|
|
dataArray.reserve(numberOfData);
|
|
|
|
|
|
|
|
|
|
unsigned long val = 0;
|
|
|
|
|
jint channel = 0;
|
|
|
|
|
for (map<unsigned char, vector<unsigned int>>::const_iterator it = photoTime.cbegin(); it != photoTime.cend(); ++it)
|
|
|
|
|
{
|
|
|
|
|
if (it->second.empty())
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
channel = (jint)((unsigned short)it->first);
|
|
|
|
|
// dataArray.push_back(channel);
|
|
|
|
|
|
|
|
|
|
// val = (jint)it->second.size();
|
|
|
|
|
// dataArray.push_back(val);
|
|
|
|
|
for (vector<unsigned int>::const_iterator it2 = it->second.cbegin(); it2 != it->second.cend(); ++it2)
|
|
|
|
|
{
|
|
|
|
|
// time
|
|
|
|
|
val = ((unsigned long)((*it2) & 0xFFFFFF00)) << 24;
|
|
|
|
|
// channel
|
|
|
|
|
val |= ((unsigned long)channel) << 16;
|
|
|
|
|
// preset
|
|
|
|
|
val |= ((unsigned long)((*it2) & 0xFF)) << 8;
|
|
|
|
|
|
|
|
|
|
dataArray.push_back((jlong)val);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::sort(dataArray.begin(), dataArray.end());
|
|
|
|
|
|
|
|
|
|
jlongArray data = env->NewLongArray(dataArray.size());
|
|
|
|
|
if (data == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
env->SetLongArrayRegion(data, 0, dataArray.size(), &dataArray[0]);
|
|
|
|
|
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT void JNICALL
|
|
|
|
|
Java_com_xypower_mpapp_MicroPhotoService_captureFinished(
|
|
|
|
|
JNIEnv* env,
|
|
|
|
|