added sending message feature for android
This commit is contained in:
parent
af9afcb365
commit
c86ab075b7
|
@ -78,7 +78,7 @@ void getnumthreads()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
DWORD_PTR dwProcessAffinity, dwSystemAffinity;
|
DWORD_PTR dwProcessAffinity, dwSystemAffinity;
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
// cpu_set_t dwProcessAffinity;
|
cpu_set_t dwProcessAffinity;
|
||||||
#elif __OpenBSD__
|
#elif __OpenBSD__
|
||||||
int mib[2], core_count = 0;
|
int mib[2], core_count = 0;
|
||||||
int dwProcessAffinity = 0;
|
int dwProcessAffinity = 0;
|
||||||
|
@ -87,13 +87,13 @@ void getnumthreads()
|
||||||
int dwProcessAffinity = 0;
|
int dwProcessAffinity = 0;
|
||||||
int32_t core_count = 0;
|
int32_t core_count = 0;
|
||||||
#endif
|
#endif
|
||||||
// size_t len = sizeof(dwProcessAffinity);
|
size_t len = sizeof(dwProcessAffinity);
|
||||||
// if (numthreads > 0)
|
if (numthreads > 0)
|
||||||
// return;
|
return;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity);
|
GetProcessAffinityMask(GetCurrentProcess(), &dwProcessAffinity, &dwSystemAffinity);
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
// sched_getaffinity(0, len, &dwProcessAffinity);
|
sched_getaffinity(0, len, &dwProcessAffinity);
|
||||||
#elif __OpenBSD__
|
#elif __OpenBSD__
|
||||||
len2 = sizeof(core_count);
|
len2 = sizeof(core_count);
|
||||||
mib[0] = CTL_HW;
|
mib[0] = CTL_HW;
|
||||||
|
@ -106,22 +106,22 @@ void getnumthreads()
|
||||||
else if (sysctlbyname("hw.ncpu", &core_count, &len, 0, 0) == 0)
|
else if (sysctlbyname("hw.ncpu", &core_count, &len, 0, 0) == 0)
|
||||||
numthreads = core_count;
|
numthreads = core_count;
|
||||||
#endif
|
#endif
|
||||||
// for (unsigned int i = 0; i < len * 8; i++)
|
for (unsigned int i = 0; i < len * 8; i++)
|
||||||
// #if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// #if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// if (dwProcessAffinity & (1i64 << i))
|
if (dwProcessAffinity & (1i64 << i))
|
||||||
// #else // CYGWIN/MINGW
|
#else // CYGWIN/MINGW
|
||||||
// if (dwProcessAffinity & (1ULL << i))
|
if (dwProcessAffinity & (1ULL << i))
|
||||||
// #endif
|
#endif
|
||||||
// #elif defined __linux__
|
#elif defined __linux__
|
||||||
// if (CPU_ISSET(i, &dwProcessAffinity))
|
if (CPU_ISSET(i, &dwProcessAffinity))
|
||||||
// #else
|
#else
|
||||||
// if (dwProcessAffinity & (1 << i))
|
if (dwProcessAffinity & (1 << i))
|
||||||
// #endif
|
#endif
|
||||||
// numthreads++;
|
numthreads++;
|
||||||
// if (numthreads == 0) // something failed
|
if (numthreads == 0) // something failed
|
||||||
// numthreads = 1;
|
numthreads = 1;
|
||||||
// printf("Number of threads: %i\n", (int)numthreads);
|
printf("Number of threads: %i\n", (int)numthreads);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, unsigned long long target)
|
extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, unsigned long long target)
|
||||||
|
@ -146,7 +146,7 @@ extern "C" EXPORT unsigned long long BitmessagePOW(unsigned char * starthash, un
|
||||||
# else
|
# else
|
||||||
pthread_create(&threads[i], NULL, threadfunc, (void*)&threaddata[i]);
|
pthread_create(&threads[i], NULL, threadfunc, (void*)&threaddata[i]);
|
||||||
# ifdef __linux__
|
# ifdef __linux__
|
||||||
pthread_setschedparam(threads[i], 0, &schparam);
|
pthread_setschedparam(threads[i], SCHED_IDLE, &schparam);
|
||||||
# else
|
# else
|
||||||
pthread_setschedparam(threads[i], SCHED_RR, &schparam);
|
pthread_setschedparam(threads[i], SCHED_RR, &schparam);
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -45,7 +45,8 @@ requirements =
|
||||||
kivymd,
|
kivymd,
|
||||||
kivy-garden,
|
kivy-garden,
|
||||||
qrcode,
|
qrcode,
|
||||||
Pillow
|
Pillow,
|
||||||
|
msgpack
|
||||||
|
|
||||||
# (str) Custom source folders for requirements
|
# (str) Custom source folders for requirements
|
||||||
# Sets custom source for any requirements with recipes
|
# Sets custom source for any requirements with recipes
|
||||||
|
|
|
@ -1213,6 +1213,7 @@ class singleWorker(StoppableThread):
|
||||||
powStartTime = time.time()
|
powStartTime = time.time()
|
||||||
initialHash = hashlib.sha512(encryptedPayload).digest()
|
initialHash = hashlib.sha512(encryptedPayload).digest()
|
||||||
trialValue, nonce = proofofwork.run(target, initialHash)
|
trialValue, nonce = proofofwork.run(target, initialHash)
|
||||||
|
print("nonce calculated value#############################", nonce)
|
||||||
logger.info(
|
logger.info(
|
||||||
'(For msg message) Found proof of work %s Nonce: %s',
|
'(For msg message) Found proof of work %s Nonce: %s',
|
||||||
trialValue, nonce
|
trialValue, nonce
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
from os import path, listdir
|
from os import path, listdir
|
||||||
from string import lower
|
from string import lower
|
||||||
|
try:
|
||||||
|
from kivy.utils import platform
|
||||||
|
except:
|
||||||
|
platform = ''
|
||||||
from debug import logger
|
from debug import logger
|
||||||
import messagetypes
|
import messagetypes
|
||||||
import paths
|
import paths
|
||||||
|
@ -32,7 +35,7 @@ def constructObject(data):
|
||||||
else:
|
else:
|
||||||
return returnObj
|
return returnObj
|
||||||
|
|
||||||
if paths.frozen is not None:
|
if paths.frozen is not None or platform == "android":
|
||||||
import messagetypes.message
|
import messagetypes.message
|
||||||
import messagetypes.vote
|
import messagetypes.vote
|
||||||
else:
|
else:
|
||||||
|
|
14
src/tr.py
14
src/tr.py
|
@ -13,24 +13,20 @@ class translateClass:
|
||||||
else:
|
else:
|
||||||
return self.text
|
return self.text
|
||||||
|
|
||||||
# def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
|
||||||
# return translateText(context, text, n)
|
|
||||||
|
|
||||||
def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
||||||
return text
|
return translateText(context, text, n)
|
||||||
|
|
||||||
|
# def _translate(context, text, disambiguation = None, encoding = None, n = None):
|
||||||
|
# return translateClass(context, text.replace('%','',1))
|
||||||
|
|
||||||
def translateText(context, text, n = None):
|
def translateText(context, text, n = None):
|
||||||
try:
|
try:
|
||||||
enableGUI = state.enableGUI
|
enableGUI = state.enableGUI
|
||||||
except AttributeError: # inside the plugin
|
except AttributeError: # inside the plugin
|
||||||
enableGUI = True
|
enableGUI = True
|
||||||
if enableGUI:
|
if not state.kivy and enableGUI:
|
||||||
try:
|
try:
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
except Exception as err:
|
|
||||||
try:
|
|
||||||
if state.kivy:
|
|
||||||
pass
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'
|
print 'PyBitmessage requires PyQt unless you want to run it as a daemon and interact with it using the API. You can download PyQt from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\'. If you want to run in daemon mode, see https://bitmessage.org/wiki/Daemon'
|
||||||
print 'Error message:', err
|
print 'Error message:', err
|
||||||
|
|
Reference in New Issue
Block a user