repo_name
stringlengths 4
116
| path
stringlengths 4
379
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
---|---|---|---|---|
kyriakosbrastianos/friendica-deb | mod/item.php | 27473 | <?php
/**
*
* This is the POST destination for most all locally posted
* text stuff. This function handles status, wall-to-wall status,
* local comments, and remote coments - that are posted on this site
* (as opposed to being delivered in a feed).
* Also processed here are posts and comments coming through the
* statusnet/twitter API.
* All of these become an "item" which is our basic unit of
* information.
* Posts that originate externally or do not fall into the above
* posting categories go through item_store() instead of this function.
*
*/
require_once('include/crypto.php');
require_once('include/enotify.php');
function item_post(&$a) {
if((! local_user()) && (! remote_user()))
return;
require_once('include/security.php');
$uid = local_user();
if(x($_POST,'dropitems')) {
require_once('include/items.php');
$arr_drop = explode(',',$_POST['dropitems']);
drop_items($arr_drop);
$json = array('success' => 1);
echo json_encode($json);
killme();
}
call_hooks('post_local_start', $_POST);
logger('postvars' . print_r($_POST,true));
$api_source = ((x($_POST,'api_source') && $_POST['api_source']) ? true : false);
$return_path = ((x($_POST,'return')) ? $_POST['return'] : '');
/**
* Is this a reply to something?
*/
$parent = ((x($_POST,'parent')) ? intval($_POST['parent']) : 0);
$parent_uri = ((x($_POST,'parent_uri')) ? trim($_POST['parent_uri']) : '');
$parent_item = null;
$parent_contact = null;
$thr_parent = '';
$parid = 0;
$r = false;
$preview = ((x($_POST,'preview')) ? intval($_POST['preview']) : 0);
if($parent || $parent_uri) {
if(! x($_POST,'type'))
$_POST['type'] = 'net-comment';
if($parent) {
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
intval($parent)
);
}
elseif($parent_uri && local_user()) {
// This is coming from an API source, and we are logged in
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent_uri),
intval(local_user())
);
}
// if this isn't the real parent of the conversation, find it
if($r !== false && count($r)) {
$parid = $r[0]['parent'];
if($r[0]['id'] != $r[0]['parent']) {
$r = q("SELECT * FROM `item` WHERE `id` = `parent` AND `parent` = %d LIMIT 1",
intval($parid)
);
}
}
if(($r === false) || (! count($r))) {
notice( t('Unable to locate original post.') . EOL);
if(x($_POST,'return'))
goaway($a->get_baseurl() . "/" . $return_path );
killme();
}
$parent_item = $r[0];
$parent = $r[0]['id'];
// multi-level threading - preserve the info but re-parent to our single level threading
if(($parid) && ($parid != $parent))
$thr_parent = $parent_uri;
if($parent_item['contact-id'] && $uid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($parent_item['contact-id']),
intval($uid)
);
if(count($r))
$parent_contact = $r[0];
}
}
if($parent) logger('mod_post: parent=' . $parent);
$profile_uid = ((x($_POST,'profile_uid')) ? intval($_POST['profile_uid']) : 0);
$post_id = ((x($_POST['post_id'])) ? intval($_POST['post_id']) : 0);
$app = ((x($_POST['source'])) ? strip_tags($_POST['source']) : '');
if(! can_write_wall($a,$profile_uid)) {
notice( t('Permission denied.') . EOL) ;
if(x($_POST,'return'))
goaway($a->get_baseurl() . "/" . $return_path );
killme();
}
// is this an edited post?
$orig_post = null;
if($post_id) {
$i = q("SELECT * FROM `item` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid),
intval($post_id)
);
if(! count($i))
killme();
$orig_post = $i[0];
}
$user = null;
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($profile_uid)
);
if(count($r))
$user = $r[0];
if($orig_post) {
$str_group_allow = $orig_post['allow_gid'];
$str_contact_allow = $orig_post['allow_cid'];
$str_group_deny = $orig_post['deny_gid'];
$str_contact_deny = $orig_post['deny_cid'];
$title = $orig_post['title'];
$location = $orig_post['location'];
$coord = $orig_post['coord'];
$verb = $orig_post['verb'];
$emailcc = $orig_post['emailcc'];
$app = $orig_post['app'];
$body = escape_tags(trim($_POST['body']));
$private = $orig_post['private'];
$pubmail_enable = $orig_post['pubmail'];
}
else {
$str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']);
$str_contact_deny = perms2str($_POST['contact_deny']);
$title = notags(trim($_POST['title']));
$location = notags(trim($_POST['location']));
$coord = notags(trim($_POST['coord']));
$verb = notags(trim($_POST['verb']));
$emailcc = notags(trim($_POST['emailcc']));
$body = escape_tags(trim($_POST['body']));
$private = ((strlen($str_group_allow) || strlen($str_contact_allow) || strlen($str_group_deny) || strlen($str_contact_deny)) ? 1 : 0);
if(($parent_item) &&
(($parent_item['private'])
|| strlen($parent_item['allow_cid'])
|| strlen($parent_item['allow_gid'])
|| strlen($parent_item['deny_cid'])
|| strlen($parent_item['deny_gid'])
)) {
$private = 1;
}
$pubmail_enable = ((x($_POST,'pubmail_enable') && intval($_POST['pubmail_enable']) && (! $private)) ? 1 : 0);
// if using the API, we won't see pubmail_enable - figure out if it should be set
if($api_source && $profile_uid && $profile_uid == local_user() && (! $private)) {
$mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
if(! $mail_disabled) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1",
intval(local_user())
);
if(count($r) && intval($r[0]['pubmail']))
$pubmail_enabled = true;
}
}
if(! strlen($body)) {
if($preview)
killme();
info( t('Empty post discarded.') . EOL );
if(x($_POST,'return'))
goaway($a->get_baseurl() . "/" . $return_path );
killme();
}
}
if(($api_source)
&& (! array_key_exists('allow_cid',$_REQUEST))
&& (! array_key_exists('allow_gid',$_REQUEST))
&& (! array_key_exists('deny_cid',$_REQUEST))
&& (! array_key_exists('deny_gid',$_REQUEST))) {
$str_group_allow = $user['allow_gid'];
$str_contact_allow = $user['allow_cid'];
$str_group_deny = $user['deny_gid'];
$str_contact_deny = $user['deny_cid'];
}
// get contact info for poster
$author = null;
$self = false;
if(($_SESSION['uid']) && ($_SESSION['uid'] == $profile_uid)) {
$self = true;
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($_SESSION['uid'])
);
}
else {
if((x($_SESSION,'visitor_id')) && (intval($_SESSION['visitor_id']))) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
intval($_SESSION['visitor_id'])
);
}
}
if(count($r)) {
$author = $r[0];
$contact_id = $author['id'];
}
// get contact info for owner
if($profile_uid == $_SESSION['uid']) {
$contact_record = $author;
}
else {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($profile_uid)
);
if(count($r))
$contact_record = $r[0];
}
$post_type = notags(trim($_POST['type']));
if($post_type === 'net-comment') {
if($parent_item !== null) {
if($parent_item['wall'] == 1)
$post_type = 'wall-comment';
else
$post_type = 'remote-comment';
}
}
/**
*
* When a photo was uploaded into the message using the (profile wall) ajax
* uploader, The permissions are initially set to disallow anybody but the
* owner from seeing it. This is because the permissions may not yet have been
* set for the post. If it's private, the photo permissions should be set
* appropriately. But we didn't know the final permissions on the post until
* now. So now we'll look for links of uploaded messages that are in the
* post and set them to the same permissions as the post itself.
*
*/
$match = null;
if((! $preview) && preg_match_all("/\[img\](.*?)\[\/img\]/",$body,$match)) {
$images = $match[1];
if(count($images)) {
foreach($images as $image) {
if(! stristr($image,$a->get_baseurl() . '/photo/'))
continue;
$image_uri = substr($image,strrpos($image,'/') + 1);
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
if(! strlen($image_uri))
continue;
$srch = '<' . intval($profile_uid) . '>';
$r = q("SELECT `id` FROM `photo` WHERE `allow_cid` = '%s' AND `allow_gid` = '' AND `deny_cid` = '' AND `deny_gid` = ''
AND `resource-id` = '%s' AND `uid` = %d LIMIT 1",
dbesc($srch),
dbesc($image_uri),
intval($profile_uid)
);
if(! count($r))
continue;
$r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `resource-id` = '%s' AND `uid` = %d AND `album` = '%s' ",
dbesc($str_contact_allow),
dbesc($str_group_allow),
dbesc($str_contact_deny),
dbesc($str_group_deny),
dbesc($image_uri),
intval($profile_uid),
dbesc( t('Wall Photos'))
);
}
}
}
/**
* Next link in any attachment references we find in the post.
*/
$match = false;
if((! $preview) && preg_match_all("/\[attachment\](.*?)\[\/attachment\]/",$body,$match)) {
$attaches = $match[1];
if(count($attaches)) {
foreach($attaches as $attach) {
$r = q("SELECT * FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid),
intval($attach)
);
if(count($r)) {
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `uid` = %d AND `id` = %d LIMIT 1",
dbesc($str_contact_allow),
dbesc($str_group_allow),
dbesc($str_contact_deny),
dbesc($str_group_deny),
intval($profile_uid),
intval($attach)
);
}
}
}
}
// embedded bookmark in post? set bookmark flag
$bookmark = 0;
if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match,PREG_SET_ORDER)) {
$bookmark = 1;
}
$body = bb_translate_video($body);
/**
* Fold multi-line [code] sequences
*/
$body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body);
/**
* Look for any tags and linkify them
*/
$str_tags = '';
$inform = '';
$tags = get_tags($body);
/**
* add a statusnet style reply tag if the original post was from there
* and we are replying, and there isn't one already
*/
if(($parent_contact) && ($parent_contact['network'] === NETWORK_OSTATUS)
&& ($parent_contact['nick']) && (! in_array('@' . $parent_contact['nick'],$tags))) {
$body = '@' . $parent_contact['nick'] . ' ' . $body;
$tags[] = '@' . $parent_contact['nick'];
}
if(count($tags)) {
foreach($tags as $tag) {
if(isset($profile))
unset($profile);
if(strpos($tag,'#') === 0) {
if(strpos($tag,'[url='))
continue;
$basetag = str_replace('_',' ',substr($tag,1));
$body = str_replace($tag,'#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]',$body);
$newtag = '#[url=' . $a->get_baseurl() . '/search?search=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
continue;
}
if(strpos($tag,'@') === 0) {
if(strpos($tag,'[url='))
continue;
$stat = false;
$name = substr($tag,1);
if((strpos($name,'@')) || (strpos($name,'http://'))) {
$newname = $name;
$links = @lrdd($name);
if(count($links)) {
foreach($links as $link) {
if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
$profile = $link['@attributes']['href'];
if($link['@attributes']['rel'] === 'salmon') {
if(strlen($inform))
$inform .= ',';
$inform .= 'url:' . str_replace(',','%2c',$link['@attributes']['href']);
}
}
}
}
else {
$newname = $name;
$alias = '';
$tagcid = 0;
if(strrpos($newname,'+')) {
$tagcid = intval(substr($newname,strrpos($newname,'+') + 1));
if(strpos($name,' '))
$name = substr($name,0,strpos($name,' '));
}
if($tagcid) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($tagcid),
intval($profile_uid)
);
}
elseif(strstr($name,'_') || strstr($name,' ')) {
$newname = str_replace('_',' ',$name);
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval($profile_uid)
);
}
else {
$r = q("SELECT * FROM `contact` WHERE `attag` = '%s' OR `nick` = '%s' AND `uid` = %d ORDER BY `attag` DESC LIMIT 1",
dbesc($name),
dbesc($name),
intval($profile_uid)
);
}
if(count($r)) {
$profile = $r[0]['url'];
if($r[0]['network'] === 'stat') {
$newname = $r[0]['nick'];
$stat = true;
if($r[0]['alias'])
$alias = $r[0]['alias'];
}
else
$newname = $r[0]['name'];
if(strlen($inform))
$inform .= ',';
$inform .= 'cid:' . $r[0]['id'];
}
}
if($profile) {
$body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body);
$profile = str_replace(',','%2c',$profile);
$newtag = '@[url=' . $profile . ']' . $newname . '[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
// Status.Net seems to require the numeric ID URL in a mention if the person isn't
// subscribed to you. But the nickname URL is OK if they are. Grrr. We'll tag both.
if(strlen($alias)) {
$newtag = '@[url=' . $alias . ']' . $newname . '[/url]';
if(! stristr($str_tags,$newtag)) {
if(strlen($str_tags))
$str_tags .= ',';
$str_tags .= $newtag;
}
}
}
}
}
}
$attachments = '';
$match = false;
if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
foreach($match[2] as $mtch) {
$r = q("SELECT `id`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
intval($profile_uid),
intval($mtch)
);
if(count($r)) {
if(strlen($attachments))
$attachments .= ',';
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';
}
$body = str_replace($match[1],'',$body);
}
}
$wall = 0;
if($post_type === 'wall' || $post_type === 'wall-comment')
$wall = 1;
if(! strlen($verb))
$verb = ACTIVITY_POST ;
$gravity = (($parent) ? 6 : 0 );
// even if the post arrived via API we are considering that it
// originated on this site by default for determining relayability.
$origin = ((x($_REQUEST,'origin')) ? intval($_REQUEST['origin']) : 1);
$notify_type = (($parent) ? 'comment-new' : 'wall-new' );
$uri = item_new_uri($a->get_hostname(),$profile_uid);
$datarray = array();
$datarray['uid'] = $profile_uid;
$datarray['type'] = $post_type;
$datarray['wall'] = $wall;
$datarray['gravity'] = $gravity;
$datarray['contact-id'] = $contact_id;
$datarray['owner-name'] = $contact_record['name'];
$datarray['owner-link'] = $contact_record['url'];
$datarray['owner-avatar'] = $contact_record['thumb'];
$datarray['author-name'] = $author['name'];
$datarray['author-link'] = $author['url'];
$datarray['author-avatar'] = $author['thumb'];
$datarray['created'] = datetime_convert();
$datarray['edited'] = datetime_convert();
$datarray['commented'] = datetime_convert();
$datarray['received'] = datetime_convert();
$datarray['changed'] = datetime_convert();
$datarray['uri'] = $uri;
$datarray['title'] = $title;
$datarray['body'] = $body;
$datarray['app'] = $app;
$datarray['location'] = $location;
$datarray['coord'] = $coord;
$datarray['tag'] = $str_tags;
$datarray['inform'] = $inform;
$datarray['verb'] = $verb;
$datarray['allow_cid'] = $str_contact_allow;
$datarray['allow_gid'] = $str_group_allow;
$datarray['deny_cid'] = $str_contact_deny;
$datarray['deny_gid'] = $str_group_deny;
$datarray['private'] = $private;
$datarray['pubmail'] = $pubmail_enable;
$datarray['attach'] = $attachments;
$datarray['bookmark'] = intval($bookmark);
$datarray['thr-parent'] = $thr_parent;
$datarray['postopts'] = '';
$datarray['origin'] = $origin;
/**
* These fields are for the convenience of plugins...
* 'self' if true indicates the owner is posting on their own wall
* If parent is 0 it is a top-level post.
*/
$datarray['parent'] = $parent;
$datarray['self'] = $self;
// $datarray['prvnets'] = $user['prvnets'];
if($orig_post)
$datarray['edit'] = true;
else
$datarray['guid'] = get_guid();
// preview mode - prepare the body for display and send it via json
if($preview) {
require_once('include/conversation.php');
$o = conversation(&$a,array(array_merge($contact_record,$datarray)),'search',false,true);
logger('preview: ' . $o);
echo json_encode(array('preview' => $o));
killme();
}
call_hooks('post_local',$datarray);
if($orig_post) {
$r = q("UPDATE `item` SET `body` = '%s', `edited` = '%s' WHERE `id` = %d AND `uid` = %d LIMIT 1",
dbesc($body),
dbesc(datetime_convert()),
intval($post_id),
intval($profile_uid)
);
proc_run('php', "include/notifier.php", 'edit_post', "$post_id");
if((x($_POST,'return')) && strlen($return_path)) {
logger('return: ' . $return_path);
goaway($a->get_baseurl() . "/" . $return_path );
}
killme();
}
else
$post_id = 0;
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`,`contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
`tag`, `inform`, `verb`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin` )
VALUES( '%s', %d, '%s', %d, %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d )",
dbesc($datarray['guid']),
intval($datarray['uid']),
dbesc($datarray['type']),
intval($datarray['wall']),
intval($datarray['gravity']),
intval($datarray['contact-id']),
dbesc($datarray['owner-name']),
dbesc($datarray['owner-link']),
dbesc($datarray['owner-avatar']),
dbesc($datarray['author-name']),
dbesc($datarray['author-link']),
dbesc($datarray['author-avatar']),
dbesc($datarray['created']),
dbesc($datarray['edited']),
dbesc($datarray['commented']),
dbesc($datarray['received']),
dbesc($datarray['changed']),
dbesc($datarray['uri']),
dbesc($datarray['thr-parent']),
dbesc($datarray['title']),
dbesc($datarray['body']),
dbesc($datarray['app']),
dbesc($datarray['location']),
dbesc($datarray['coord']),
dbesc($datarray['tag']),
dbesc($datarray['inform']),
dbesc($datarray['verb']),
dbesc($datarray['postopts']),
dbesc($datarray['allow_cid']),
dbesc($datarray['allow_gid']),
dbesc($datarray['deny_cid']),
dbesc($datarray['deny_gid']),
intval($datarray['private']),
intval($datarray['pubmail']),
dbesc($datarray['attach']),
intval($datarray['bookmark']),
intval($datarray['origin'])
);
$r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($datarray['uri']));
if(count($r)) {
$post_id = $r[0]['id'];
logger('mod_item: saved item ' . $post_id);
if($parent) {
// This item is the last leaf and gets the comment box, clear any ancestors
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent` = %d ",
dbesc(datetime_convert()),
intval($parent)
);
// Inherit ACL's from the parent item.
$r = q("UPDATE `item` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s', `private` = %d
WHERE `id` = %d LIMIT 1",
dbesc($parent_item['allow_cid']),
dbesc($parent_item['allow_gid']),
dbesc($parent_item['deny_cid']),
dbesc($parent_item['deny_gid']),
intval($parent_item['private']),
intval($post_id)
);
if($contact_record != $author) {
notification(array(
'type' => NOTIFY_COMMENT,
'notify_flags' => $user['notify-flags'],
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'],
'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
'verb' => ACTIVITY_POST,
'otype' => 'item'
));
}
// We won't be able to sign Diaspora comments for authenticated visitors - we don't have their private key
if($self) {
require_once('include/bb2diaspora.php');
$signed_body = html_entity_decode(bb2diaspora($datarray['body']));
$myaddr = $a->user['nickname'] . '@' . substr($a->get_baseurl(), strpos($a->get_baseurl(),'://') + 3);
if($datarray['verb'] === ACTIVITY_LIKE)
$signed_text = $datarray['guid'] . ';' . 'Post' . ';' . $parent_item['guid'] . ';' . 'true' . ';' . $myaddr;
else
$signed_text = $datarray['guid'] . ';' . $parent_item['guid'] . ';' . $signed_body . ';' . $myaddr;
$authorsig = base64_encode(rsa_sign($signed_text,$a->user['prvkey'],'sha256'));
q("insert into sign (`iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ",
intval($post_id),
dbesc($signed_text),
dbesc(base64_encode($authorsig)),
dbesc($myaddr)
);
}
}
else {
$parent = $post_id;
if($contact_record != $author) {
notification(array(
'type' => NOTIFY_WALL,
'notify_flags' => $user['notify-flags'],
'language' => $user['language'],
'to_name' => $user['username'],
'to_email' => $user['email'],
'item' => $datarray,
'link' => $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id,
'source_name' => $datarray['author-name'],
'source_link' => $datarray['author-link'],
'source_photo' => $datarray['author-avatar'],
'verb' => ACTIVITY_POST,
'otype' => 'item'
));
}
}
// fallback so that parent always gets set to non-zero.
if(! $parent)
$parent = $post_id;
$r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1
WHERE `id` = %d LIMIT 1",
intval($parent),
dbesc(($parent == $post_id) ? $uri : $parent_item['uri']),
dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id),
dbesc(datetime_convert()),
intval($post_id)
);
// photo comments turn the corresponding item visible to the profile wall
// This way we don't see every picture in your new photo album posted to your wall at once.
// They will show up as people comment on them.
if(! $parent_item['visible']) {
$r = q("UPDATE `item` SET `visible` = 1 WHERE `id` = %d LIMIT 1",
intval($parent_item['id'])
);
}
}
else {
logger('mod_item: unable to retrieve post that was just stored.');
notify( t('System error. Post not saved.'));
goaway($a->get_baseurl() . "/" . $return_path );
// NOTREACHED
}
// update the commented timestamp on the parent
q("UPDATE `item` set `commented` = '%s', `changed` = '%s' WHERE `id` = %d LIMIT 1",
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($parent)
);
$datarray['id'] = $post_id;
$datarray['plink'] = $a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id;
call_hooks('post_local_end', $datarray);
if(strlen($emailcc) && $profile_uid == local_user()) {
$erecips = explode(',', $emailcc);
if(count($erecips)) {
foreach($erecips as $recip) {
$addr = trim($recip);
if(! strlen($addr))
continue;
$disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'),$a->user['username'])
. '<br />';
$disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
$disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
$subject = '[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
$headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
$headers .= 'Content-Transfer-Encoding: 8bit' . "\n\n";
$link = '<a href="' . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . '"><img src="' . $author['thumb'] . '" alt="' . $a->user['username'] . '" /></a><br /><br />';
$html = prepare_body($datarray);
$message = '<html><body>' . $link . $html . $disclaimer . '</body></html>';
@mail($addr, $subject, $message, $headers);
}
}
}
// This is a real juggling act on shared hosting services which kill your processes
// e.g. dreamhost. We used to start delivery to our native delivery agents in the background
// and then run our plugin delivery from the foreground. We're now doing plugin delivery first,
// because as soon as you start loading up a bunch of remote delivey processes, *this* page is
// likely to get killed off. If you end up looking at an /item URL and a blank page,
// it's very likely the delivery got killed before all your friends could be notified.
// Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
// or cut back on plugins which do remote deliveries.
proc_run('php', "include/notifier.php", $notify_type, "$post_id");
logger('post_complete');
// figure out how to return, depending on from whence we came
if($api_source)
return;
if($return_path) {
goaway($a->get_baseurl() . "/" . $return_path);
}
$json = array('success' => 1);
if(x($_POST,'jsreload') && strlen($_POST['jsreload']))
$json['reload'] = $a->get_baseurl() . '/' . $_POST['jsreload'];
logger('post_json: ' . print_r($json,true), LOGGER_DEBUG);
echo json_encode($json);
killme();
// NOTREACHED
}
function item_content(&$a) {
if((! local_user()) && (! remote_user()))
return;
require_once('include/security.php');
if(($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) {
require_once('include/items.php');
drop_item($a->argv[2]);
}
}
| mit |
enriquecr1990/aseacivikmx | application/views/asea/control_usuarios/ResultadosBusquedaUsuarios.php | 3012 | <?php if($listaUsuario): ?>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Nombre</th>
<th>Correo</th>
<th>Teléfono</th>
<th>Activo</th>
<th></th>
</tr>
</thead>
<tbody class="tbodyEstacionesServicio">
<?php foreach ($listaUsuario as $usuario): ?>
<tr>
<td><?=$usuario->nombre.' '.$usuario->apellido_p.' '.$usuario->apellido_m?></td>
<td><?=$usuario->correo?></td>
<td><?=$usuario->telefono?></td>
<td><span class="label label-<?=$usuario->es_activo ? 'success': 'danger'?>"><?=$usuario->activo?></span></td>
<td>
<button class="btn btn-info btn-xs modificar_usuario_admin_asea" data-toggle="tooltip"
title="Modificar usuario administrador" data-placement="bottom"
data-tipo_usuario="admin"
data-id_usuario="<?=$usuario->id_usuario_admin?>">
<i class="glyphicon glyphicon-pencil"></i>
</button>
<button class="btn btn-<?=$usuario->es_activo ? 'warning' : 'success'?> btn-xs activar_desactivar_usario_sistema" data-toggle="tooltip"
data-url="ControlUsuarios/activarDesactivarUsuario/<?=$usuario->id_usuario_admin?>"
data-msg="Se <?=$usuario->es_activo ? 'desactivará' : 'activará'?> el usuario administrador, ¿Deseá continuar?"
title="<?=$usuario->es_activo ? 'Desactivar' : 'Activar'?> usuario sistema" data-placement="bottom"
data-btn_trigger=".buscar_usuarios_sistema"
data-id_usuario="<?=$usuario->id_usuario_admin?>">
<i class="glyphicon glyphicon-<?=$usuario->es_activo ? 'remove':'ok'?>"></i>
</button>
<button class="btn btn-danger btn-xs eliminar_usuario_admin" data-toggle="tooltip"
data-url="ControlUsuarios/eliminarUsuarioAdmin/<?=$usuario->id_usuario_admin?>"
data-btn_trigger=".buscar_usuarios_sistema"
title="Eliminar usuario administrador" data-placement="bottom"
data-id_usuario="<?=$usuario->id_usuario_admin?>">
<i class="glyphicon glyphicon-trash"></i>
</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<div class="alert alert-warning">
<span class="glyphicon glyphicon-info-sign"></span>No se encontraron registros
</div>
<?php endif; ?> | mit |
onezens/python | net/2.socket_client.py | 336 | #!/usr/bin/python
#encoding=utf8
import socket
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(('127.0.0.1', 9999))
print(client.recv(1024).decode('utf8'))
for data in [b'Xiaoming', b'Xiaohua', b'Xiaomwang']:
client.send(data)
print(client.recv(1024).decode('utf8'))
client.send(b'exit')
client.close() | mit |
gozwave/gozw | cc/association-v2/specific-group-get.gen.go | 1144 | // THIS FILE IS AUTO-GENERATED BY ZWGEN
// DO NOT MODIFY
package associationv2
import (
"encoding/gob"
"github.com/gozwave/gozw/cc"
)
const CommandSpecificGroupGet cc.CommandID = 0x0B
func init() {
gob.Register(SpecificGroupGet{})
cc.Register(cc.CommandIdentifier{
CommandClass: cc.CommandClassID(0x85),
Command: cc.CommandID(0x0B),
Version: 2,
}, NewSpecificGroupGet)
}
func NewSpecificGroupGet() cc.Command {
return &SpecificGroupGet{}
}
// <no value>
type SpecificGroupGet struct {
}
func (cmd SpecificGroupGet) CommandClassID() cc.CommandClassID {
return 0x85
}
func (cmd SpecificGroupGet) CommandID() cc.CommandID {
return CommandSpecificGroupGet
}
func (cmd SpecificGroupGet) CommandIDString() string {
return "ASSOCIATION_SPECIFIC_GROUP_GET"
}
func (cmd *SpecificGroupGet) UnmarshalBinary(data []byte) error {
// According to the docs, we must copy data if we wish to retain it after returning
return nil
}
func (cmd *SpecificGroupGet) MarshalBinary() (payload []byte, err error) {
payload = make([]byte, 2)
payload[0] = byte(cmd.CommandClassID())
payload[1] = byte(cmd.CommandID())
return
}
| mit |
NUBIC/aker | lib/aker/cas/authority.rb | 2241 | require 'aker/authorities'
require 'castanet'
module Aker::Cas
##
# An authority which verifies CAS tickets with an actual CAS server.
#
# @see Aker::Cas::UserExt
class Authority
include ConfigurationHelper
include Castanet::Client
attr_reader :configuration
##
# Creates a new instance of this authority. It reads parameters
# from the `:cas` parameters section of the given configuration.
# See {Aker::Cas::ConfigurationHelper} for information about the
# meanings of these parameters.
def initialize(configuration)
@configuration = configuration
unless cas_url
raise ":base_url parameter is required for CAS"
end
end
##
# Verifies the given credentials with the CAS server. The `:cas`
# and `:cas_proxy` kinds are supported. Both kinds require two
# credentials in the following order:
#
# * The ticket (either a service ticket or proxy ticket)
# * The service URL associated with the ticket
#
# The returned user will be extended with {Aker::Cas::CasUser}.
#
# If CAS proxying is enabled, then this method also retrieves the
# proxy-granting ticket for the user.
#
# @see http://www.jasig.org/cas/protocol
# CAS 2 protocol specification, section 2.5.4
# @return [Aker::User,:unsupported,nil] a user if the credentials
# are valid, `:unsupported` if the kind is anything but `:cas`
# or `:cas_proxy`, and nil otherwise
def valid_credentials?(kind, *credentials)
return :unsupported unless [:cas, :cas_proxy].include?(kind)
ticket = ticket_for(kind, *credentials)
ticket.present!
return nil unless ticket.ok?
Aker::User.new(ticket.username).tap do |u|
u.extend Aker::Cas::UserExt
u.cas_url = cas_url
u.proxy_callback_url = proxy_callback_url
u.proxy_retrieval_url = proxy_retrieval_url
if ticket.pgt_iou
ticket.retrieve_pgt!
u.pgt = ticket.pgt
end
end
end
private
def ticket_for(kind, ticket, service)
case kind
when :cas; service_ticket(ticket, service)
when :cas_proxy; proxy_ticket(ticket, service)
end
end
end
end
| mit |
Kr0oked/BitmapFontLibrary | BitmapFontLibraryTest/Loader/Parser/Text/TextFontFileParserTest.cs | 4166 | using System.IO;
using System.Reflection;
using BitmapFontLibrary.Helper;
using BitmapFontLibrary.Loader.Parser.Text;
using BitmapFontLibrary.Loader.Texture;
using BitmapFontLibrary.Model;
using Moq;
using NUnit.Framework;
using TextReader = BitmapFontLibrary.Loader.Parser.Text.TextReader;
namespace BitmapFontLibraryTest.Loader.Parser.Text
{
[TestFixture]
public class TextFontFileParserTest
{
private TextFontFileParser _parser;
private Mock<IIntAdapter> _intAdapter;
private Mock<IFontTextureLoader> _fontTextureLoader;
private Mock<IFontTexture> _fontTexture;
private string _assemblyDirectory;
[SetUp]
public void Initialize()
{
_intAdapter = new Mock<IIntAdapter>();
_fontTextureLoader = new Mock<IFontTextureLoader>();
_fontTexture = new Mock<IFontTexture>();
_parser = new TextFontFileParser(new TextReader(new StringAdapter()), _intAdapter.Object, _fontTextureLoader.Object);
_assemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
if (_assemblyDirectory == null) throw new FileNotFoundException("Assembly");
}
[Test]
public void TestParse()
{
_intAdapter
.Setup(adapter => adapter.IntToEnum<ChannelValue>(0))
.Returns(ChannelValue.Glyph);
_intAdapter
.Setup(adapter => adapter.IntToEnum<ChannelValue>(1))
.Returns(ChannelValue.Outline);
_intAdapter
.Setup(adapter => adapter.IntToEnum<Channel>(15))
.Returns(Channel.All);
_fontTextureLoader
.Setup(loader => loader.Load(Path.Combine(_assemblyDirectory, @"Data\Font\textTestFont_0.png"), true))
.Returns(_fontTexture.Object);
var path = Path.Combine(_assemblyDirectory, @"Data\Font\textTestFont.txt");
var font = _parser.Parse(new FileStream(path, FileMode.Open, FileAccess.Read), Path.GetDirectoryName(path));
Assert.AreEqual(font, GetExpectedFont());
}
private Font GetExpectedFont()
{
var characterA = new Character
{
X = 0,
Y = 0,
Width = 20,
Height = 21,
XOffset = 0,
YOffset = 5,
XAdvance = 19,
Page = 0,
Channel = Channel.All
};
var characterV = new Character
{
X = 21,
Y = 0,
Width = 19,
Height = 21,
XOffset = 0,
YOffset = 5,
XAdvance = 19,
Page = 0,
Channel = Channel.All
};
var font = new Font
{
Name = "Arial",
Size = 32,
IsBold = false,
IsItalic = false,
Charset = "",
IsUnicode = true,
StretchHeight = 100,
IsSmooth = true,
SuperSamplingLevel = 4,
PaddingTop = 0,
PaddingRight = 0,
PaddingBottom = 0,
PaddingLeft = 0,
SpacingTop = 1,
SpacingLeft = 1,
OutlineThickness = 0,
LineHeight = 32,
BaseHeight = 26,
ScaleWidth = 256,
ScaleHeight = 256,
PagesCount = 1,
AreCharactersPackedInMultipleChannels = false,
AlphaChannel = ChannelValue.Outline,
RedChannel = ChannelValue.Glyph,
GreenChannel = ChannelValue.Glyph,
BlueChannel = ChannelValue.Glyph
};
font.AddPage(0, _fontTexture.Object);
font.AddCharacter(65, characterA);
font.AddCharacter(86, characterV);
font.AddKerning(86, 65, -2);
font.AddKerning(65, 86, -2);
return font;
}
}
} | mit |
hsavit1/gosofi_webpage | node_modules/truffle-contract/test/linking.js | 6999 | // Override artifactor
var assert = require("chai").assert;
var temp = require("temp").track();
var path = require("path");
var requireNoCache = require("require-nocache")(module);
var contract = require("../");
var Web3 = require("web3");
var TestRPC = require("ganache-core");
var fs = require("fs");
var solc = require("solc");
var Schema = require("truffle-contract-schema");
// Clean up after solidity. Only remove solidity's listener,
// which happens to be the first.
process.removeListener("uncaughtException", process.listeners("uncaughtException")[0] || function() {});
describe("Library linking", function() {
var LibraryExample;
var provider = TestRPC.provider();
var network_id;
var web3 = new Web3();
web3.setProvider(provider)
before(function(done) {
web3.version.getNetwork(function(err, id) {
if (err) return done(err);
network_id = id;
done();
});
});
before(function() {
LibraryExample = contract({
contractName: "LibraryExample",
abi: [],
binary: "606060405260ea8060106000396000f3606060405260e060020a600035046335b09a6e8114601a575b005b601860e160020a631ad84d3702606090815273__A_____________________________________906335b09a6e906064906020906004818660325a03f415600257506040805160e160020a631ad84d37028152905173__B_____________________________________9350600482810192602092919082900301818660325a03f415600257506040805160e160020a631ad84d37028152905173821735ac2129bdfb20b560de2718783caf61ad1c9350600482810192602092919082900301818660325a03f41560025750505056",
});
LibraryExample.setNetwork(network_id);
});
after(function(done) {
temp.cleanupSync();
done();
});
it("leaves binary unlinked initially", function() {
assert(LibraryExample.binary.indexOf("__A_____________________________________") >= 0);
});
it("links first library properly", function() {
LibraryExample.link("A", "0x1234567890123456789012345678901234567890");
assert(LibraryExample.binary.indexOf("__A_____________________________________"), -1);
assert(LibraryExample.binary == "0x606060405260ea8060106000396000f3606060405260e060020a600035046335b09a6e8114601a575b005b601860e160020a631ad84d37026060908152731234567890123456789012345678901234567890906335b09a6e906064906020906004818660325a03f415600257506040805160e160020a631ad84d37028152905173__B_____________________________________9350600482810192602092919082900301818660325a03f415600257506040805160e160020a631ad84d37028152905173821735ac2129bdfb20b560de2718783caf61ad1c9350600482810192602092919082900301818660325a03f41560025750505056")
});
it("links second library properly", function() {
LibraryExample.link("B", "0x1111111111111111111111111111111111111111");
assert(LibraryExample.binary.indexOf("__B_____________________________________"), -1);
assert(LibraryExample.binary == "0x606060405260ea8060106000396000f3606060405260e060020a600035046335b09a6e8114601a575b005b601860e160020a631ad84d37026060908152731234567890123456789012345678901234567890906335b09a6e906064906020906004818660325a03f415600257506040805160e160020a631ad84d3702815290517311111111111111111111111111111111111111119350600482810192602092919082900301818660325a03f415600257506040805160e160020a631ad84d37028152905173821735ac2129bdfb20b560de2718783caf61ad1c9350600482810192602092919082900301818660325a03f41560025750505056")
});
it("allows for selective relinking", function() {
assert(LibraryExample.binary.indexOf("__A_____________________________________"), -1);
assert(LibraryExample.binary.indexOf("__B_____________________________________"), -1);
LibraryExample.link("A", "0x2222222222222222222222222222222222222222");
assert(LibraryExample.binary == "0x606060405260ea8060106000396000f3606060405260e060020a600035046335b09a6e8114601a575b005b601860e160020a631ad84d37026060908152732222222222222222222222222222222222222222906335b09a6e906064906020906004818660325a03f415600257506040805160e160020a631ad84d3702815290517311111111111111111111111111111111111111119350600482810192602092919082900301818660325a03f415600257506040805160e160020a631ad84d37028152905173821735ac2129bdfb20b560de2718783caf61ad1c9350600482810192602092919082900301818660325a03f41560025750505056")
});
});
describe("Library linking with contract objects", function() {
var ExampleLibrary;
var ExampleLibraryConsumer;
var exampleConsumer;
var accounts;
var web3;
var provider = TestRPC.provider();
var web3 = new Web3();
web3.setProvider(provider)
before(function(done) {
web3.version.getNetwork(function(err, id) {
if (err) return done(err);
network_id = id;
done();
});
});
before(function() {
this.timeout(10000);
var sources = {
"ExampleLibrary.sol": fs.readFileSync("./test/ExampleLibrary.sol", {encoding: "utf8"}),
"ExampleLibraryConsumer.sol": fs.readFileSync("./test/ExampleLibraryConsumer.sol", {encoding: "utf8"})
};
// Compile first
var result = solc.compile({sources: sources}, 1);
var library, libraryContractName;
if (result.contracts["ExampleLibrary"]) {
libraryContractName = "ExampleLibrary";
} else {
libraryContractName = "ExampleLibrary.sol:ExampleLibrary";
}
library = result.contracts[libraryContractName];
library.contractName = libraryContractName;
ExampleLibrary = contract(library);
ExampleLibrary.setProvider(provider);
var consumer, consumerContractName;
if (result.contracts["ExampleLibraryConsumer"]) {
consumerContractName = "ExampleLibraryConsumer";
} else {
consumerContractName = "ExampleLibraryConsumer.sol:ExampleLibraryConsumer";
}
consumer = result.contracts[consumerContractName];
consumer.contractName = consumerContractName;
ExampleLibraryConsumer = contract(consumer);
ExampleLibraryConsumer.setProvider(provider);
});
before(function(done) {
web3.eth.getAccounts(function(err, accs) {
accounts = accs;
ExampleLibrary.defaults({
from: accounts[0]
});
ExampleLibraryConsumer.defaults({
from: accounts[0]
});
ExampleLibrary.setNetwork(network_id);
ExampleLibraryConsumer.setNetwork(network_id);
done(err);
});
});
before("deploy library", function(done) {
ExampleLibrary.new({gas: 3141592}).then(function(instance) {
ExampleLibrary.address = instance.address;
}).then(done).catch(done);
});
after(function(done) {
temp.cleanupSync();
done();
});
it("should consume library's events when linked", function(done) {
ExampleLibraryConsumer.link(ExampleLibrary);
assert.equal(Object.keys(ExampleLibraryConsumer.events || {}).length, 1);
ExampleLibraryConsumer.new({gas: 3141592}).then(function(consumer) {
return consumer.triggerLibraryEvent();
}).then(function(result) {
assert.equal(result.logs.length, 1);
var log = result.logs[0];
assert.equal(log.event, "LibraryEvent");
}).then(done).catch(done);
});
});
| mit |
maxcrane/My-Blog | server/sitemap.js | 1207 | const sitemap = require('sitemap');
const articleUtils = require("../src/app/utils/articleUtils");
const hostname = 'https://www.maxcrane.org';
const cacheTime = 300000;
const changefreq = 'weekly';
let defaultBlogUrls = [{url: '/about', changefreq},
{url: '/articles', changefreq}];
const _ = require('lodash');
let blogSitemap = sitemap.createSitemap({hostname, cacheTime, urls: defaultBlogUrls});
const convertToSitemapUrl = (article) => {
return {url: `/${article.url}`, changefreq};
};
const convertToSitemapUrls = (articles) => {
return Promise.resolve(_.values(articles).map(convertToSitemapUrl));
};
const applySitemapUpdate = (newArticleUrls) => {
blogSitemap = sitemap.createSitemap({
hostname,
cacheTime,
urls: defaultBlogUrls.concat(newArticleUrls)
});
};
const updateSitemap = () => {
articleUtils.getArticles()
.then(convertToSitemapUrls)
.then(applySitemapUpdate)
.catch(console.log.bind(this))
//TODO: Use .finally (looks like its not in node 6)
setTimeout(updateSitemap, 300000);
};
const getSitemap = () => {
return blogSitemap.toString();
};
updateSitemap();
module.exports = {
getSitemap
}; | mit |
jasongin/noble-uwp | uwp/windows.devices.bluetooth.genericattributeprofile/_nodert_generated.cpp | 648142 | // Copyright (c) Microsoft Corporation
// All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache Version 2.0 License for specific language governing permissions and limitations under the License.
// TODO: Verify that this is is still needed..
#define NTDDI_VERSION 0x06010000
#include <v8.h>
#include "nan.h"
#include <string>
#include <ppltasks.h>
#include "CollectionsConverter.h"
#include "CollectionsWrap.h"
#include "node-async.h"
#include "NodeRtUtils.h"
#include "OpaqueWrapper.h"
#include "WrapperBase.h"
#using <Windows.WinMD>
// this undefs fixes the issues of compiling Windows.Data.Json, Windows.Storag.FileProperties, and Windows.Stroage.Search
// Some of the node header files brings windows definitions with the same names as some of the WinRT methods
#undef DocumentProperties
#undef GetObject
#undef CreateEvent
#undef FindText
#undef SendMessage
const char* REGISTRATION_TOKEN_MAP_PROPERTY_NAME = "__registrationTokenMap__";
using v8::Array;
using v8::String;
using v8::Handle;
using v8::Value;
using v8::Boolean;
using v8::Integer;
using v8::FunctionTemplate;
using v8::Object;
using v8::Local;
using v8::Function;
using v8::Date;
using v8::Number;
using v8::PropertyAttribute;
using v8::Primitive;
using Nan::HandleScope;
using Nan::Persistent;
using Nan::Undefined;
using Nan::True;
using Nan::False;
using Nan::Null;
using Nan::MaybeLocal;
using Nan::EscapableHandleScope;
using Nan::HandleScope;
using Nan::TryCatch;
using namespace concurrency;
namespace NodeRT { namespace Windows { namespace Devices { namespace Bluetooth { namespace GenericAttributeProfile {
v8::Local<v8::Value> WrapGattDeviceService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ UnwrapGattDeviceService(Local<Value> value);
v8::Local<v8::Value> WrapGattDeviceServicesResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ UnwrapGattDeviceServicesResult(Local<Value> value);
v8::Local<v8::Value> WrapGattProtocolError(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ UnwrapGattProtocolError(Local<Value> value);
v8::Local<v8::Value> WrapGattSession(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ UnwrapGattSession(Local<Value> value);
v8::Local<v8::Value> WrapGattSessionStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ UnwrapGattSessionStatusChangedEventArgs(Local<Value> value);
v8::Local<v8::Value> WrapGattCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ UnwrapGattCharacteristic(Local<Value> value);
v8::Local<v8::Value> WrapGattCharacteristicsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ UnwrapGattCharacteristicsResult(Local<Value> value);
v8::Local<v8::Value> WrapGattDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ UnwrapGattDescriptor(Local<Value> value);
v8::Local<v8::Value> WrapGattPresentationFormat(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ UnwrapGattPresentationFormat(Local<Value> value);
v8::Local<v8::Value> WrapGattReadResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ UnwrapGattReadResult(Local<Value> value);
v8::Local<v8::Value> WrapGattReadClientCharacteristicConfigurationDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ UnwrapGattReadClientCharacteristicConfigurationDescriptorResult(Local<Value> value);
v8::Local<v8::Value> WrapGattValueChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ UnwrapGattValueChangedEventArgs(Local<Value> value);
v8::Local<v8::Value> WrapGattDescriptorsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ UnwrapGattDescriptorsResult(Local<Value> value);
v8::Local<v8::Value> WrapGattWriteResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ UnwrapGattWriteResult(Local<Value> value);
v8::Local<v8::Value> WrapGattPresentationFormatTypes(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ UnwrapGattPresentationFormatTypes(Local<Value> value);
v8::Local<v8::Value> WrapGattServiceUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ UnwrapGattServiceUuids(Local<Value> value);
v8::Local<v8::Value> WrapGattCharacteristicUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ UnwrapGattCharacteristicUuids(Local<Value> value);
v8::Local<v8::Value> WrapGattDescriptorUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ UnwrapGattDescriptorUuids(Local<Value> value);
v8::Local<v8::Value> WrapGattReliableWriteTransaction(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ UnwrapGattReliableWriteTransaction(Local<Value> value);
v8::Local<v8::Value> WrapGattServiceProviderAdvertisingParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ UnwrapGattServiceProviderAdvertisingParameters(Local<Value> value);
v8::Local<v8::Value> WrapGattLocalCharacteristicParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ UnwrapGattLocalCharacteristicParameters(Local<Value> value);
v8::Local<v8::Value> WrapGattLocalDescriptorParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ UnwrapGattLocalDescriptorParameters(Local<Value> value);
v8::Local<v8::Value> WrapGattServiceProviderResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ UnwrapGattServiceProviderResult(Local<Value> value);
v8::Local<v8::Value> WrapGattLocalService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ UnwrapGattLocalService(Local<Value> value);
v8::Local<v8::Value> WrapGattServiceProvider(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ UnwrapGattServiceProvider(Local<Value> value);
v8::Local<v8::Value> WrapGattServiceProviderAdvertisementStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ UnwrapGattServiceProviderAdvertisementStatusChangedEventArgs(Local<Value> value);
v8::Local<v8::Value> WrapGattLocalCharacteristicResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ UnwrapGattLocalCharacteristicResult(Local<Value> value);
v8::Local<v8::Value> WrapGattLocalCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ UnwrapGattLocalCharacteristic(Local<Value> value);
v8::Local<v8::Value> WrapGattLocalDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ UnwrapGattLocalDescriptorResult(Local<Value> value);
v8::Local<v8::Value> WrapGattLocalDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ UnwrapGattLocalDescriptor(Local<Value> value);
v8::Local<v8::Value> WrapGattSubscribedClient(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ UnwrapGattSubscribedClient(Local<Value> value);
v8::Local<v8::Value> WrapGattReadRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ UnwrapGattReadRequestedEventArgs(Local<Value> value);
v8::Local<v8::Value> WrapGattWriteRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ UnwrapGattWriteRequestedEventArgs(Local<Value> value);
v8::Local<v8::Value> WrapGattClientNotificationResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ UnwrapGattClientNotificationResult(Local<Value> value);
v8::Local<v8::Value> WrapGattReadRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ UnwrapGattReadRequest(Local<Value> value);
v8::Local<v8::Value> WrapGattRequestStateChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ UnwrapGattRequestStateChangedEventArgs(Local<Value> value);
v8::Local<v8::Value> WrapGattWriteRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ wintRtInstance);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ UnwrapGattWriteRequest(Local<Value> value);
static void InitGattSessionStatusEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattSessionStatus").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("closed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatus::Closed)));
Nan::Set(enumObject, Nan::New<String>("active").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatus::Active)));
}
static void InitGattCharacteristicPropertiesEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattCharacteristicProperties").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("none").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::None)));
Nan::Set(enumObject, Nan::New<String>("broadcast").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::Broadcast)));
Nan::Set(enumObject, Nan::New<String>("read").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::Read)));
Nan::Set(enumObject, Nan::New<String>("writeWithoutResponse").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::WriteWithoutResponse)));
Nan::Set(enumObject, Nan::New<String>("write").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::Write)));
Nan::Set(enumObject, Nan::New<String>("notify").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::Notify)));
Nan::Set(enumObject, Nan::New<String>("indicate").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::Indicate)));
Nan::Set(enumObject, Nan::New<String>("authenticatedSignedWrites").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::AuthenticatedSignedWrites)));
Nan::Set(enumObject, Nan::New<String>("extendedProperties").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::ExtendedProperties)));
Nan::Set(enumObject, Nan::New<String>("reliableWrites").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::ReliableWrites)));
Nan::Set(enumObject, Nan::New<String>("writableAuxiliaries").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties::WritableAuxiliaries)));
}
static void InitGattClientCharacteristicConfigurationDescriptorValueEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattClientCharacteristicConfigurationDescriptorValue").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("none").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue::None)));
Nan::Set(enumObject, Nan::New<String>("notify").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue::Notify)));
Nan::Set(enumObject, Nan::New<String>("indicate").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue::Indicate)));
}
static void InitGattProtectionLevelEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattProtectionLevel").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("plain").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel::Plain)));
Nan::Set(enumObject, Nan::New<String>("authenticationRequired").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel::AuthenticationRequired)));
Nan::Set(enumObject, Nan::New<String>("encryptionRequired").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel::EncryptionRequired)));
Nan::Set(enumObject, Nan::New<String>("encryptionAndAuthenticationRequired").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel::EncryptionAndAuthenticationRequired)));
}
static void InitGattWriteOptionEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattWriteOption").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("writeWithResponse").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteOption::WriteWithResponse)));
Nan::Set(enumObject, Nan::New<String>("writeWithoutResponse").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteOption::WriteWithoutResponse)));
}
static void InitGattCommunicationStatusEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattCommunicationStatus").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus::Success)));
Nan::Set(enumObject, Nan::New<String>("unreachable").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus::Unreachable)));
Nan::Set(enumObject, Nan::New<String>("protocolError").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus::ProtocolError)));
Nan::Set(enumObject, Nan::New<String>("accessDenied").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus::AccessDenied)));
}
static void InitGattSharingModeEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattSharingMode").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("unspecified").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode::Unspecified)));
Nan::Set(enumObject, Nan::New<String>("exclusive").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode::Exclusive)));
Nan::Set(enumObject, Nan::New<String>("sharedReadOnly").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode::SharedReadOnly)));
Nan::Set(enumObject, Nan::New<String>("sharedReadAndWrite").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode::SharedReadAndWrite)));
}
static void InitGattOpenStatusEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattOpenStatus").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("unspecified").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus::Unspecified)));
Nan::Set(enumObject, Nan::New<String>("success").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus::Success)));
Nan::Set(enumObject, Nan::New<String>("alreadyOpened").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus::AlreadyOpened)));
Nan::Set(enumObject, Nan::New<String>("notFound").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus::NotFound)));
Nan::Set(enumObject, Nan::New<String>("sharingViolation").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus::SharingViolation)));
Nan::Set(enumObject, Nan::New<String>("accessDenied").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus::AccessDenied)));
}
static void InitGattRequestStateEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattRequestState").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("pending").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestState::Pending)));
Nan::Set(enumObject, Nan::New<String>("completed").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestState::Completed)));
Nan::Set(enumObject, Nan::New<String>("canceled").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestState::Canceled)));
}
static void InitGattServiceProviderAdvertisementStatusEnum(const Local<Object> exports)
{
HandleScope scope;
Local<Object> enumObject = Nan::New<Object>();
Nan::Set(exports, Nan::New<String>("GattServiceProviderAdvertisementStatus").ToLocalChecked(), enumObject);
Nan::Set(enumObject, Nan::New<String>("created").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatus::Created)));
Nan::Set(enumObject, Nan::New<String>("stopped").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatus::Stopped)));
Nan::Set(enumObject, Nan::New<String>("started").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatus::Started)));
Nan::Set(enumObject, Nan::New<String>("aborted").ToLocalChecked(), Nan::New<Integer>(static_cast<int>(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatus::Aborted)));
}
class GattDeviceService : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattDeviceService").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "getCharacteristics", GetCharacteristics);
Nan::SetPrototypeMethod(localRef, "getIncludedServices", GetIncludedServices);
Nan::SetPrototypeMethod(localRef, "close", Close);
Nan::SetPrototypeMethod(localRef, "getAllCharacteristics", GetAllCharacteristics);
Nan::SetPrototypeMethod(localRef, "getAllIncludedServices", GetAllIncludedServices);
Nan::SetPrototypeMethod(localRef, "requestAccessAsync", RequestAccessAsync);
Nan::SetPrototypeMethod(localRef, "openAsync", OpenAsync);
Nan::SetPrototypeMethod(localRef, "getCharacteristicsAsync", GetCharacteristicsAsync);
Nan::SetPrototypeMethod(localRef, "getCharacteristicsForUuidAsync", GetCharacteristicsForUuidAsync);
Nan::SetPrototypeMethod(localRef, "getIncludedServicesAsync", GetIncludedServicesAsync);
Nan::SetPrototypeMethod(localRef, "getIncludedServicesForUuidAsync", GetIncludedServicesForUuidAsync);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("attributeHandle").ToLocalChecked(), AttributeHandleGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("deviceId").ToLocalChecked(), DeviceIdGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("uuid").ToLocalChecked(), UuidGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("device").ToLocalChecked(), DeviceGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("parentServices").ToLocalChecked(), ParentServicesGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("deviceAccessInformation").ToLocalChecked(), DeviceAccessInformationGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("session").ToLocalChecked(), SessionGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("sharingMode").ToLocalChecked(), SharingModeGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetMethod(constructor, "getDeviceSelectorForBluetoothDeviceId", GetDeviceSelectorForBluetoothDeviceId);
Nan::SetMethod(constructor, "getDeviceSelectorForBluetoothDeviceIdAndUuid", GetDeviceSelectorForBluetoothDeviceIdAndUuid);
Nan::SetMethod(constructor, "getDeviceSelectorFromUuid", GetDeviceSelectorFromUuid);
Nan::SetMethod(constructor, "getDeviceSelectorFromShortId", GetDeviceSelectorFromShortId);
Nan::SetMethod(constructor, "convertShortIdToUuid", ConvertShortIdToUuid);
func = Nan::GetFunction(Nan::New<FunctionTemplate>(FromIdAsync)).ToLocalChecked();
Nan::Set(constructor, Nan::New<String>("fromIdAsync").ToLocalChecked(), func);
Nan::Set(exports, Nan::New<String>("GattDeviceService").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattDeviceService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattDeviceService *wrapperInstance = new GattDeviceService(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattDeviceService(winRtInstance));
}
static void RequestAccessAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Enumeration::DeviceAccessStatus>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->RequestAccessAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Enumeration::DeviceAccessStatus> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = Nan::New<Integer>(static_cast<int>(result));
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void OpenAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus>^ op;
if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode arg0 = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->OpenAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattOpenStatus> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = Nan::New<Integer>(static_cast<int>(result));
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetCharacteristicsAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->GetCharacteristicsAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::BluetoothCacheMode arg0 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->GetCharacteristicsAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattCharacteristicsResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetCharacteristicsForUuidAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
op = wrapper->_instance->GetCharacteristicsForUuidAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 3
&& NodeRT::Utils::IsGuid(info[0])
&& info[1]->IsInt32())
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Devices::Bluetooth::BluetoothCacheMode arg1 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[1]).FromMaybe(0));
op = wrapper->_instance->GetCharacteristicsForUuidAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattCharacteristicsResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetIncludedServicesAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->GetIncludedServicesAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::BluetoothCacheMode arg0 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->GetIncludedServicesAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattDeviceServicesResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetIncludedServicesForUuidAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
op = wrapper->_instance->GetIncludedServicesForUuidAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 3
&& NodeRT::Utils::IsGuid(info[0])
&& info[1]->IsInt32())
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Devices::Bluetooth::BluetoothCacheMode arg1 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[1]).FromMaybe(0));
op = wrapper->_instance->GetIncludedServicesForUuidAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattDeviceServicesResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetCharacteristics(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
if (info.Length() == 1
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>^ result;
result = wrapper->_instance->GetCharacteristics(arg0);
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ val) -> Local<Value> {
return WrapGattCharacteristic(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ {
return UnwrapGattCharacteristic(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void GetIncludedServices(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
if (info.Length() == 1
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>^ result;
result = wrapper->_instance->GetIncludedServices(arg0);
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ val) -> Local<Value> {
return WrapGattDeviceService(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ {
return UnwrapGattDeviceService(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void Close(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
if (info.Length() == 0)
{
try
{
delete wrapper->_instance;
wrapper->_instance = nullptr;
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void GetAllCharacteristics(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
if (info.Length() == 0)
{
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>^ result;
result = wrapper->_instance->GetAllCharacteristics();
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ val) -> Local<Value> {
return WrapGattCharacteristic(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ {
return UnwrapGattCharacteristic(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void GetAllIncludedServices(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
if (info.Length() == 0)
{
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>^ result;
result = wrapper->_instance->GetAllIncludedServices();
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ val) -> Local<Value> {
return WrapGattDeviceService(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ {
return UnwrapGattDeviceService(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void FromIdAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>^ op;
if (info.Length() == 3
&& info[0]->IsString()
&& info[1]->IsInt32())
{
try
{
Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(info[0])));
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode arg1 = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode>(Nan::To<int32_t>(info[1]).FromMaybe(0));
op = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::FromIdAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 2
&& info[0]->IsString())
{
try
{
Platform::String^ arg0 = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(info[0])));
op = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::FromIdAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattDeviceService(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetDeviceSelectorForBluetoothDeviceId(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 1
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(info[0]))
{
try
{
::Windows::Devices::Bluetooth::BluetoothDeviceId^ arg0 = dynamic_cast<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(NodeRT::Utils::GetObjectInstance(info[0]));
Platform::String^ result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::GetDeviceSelectorForBluetoothDeviceId(arg0);
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(info[0])
&& info[1]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::BluetoothDeviceId^ arg0 = dynamic_cast<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(NodeRT::Utils::GetObjectInstance(info[0]));
::Windows::Devices::Bluetooth::BluetoothCacheMode arg1 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[1]).FromMaybe(0));
Platform::String^ result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::GetDeviceSelectorForBluetoothDeviceId(arg0, arg1);
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void GetDeviceSelectorForBluetoothDeviceIdAndUuid(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(info[0])
&& NodeRT::Utils::IsGuid(info[1]))
{
try
{
::Windows::Devices::Bluetooth::BluetoothDeviceId^ arg0 = dynamic_cast<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(NodeRT::Utils::GetObjectInstance(info[0]));
::Platform::Guid arg1 = NodeRT::Utils::GuidFromJs(info[1]);
Platform::String^ result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::GetDeviceSelectorForBluetoothDeviceIdAndUuid(arg0, arg1);
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 3
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(info[0])
&& NodeRT::Utils::IsGuid(info[1])
&& info[2]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::BluetoothDeviceId^ arg0 = dynamic_cast<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(NodeRT::Utils::GetObjectInstance(info[0]));
::Platform::Guid arg1 = NodeRT::Utils::GuidFromJs(info[1]);
::Windows::Devices::Bluetooth::BluetoothCacheMode arg2 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[2]).FromMaybe(0));
Platform::String^ result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::GetDeviceSelectorForBluetoothDeviceIdAndUuid(arg0, arg1, arg2);
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void GetDeviceSelectorFromUuid(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 1
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
Platform::String^ result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::GetDeviceSelectorFromUuid(arg0);
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void GetDeviceSelectorFromShortId(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 1
&& info[0]->IsInt32())
{
try
{
unsigned short arg0 = static_cast<unsigned short>(Nan::To<int32_t>(info[0]).FromMaybe(0));
Platform::String^ result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::GetDeviceSelectorFromShortId(arg0);
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void ConvertShortIdToUuid(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 1
&& info[0]->IsInt32())
{
try
{
unsigned short arg0 = static_cast<unsigned short>(Nan::To<int32_t>(info[0]).FromMaybe(0));
::Platform::Guid result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService::ConvertShortIdToUuid(arg0);
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void AttributeHandleGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
unsigned short result = wrapper->_instance->AttributeHandle;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DeviceIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
Platform::String^ result = wrapper->_instance->DeviceId;
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UuidGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
::Platform::Guid result = wrapper->_instance->Uuid;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DeviceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothLEDevice^ result = wrapper->_instance->Device;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth", "BluetoothLEDevice", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ParentServicesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>^ result = wrapper->_instance->ParentServices;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ val) -> Local<Value> {
return WrapGattDeviceService(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ {
return UnwrapGattDeviceService(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DeviceAccessInformationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
::Windows::Devices::Enumeration::DeviceAccessInformation^ result = wrapper->_instance->DeviceAccessInformation;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Enumeration", "DeviceAccessInformation", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SessionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ result = wrapper->_instance->Session;
info.GetReturnValue().Set(WrapGattSession(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SharingModeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(info.This()))
{
return;
}
GattDeviceService *wrapper = GattDeviceService::Unwrap<GattDeviceService>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSharingMode result = wrapper->_instance->SharingMode;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattDeviceService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ UnwrapGattDeviceService(Local<Value> value);
};
Persistent<FunctionTemplate> GattDeviceService::s_constructorTemplate;
v8::Local<v8::Value> WrapGattDeviceService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattDeviceService::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ UnwrapGattDeviceService(Local<Value> value)
{
return GattDeviceService::Unwrap<GattDeviceService>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattDeviceService(Local<Object> exports)
{
GattDeviceService::Init(exports);
}
class GattDeviceServicesResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattDeviceServicesResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protocolError").ToLocalChecked(), ProtocolErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("services").ToLocalChecked(), ServicesGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattDeviceServicesResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattDeviceServicesResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattDeviceServicesResult *wrapperInstance = new GattDeviceServicesResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattDeviceServicesResult(winRtInstance));
}
static void ProtocolErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^>(info.This()))
{
return;
}
GattDeviceServicesResult *wrapper = GattDeviceServicesResult::Unwrap<GattDeviceServicesResult>(info.This());
try
{
::Platform::IBox<unsigned char>^ result = wrapper->_instance->ProtocolError;
info.GetReturnValue().Set(result ? static_cast<Local<Value>>(Nan::New<Integer>(result->Value)) : Undefined());
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ServicesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^>(info.This()))
{
return;
}
GattDeviceServicesResult *wrapper = GattDeviceServicesResult::Unwrap<GattDeviceServicesResult>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>^ result = wrapper->_instance->Services;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ val) -> Local<Value> {
return WrapGattDeviceService(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ {
return UnwrapGattDeviceService(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^>(info.This()))
{
return;
}
GattDeviceServicesResult *wrapper = GattDeviceServicesResult::Unwrap<GattDeviceServicesResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattDeviceServicesResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ UnwrapGattDeviceServicesResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattDeviceServicesResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattDeviceServicesResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattDeviceServicesResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceServicesResult^ UnwrapGattDeviceServicesResult(Local<Value> value)
{
return GattDeviceServicesResult::Unwrap<GattDeviceServicesResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattDeviceServicesResult(Local<Object> exports)
{
GattDeviceServicesResult::Init(exports);
}
class GattProtocolError : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattProtocolError").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetAccessor(constructor, Nan::New<String>("attributeNotFound").ToLocalChecked(), AttributeNotFoundGetter);
Nan::SetAccessor(constructor, Nan::New<String>("attributeNotLong").ToLocalChecked(), AttributeNotLongGetter);
Nan::SetAccessor(constructor, Nan::New<String>("insufficientAuthentication").ToLocalChecked(), InsufficientAuthenticationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("insufficientAuthorization").ToLocalChecked(), InsufficientAuthorizationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("insufficientEncryption").ToLocalChecked(), InsufficientEncryptionGetter);
Nan::SetAccessor(constructor, Nan::New<String>("insufficientEncryptionKeySize").ToLocalChecked(), InsufficientEncryptionKeySizeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("insufficientResources").ToLocalChecked(), InsufficientResourcesGetter);
Nan::SetAccessor(constructor, Nan::New<String>("invalidAttributeValueLength").ToLocalChecked(), InvalidAttributeValueLengthGetter);
Nan::SetAccessor(constructor, Nan::New<String>("invalidHandle").ToLocalChecked(), InvalidHandleGetter);
Nan::SetAccessor(constructor, Nan::New<String>("invalidOffset").ToLocalChecked(), InvalidOffsetGetter);
Nan::SetAccessor(constructor, Nan::New<String>("invalidPdu").ToLocalChecked(), InvalidPduGetter);
Nan::SetAccessor(constructor, Nan::New<String>("prepareQueueFull").ToLocalChecked(), PrepareQueueFullGetter);
Nan::SetAccessor(constructor, Nan::New<String>("readNotPermitted").ToLocalChecked(), ReadNotPermittedGetter);
Nan::SetAccessor(constructor, Nan::New<String>("requestNotSupported").ToLocalChecked(), RequestNotSupportedGetter);
Nan::SetAccessor(constructor, Nan::New<String>("unlikelyError").ToLocalChecked(), UnlikelyErrorGetter);
Nan::SetAccessor(constructor, Nan::New<String>("unsupportedGroupType").ToLocalChecked(), UnsupportedGroupTypeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("writeNotPermitted").ToLocalChecked(), WriteNotPermittedGetter);
Nan::Set(exports, Nan::New<String>("GattProtocolError").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattProtocolError(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattProtocolError *wrapperInstance = new GattProtocolError(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattProtocolError(winRtInstance));
}
static void AttributeNotFoundGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::AttributeNotFound;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AttributeNotLongGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::AttributeNotLong;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InsufficientAuthenticationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InsufficientAuthentication;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InsufficientAuthorizationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InsufficientAuthorization;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InsufficientEncryptionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InsufficientEncryption;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InsufficientEncryptionKeySizeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InsufficientEncryptionKeySize;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InsufficientResourcesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InsufficientResources;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InvalidAttributeValueLengthGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InvalidAttributeValueLength;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InvalidHandleGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InvalidHandle;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InvalidOffsetGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InvalidOffset;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void InvalidPduGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::InvalidPdu;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void PrepareQueueFullGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::PrepareQueueFull;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReadNotPermittedGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::ReadNotPermitted;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void RequestNotSupportedGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::RequestNotSupported;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UnlikelyErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::UnlikelyError;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UnsupportedGroupTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::UnsupportedGroupType;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void WriteNotPermittedGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError::WriteNotPermitted;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattProtocolError(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ UnwrapGattProtocolError(Local<Value> value);
};
Persistent<FunctionTemplate> GattProtocolError::s_constructorTemplate;
v8::Local<v8::Value> WrapGattProtocolError(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattProtocolError::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtocolError^ UnwrapGattProtocolError(Local<Value> value)
{
return GattProtocolError::Unwrap<GattProtocolError>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattProtocolError(Local<Object> exports)
{
GattProtocolError::Init(exports);
}
class GattSession : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattSession").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "close", Close);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maintainConnection").ToLocalChecked(), MaintainConnectionGetter, MaintainConnectionSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("canMaintainConnection").ToLocalChecked(), CanMaintainConnectionGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("deviceId").ToLocalChecked(), DeviceIdGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maxPduSize").ToLocalChecked(), MaxPduSizeGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("sessionStatus").ToLocalChecked(), SessionStatusGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
func = Nan::GetFunction(Nan::New<FunctionTemplate>(FromDeviceIdAsync)).ToLocalChecked();
Nan::Set(constructor, Nan::New<String>("fromDeviceIdAsync").ToLocalChecked(), func);
Nan::Set(exports, Nan::New<String>("GattSession").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattSession(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattSession *wrapperInstance = new GattSession(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattSession(winRtInstance));
}
static void Close(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
if (info.Length() == 0)
{
try
{
delete wrapper->_instance;
wrapper->_instance = nullptr;
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void FromDeviceIdAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(info[0]))
{
try
{
::Windows::Devices::Bluetooth::BluetoothDeviceId^ arg0 = dynamic_cast<::Windows::Devices::Bluetooth::BluetoothDeviceId^>(NodeRT::Utils::GetObjectInstance(info[0]));
op = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession::FromDeviceIdAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattSession(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void MaintainConnectionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
bool result = wrapper->_instance->MaintainConnection;
info.GetReturnValue().Set(Nan::New<Boolean>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void MaintainConnectionSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsBoolean())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
bool winRtValue = Nan::To<bool>(value).FromMaybe(false);
wrapper->_instance->MaintainConnection = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void CanMaintainConnectionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
bool result = wrapper->_instance->CanMaintainConnection;
info.GetReturnValue().Set(Nan::New<Boolean>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DeviceIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothDeviceId^ result = wrapper->_instance->DeviceId;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Devices.Bluetooth", "BluetoothDeviceId", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void MaxPduSizeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
unsigned short result = wrapper->_instance->MaxPduSize;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SessionStatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatus result = wrapper->_instance->SessionStatus;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"maxPduSizeChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->MaxPduSizeChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^, ::Platform::Object^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ arg0, ::Platform::Object^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattSession(arg0);
wrappedArg1 = CreateOpaqueWrapper(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"sessionStatusChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->SessionStatusChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattSession(arg0);
wrappedArg1 = WrapGattSessionStatusChangedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"maxPduSizeChanged", str)) &&(!NodeRT::Utils::CaseInsenstiveEquals(L"sessionStatusChanged", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"maxPduSizeChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
wrapper->_instance->MaxPduSizeChanged::remove(registrationToken);
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"sessionStatusChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattSession *wrapper = GattSession::Unwrap<GattSession>(info.This());
wrapper->_instance->SessionStatusChanged::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattSession(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ UnwrapGattSession(Local<Value> value);
};
Persistent<FunctionTemplate> GattSession::s_constructorTemplate;
v8::Local<v8::Value> WrapGattSession(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattSession::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ UnwrapGattSession(Local<Value> value)
{
return GattSession::Unwrap<GattSession>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattSession(Local<Object> exports)
{
GattSession::Init(exports);
}
class GattSessionStatusChangedEventArgs : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattSessionStatusChangedEventArgs").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("error").ToLocalChecked(), ErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattSessionStatusChangedEventArgs").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattSessionStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattSessionStatusChangedEventArgs *wrapperInstance = new GattSessionStatusChangedEventArgs(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattSessionStatusChangedEventArgs(winRtInstance));
}
static void ErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^>(info.This()))
{
return;
}
GattSessionStatusChangedEventArgs *wrapper = GattSessionStatusChangedEventArgs::Unwrap<GattSessionStatusChangedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothError result = wrapper->_instance->Error;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^>(info.This()))
{
return;
}
GattSessionStatusChangedEventArgs *wrapper = GattSessionStatusChangedEventArgs::Unwrap<GattSessionStatusChangedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattSessionStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ UnwrapGattSessionStatusChangedEventArgs(Local<Value> value);
};
Persistent<FunctionTemplate> GattSessionStatusChangedEventArgs::s_constructorTemplate;
v8::Local<v8::Value> WrapGattSessionStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattSessionStatusChangedEventArgs::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSessionStatusChangedEventArgs^ UnwrapGattSessionStatusChangedEventArgs(Local<Value> value)
{
return GattSessionStatusChangedEventArgs::Unwrap<GattSessionStatusChangedEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattSessionStatusChangedEventArgs(Local<Object> exports)
{
GattSessionStatusChangedEventArgs::Init(exports);
}
class GattCharacteristic : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattCharacteristic").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "getDescriptors", GetDescriptors);
Nan::SetPrototypeMethod(localRef, "getAllDescriptors", GetAllDescriptors);
Nan::SetPrototypeMethod(localRef, "readValueAsync", ReadValueAsync);
Nan::SetPrototypeMethod(localRef, "writeValueAsync", WriteValueAsync);
Nan::SetPrototypeMethod(localRef, "readClientCharacteristicConfigurationDescriptorAsync", ReadClientCharacteristicConfigurationDescriptorAsync);
Nan::SetPrototypeMethod(localRef, "writeClientCharacteristicConfigurationDescriptorAsync", WriteClientCharacteristicConfigurationDescriptorAsync);
Nan::SetPrototypeMethod(localRef, "getDescriptorsAsync", GetDescriptorsAsync);
Nan::SetPrototypeMethod(localRef, "getDescriptorsForUuidAsync", GetDescriptorsForUuidAsync);
Nan::SetPrototypeMethod(localRef, "writeValueWithResultAsync", WriteValueWithResultAsync);
Nan::SetPrototypeMethod(localRef, "writeClientCharacteristicConfigurationDescriptorWithResultAsync", WriteClientCharacteristicConfigurationDescriptorWithResultAsync);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protectionLevel").ToLocalChecked(), ProtectionLevelGetter, ProtectionLevelSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("attributeHandle").ToLocalChecked(), AttributeHandleGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristicProperties").ToLocalChecked(), CharacteristicPropertiesGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("presentationFormats").ToLocalChecked(), PresentationFormatsGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("userDescription").ToLocalChecked(), UserDescriptionGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("uuid").ToLocalChecked(), UuidGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("service").ToLocalChecked(), ServiceGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetMethod(constructor, "convertShortIdToUuid", ConvertShortIdToUuid);
Nan::Set(exports, Nan::New<String>("GattCharacteristic").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattCharacteristic *wrapperInstance = new GattCharacteristic(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattCharacteristic(winRtInstance));
}
static void ReadValueAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->ReadValueAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::BluetoothCacheMode arg0 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->ReadValueAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattReadResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void WriteValueAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0]))
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
op = wrapper->_instance->WriteValueAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 3
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0])
&& info[1]->IsInt32())
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteOption arg1 = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteOption>(Nan::To<int32_t>(info[1]).FromMaybe(0));
op = wrapper->_instance->WriteValueAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = Nan::New<Integer>(static_cast<int>(result));
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void ReadClientCharacteristicConfigurationDescriptorAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->ReadClientCharacteristicConfigurationDescriptorAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattReadClientCharacteristicConfigurationDescriptorResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void WriteClientCharacteristicConfigurationDescriptorAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus>^ op;
if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue arg0 = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->WriteClientCharacteristicConfigurationDescriptorAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = Nan::New<Integer>(static_cast<int>(result));
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetDescriptorsAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->GetDescriptorsAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::BluetoothCacheMode arg0 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->GetDescriptorsAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattDescriptorsResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetDescriptorsForUuidAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
op = wrapper->_instance->GetDescriptorsForUuidAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 3
&& NodeRT::Utils::IsGuid(info[0])
&& info[1]->IsInt32())
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Devices::Bluetooth::BluetoothCacheMode arg1 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[1]).FromMaybe(0));
op = wrapper->_instance->GetDescriptorsForUuidAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattDescriptorsResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void WriteValueWithResultAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0]))
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
op = wrapper->_instance->WriteValueWithResultAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 3
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0])
&& info[1]->IsInt32())
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteOption arg1 = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteOption>(Nan::To<int32_t>(info[1]).FromMaybe(0));
op = wrapper->_instance->WriteValueWithResultAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattWriteResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void WriteClientCharacteristicConfigurationDescriptorWithResultAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>^ op;
if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue arg0 = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->WriteClientCharacteristicConfigurationDescriptorWithResultAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattWriteResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetDescriptors(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
if (info.Length() == 1
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>^ result;
result = wrapper->_instance->GetDescriptors(arg0);
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ val) -> Local<Value> {
return WrapGattDescriptor(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ {
return UnwrapGattDescriptor(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void GetAllDescriptors(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
if (info.Length() == 0)
{
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>^ result;
result = wrapper->_instance->GetAllDescriptors();
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ val) -> Local<Value> {
return WrapGattDescriptor(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ {
return UnwrapGattDescriptor(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void ConvertShortIdToUuid(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 1
&& info[0]->IsInt32())
{
try
{
unsigned short arg0 = static_cast<unsigned short>(Nan::To<int32_t>(info[0]).FromMaybe(0));
::Platform::Guid result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic::ConvertShortIdToUuid(arg0);
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void ProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->ProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ProtectionLevelSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsInt32())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel winRtValue = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel>(Nan::To<int32_t>(value).FromMaybe(0));
wrapper->_instance->ProtectionLevel = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void AttributeHandleGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
unsigned short result = wrapper->_instance->AttributeHandle;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CharacteristicPropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties result = wrapper->_instance->CharacteristicProperties;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void PresentationFormatsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>^ result = wrapper->_instance->PresentationFormats;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ val) -> Local<Value> {
return WrapGattPresentationFormat(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ {
return UnwrapGattPresentationFormat(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UserDescriptionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
Platform::String^ result = wrapper->_instance->UserDescription;
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UuidGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
::Platform::Guid result = wrapper->_instance->Uuid;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ServiceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDeviceService^ result = wrapper->_instance->Service;
info.GetReturnValue().Set(WrapGattDeviceService(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"valueChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->ValueChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattCharacteristic(arg0);
wrappedArg1 = WrapGattValueChangedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"valueChanged", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"valueChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattCharacteristic *wrapper = GattCharacteristic::Unwrap<GattCharacteristic>(info.This());
wrapper->_instance->ValueChanged::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ UnwrapGattCharacteristic(Local<Value> value);
};
Persistent<FunctionTemplate> GattCharacteristic::s_constructorTemplate;
v8::Local<v8::Value> WrapGattCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattCharacteristic::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ UnwrapGattCharacteristic(Local<Value> value)
{
return GattCharacteristic::Unwrap<GattCharacteristic>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattCharacteristic(Local<Object> exports)
{
GattCharacteristic::Init(exports);
}
class GattCharacteristicsResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattCharacteristicsResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristics").ToLocalChecked(), CharacteristicsGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protocolError").ToLocalChecked(), ProtocolErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattCharacteristicsResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattCharacteristicsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattCharacteristicsResult *wrapperInstance = new GattCharacteristicsResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattCharacteristicsResult(winRtInstance));
}
static void CharacteristicsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^>(info.This()))
{
return;
}
GattCharacteristicsResult *wrapper = GattCharacteristicsResult::Unwrap<GattCharacteristicsResult>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>^ result = wrapper->_instance->Characteristics;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ val) -> Local<Value> {
return WrapGattCharacteristic(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ {
return UnwrapGattCharacteristic(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ProtocolErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^>(info.This()))
{
return;
}
GattCharacteristicsResult *wrapper = GattCharacteristicsResult::Unwrap<GattCharacteristicsResult>(info.This());
try
{
::Platform::IBox<unsigned char>^ result = wrapper->_instance->ProtocolError;
info.GetReturnValue().Set(result ? static_cast<Local<Value>>(Nan::New<Integer>(result->Value)) : Undefined());
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^>(info.This()))
{
return;
}
GattCharacteristicsResult *wrapper = GattCharacteristicsResult::Unwrap<GattCharacteristicsResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattCharacteristicsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ UnwrapGattCharacteristicsResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattCharacteristicsResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattCharacteristicsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattCharacteristicsResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicsResult^ UnwrapGattCharacteristicsResult(Local<Value> value)
{
return GattCharacteristicsResult::Unwrap<GattCharacteristicsResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattCharacteristicsResult(Local<Object> exports)
{
GattCharacteristicsResult::Init(exports);
}
class GattDescriptor : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattDescriptor").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "readValueAsync", ReadValueAsync);
Nan::SetPrototypeMethod(localRef, "writeValueAsync", WriteValueAsync);
Nan::SetPrototypeMethod(localRef, "writeValueWithResultAsync", WriteValueWithResultAsync);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protectionLevel").ToLocalChecked(), ProtectionLevelGetter, ProtectionLevelSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("attributeHandle").ToLocalChecked(), AttributeHandleGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("uuid").ToLocalChecked(), UuidGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetMethod(constructor, "convertShortIdToUuid", ConvertShortIdToUuid);
Nan::Set(exports, Nan::New<String>("GattDescriptor").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattDescriptor *wrapperInstance = new GattDescriptor(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattDescriptor(winRtInstance));
}
static void ReadValueAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDescriptor *wrapper = GattDescriptor::Unwrap<GattDescriptor>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->ReadValueAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 2
&& info[0]->IsInt32())
{
try
{
::Windows::Devices::Bluetooth::BluetoothCacheMode arg0 = static_cast<::Windows::Devices::Bluetooth::BluetoothCacheMode>(Nan::To<int32_t>(info[0]).FromMaybe(0));
op = wrapper->_instance->ReadValueAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattReadResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void WriteValueAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDescriptor *wrapper = GattDescriptor::Unwrap<GattDescriptor>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0]))
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
op = wrapper->_instance->WriteValueAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = Nan::New<Integer>(static_cast<int>(result));
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void WriteValueWithResultAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattDescriptor *wrapper = GattDescriptor::Unwrap<GattDescriptor>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0]))
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
op = wrapper->_instance->WriteValueWithResultAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattWriteResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void ConvertShortIdToUuid(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 1
&& info[0]->IsInt32())
{
try
{
unsigned short arg0 = static_cast<unsigned short>(Nan::To<int32_t>(info[0]).FromMaybe(0));
::Platform::Guid result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor::ConvertShortIdToUuid(arg0);
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void ProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info.This()))
{
return;
}
GattDescriptor *wrapper = GattDescriptor::Unwrap<GattDescriptor>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->ProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ProtectionLevelSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsInt32())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info.This()))
{
return;
}
GattDescriptor *wrapper = GattDescriptor::Unwrap<GattDescriptor>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel winRtValue = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel>(Nan::To<int32_t>(value).FromMaybe(0));
wrapper->_instance->ProtectionLevel = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void AttributeHandleGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info.This()))
{
return;
}
GattDescriptor *wrapper = GattDescriptor::Unwrap<GattDescriptor>(info.This());
try
{
unsigned short result = wrapper->_instance->AttributeHandle;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UuidGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(info.This()))
{
return;
}
GattDescriptor *wrapper = GattDescriptor::Unwrap<GattDescriptor>(info.This());
try
{
::Platform::Guid result = wrapper->_instance->Uuid;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ UnwrapGattDescriptor(Local<Value> value);
};
Persistent<FunctionTemplate> GattDescriptor::s_constructorTemplate;
v8::Local<v8::Value> WrapGattDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattDescriptor::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ UnwrapGattDescriptor(Local<Value> value)
{
return GattDescriptor::Unwrap<GattDescriptor>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattDescriptor(Local<Object> exports)
{
GattDescriptor::Init(exports);
}
class GattPresentationFormat : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattPresentationFormat").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("description").ToLocalChecked(), DescriptionGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("exponent").ToLocalChecked(), ExponentGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("formatType").ToLocalChecked(), FormatTypeGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("namespace").ToLocalChecked(), NamespaceGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("unit").ToLocalChecked(), UnitGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetMethod(constructor, "fromParts", FromParts);
Nan::SetAccessor(constructor, Nan::New<String>("bluetoothSigAssignedNumbers").ToLocalChecked(), BluetoothSigAssignedNumbersGetter);
Nan::Set(exports, Nan::New<String>("GattPresentationFormat").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattPresentationFormat(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattPresentationFormat *wrapperInstance = new GattPresentationFormat(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattPresentationFormat(winRtInstance));
}
static void FromParts(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 5
&& info[0]->IsInt32()
&& info[1]->IsInt32()
&& info[2]->IsInt32()
&& info[3]->IsInt32()
&& info[4]->IsInt32())
{
try
{
unsigned char arg0 = static_cast<unsigned char>(Nan::To<int32_t>(info[0]).FromMaybe(0));
int arg1 = static_cast<int>(Nan::To<int32_t>(info[1]).FromMaybe(0));
unsigned short arg2 = static_cast<unsigned short>(Nan::To<int32_t>(info[2]).FromMaybe(0));
unsigned char arg3 = static_cast<unsigned char>(Nan::To<int32_t>(info[3]).FromMaybe(0));
unsigned short arg4 = static_cast<unsigned short>(Nan::To<int32_t>(info[4]).FromMaybe(0));
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ result;
result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat::FromParts(arg0, arg1, arg2, arg3, arg4);
info.GetReturnValue().Set(WrapGattPresentationFormat(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void DescriptionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(info.This()))
{
return;
}
GattPresentationFormat *wrapper = GattPresentationFormat::Unwrap<GattPresentationFormat>(info.This());
try
{
unsigned short result = wrapper->_instance->Description;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ExponentGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(info.This()))
{
return;
}
GattPresentationFormat *wrapper = GattPresentationFormat::Unwrap<GattPresentationFormat>(info.This());
try
{
int result = wrapper->_instance->Exponent;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void FormatTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(info.This()))
{
return;
}
GattPresentationFormat *wrapper = GattPresentationFormat::Unwrap<GattPresentationFormat>(info.This());
try
{
unsigned char result = wrapper->_instance->FormatType;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void NamespaceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(info.This()))
{
return;
}
GattPresentationFormat *wrapper = GattPresentationFormat::Unwrap<GattPresentationFormat>(info.This());
try
{
unsigned char result = wrapper->_instance->Namespace;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UnitGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(info.This()))
{
return;
}
GattPresentationFormat *wrapper = GattPresentationFormat::Unwrap<GattPresentationFormat>(info.This());
try
{
unsigned short result = wrapper->_instance->Unit;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BluetoothSigAssignedNumbersGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat::BluetoothSigAssignedNumbers;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattPresentationFormat(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ UnwrapGattPresentationFormat(Local<Value> value);
};
Persistent<FunctionTemplate> GattPresentationFormat::s_constructorTemplate;
v8::Local<v8::Value> WrapGattPresentationFormat(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattPresentationFormat::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ UnwrapGattPresentationFormat(Local<Value> value)
{
return GattPresentationFormat::Unwrap<GattPresentationFormat>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattPresentationFormat(Local<Object> exports)
{
GattPresentationFormat::Init(exports);
}
class GattReadResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattReadResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("value").ToLocalChecked(), ValueGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protocolError").ToLocalChecked(), ProtocolErrorGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattReadResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattReadResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattReadResult *wrapperInstance = new GattReadResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattReadResult(winRtInstance));
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^>(info.This()))
{
return;
}
GattReadResult *wrapper = GattReadResult::Unwrap<GattReadResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ValueGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^>(info.This()))
{
return;
}
GattReadResult *wrapper = GattReadResult::Unwrap<GattReadResult>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ result = wrapper->_instance->Value;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IBuffer", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ProtocolErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^>(info.This()))
{
return;
}
GattReadResult *wrapper = GattReadResult::Unwrap<GattReadResult>(info.This());
try
{
::Platform::IBox<unsigned char>^ result = wrapper->_instance->ProtocolError;
info.GetReturnValue().Set(result ? static_cast<Local<Value>>(Nan::New<Integer>(result->Value)) : Undefined());
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattReadResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ UnwrapGattReadResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattReadResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattReadResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattReadResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadResult^ UnwrapGattReadResult(Local<Value> value)
{
return GattReadResult::Unwrap<GattReadResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattReadResult(Local<Object> exports)
{
GattReadResult::Init(exports);
}
class GattReadClientCharacteristicConfigurationDescriptorResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattReadClientCharacteristicConfigurationDescriptorResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("clientCharacteristicConfigurationDescriptor").ToLocalChecked(), ClientCharacteristicConfigurationDescriptorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protocolError").ToLocalChecked(), ProtocolErrorGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattReadClientCharacteristicConfigurationDescriptorResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattReadClientCharacteristicConfigurationDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattReadClientCharacteristicConfigurationDescriptorResult *wrapperInstance = new GattReadClientCharacteristicConfigurationDescriptorResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattReadClientCharacteristicConfigurationDescriptorResult(winRtInstance));
}
static void ClientCharacteristicConfigurationDescriptorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^>(info.This()))
{
return;
}
GattReadClientCharacteristicConfigurationDescriptorResult *wrapper = GattReadClientCharacteristicConfigurationDescriptorResult::Unwrap<GattReadClientCharacteristicConfigurationDescriptorResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientCharacteristicConfigurationDescriptorValue result = wrapper->_instance->ClientCharacteristicConfigurationDescriptor;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^>(info.This()))
{
return;
}
GattReadClientCharacteristicConfigurationDescriptorResult *wrapper = GattReadClientCharacteristicConfigurationDescriptorResult::Unwrap<GattReadClientCharacteristicConfigurationDescriptorResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ProtocolErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^>(info.This()))
{
return;
}
GattReadClientCharacteristicConfigurationDescriptorResult *wrapper = GattReadClientCharacteristicConfigurationDescriptorResult::Unwrap<GattReadClientCharacteristicConfigurationDescriptorResult>(info.This());
try
{
::Platform::IBox<unsigned char>^ result = wrapper->_instance->ProtocolError;
info.GetReturnValue().Set(result ? static_cast<Local<Value>>(Nan::New<Integer>(result->Value)) : Undefined());
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattReadClientCharacteristicConfigurationDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ UnwrapGattReadClientCharacteristicConfigurationDescriptorResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattReadClientCharacteristicConfigurationDescriptorResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattReadClientCharacteristicConfigurationDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattReadClientCharacteristicConfigurationDescriptorResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadClientCharacteristicConfigurationDescriptorResult^ UnwrapGattReadClientCharacteristicConfigurationDescriptorResult(Local<Value> value)
{
return GattReadClientCharacteristicConfigurationDescriptorResult::Unwrap<GattReadClientCharacteristicConfigurationDescriptorResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattReadClientCharacteristicConfigurationDescriptorResult(Local<Object> exports)
{
GattReadClientCharacteristicConfigurationDescriptorResult::Init(exports);
}
class GattValueChangedEventArgs : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattValueChangedEventArgs").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristicValue").ToLocalChecked(), CharacteristicValueGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("timestamp").ToLocalChecked(), TimestampGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattValueChangedEventArgs").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattValueChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattValueChangedEventArgs *wrapperInstance = new GattValueChangedEventArgs(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattValueChangedEventArgs(winRtInstance));
}
static void CharacteristicValueGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^>(info.This()))
{
return;
}
GattValueChangedEventArgs *wrapper = GattValueChangedEventArgs::Unwrap<GattValueChangedEventArgs>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ result = wrapper->_instance->CharacteristicValue;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IBuffer", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TimestampGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^>(info.This()))
{
return;
}
GattValueChangedEventArgs *wrapper = GattValueChangedEventArgs::Unwrap<GattValueChangedEventArgs>(info.This());
try
{
::Windows::Foundation::DateTime result = wrapper->_instance->Timestamp;
info.GetReturnValue().Set(NodeRT::Utils::DateTimeToJS(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattValueChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ UnwrapGattValueChangedEventArgs(Local<Value> value);
};
Persistent<FunctionTemplate> GattValueChangedEventArgs::s_constructorTemplate;
v8::Local<v8::Value> WrapGattValueChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattValueChangedEventArgs::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattValueChangedEventArgs^ UnwrapGattValueChangedEventArgs(Local<Value> value)
{
return GattValueChangedEventArgs::Unwrap<GattValueChangedEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattValueChangedEventArgs(Local<Object> exports)
{
GattValueChangedEventArgs::Init(exports);
}
class GattDescriptorsResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattDescriptorsResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("descriptors").ToLocalChecked(), DescriptorsGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protocolError").ToLocalChecked(), ProtocolErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattDescriptorsResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattDescriptorsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattDescriptorsResult *wrapperInstance = new GattDescriptorsResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattDescriptorsResult(winRtInstance));
}
static void DescriptorsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^>(info.This()))
{
return;
}
GattDescriptorsResult *wrapper = GattDescriptorsResult::Unwrap<GattDescriptorsResult>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>^ result = wrapper->_instance->Descriptors;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ val) -> Local<Value> {
return WrapGattDescriptor(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptor^ {
return UnwrapGattDescriptor(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ProtocolErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^>(info.This()))
{
return;
}
GattDescriptorsResult *wrapper = GattDescriptorsResult::Unwrap<GattDescriptorsResult>(info.This());
try
{
::Platform::IBox<unsigned char>^ result = wrapper->_instance->ProtocolError;
info.GetReturnValue().Set(result ? static_cast<Local<Value>>(Nan::New<Integer>(result->Value)) : Undefined());
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^>(info.This()))
{
return;
}
GattDescriptorsResult *wrapper = GattDescriptorsResult::Unwrap<GattDescriptorsResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattDescriptorsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ UnwrapGattDescriptorsResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattDescriptorsResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattDescriptorsResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattDescriptorsResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorsResult^ UnwrapGattDescriptorsResult(Local<Value> value)
{
return GattDescriptorsResult::Unwrap<GattDescriptorsResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattDescriptorsResult(Local<Object> exports)
{
GattDescriptorsResult::Init(exports);
}
class GattWriteResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattWriteResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protocolError").ToLocalChecked(), ProtocolErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattWriteResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattWriteResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattWriteResult *wrapperInstance = new GattWriteResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattWriteResult(winRtInstance));
}
static void ProtocolErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>(info.This()))
{
return;
}
GattWriteResult *wrapper = GattWriteResult::Unwrap<GattWriteResult>(info.This());
try
{
::Platform::IBox<unsigned char>^ result = wrapper->_instance->ProtocolError;
info.GetReturnValue().Set(result ? static_cast<Local<Value>>(Nan::New<Integer>(result->Value)) : Undefined());
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>(info.This()))
{
return;
}
GattWriteResult *wrapper = GattWriteResult::Unwrap<GattWriteResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattWriteResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ UnwrapGattWriteResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattWriteResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattWriteResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattWriteResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^ UnwrapGattWriteResult(Local<Value> value)
{
return GattWriteResult::Unwrap<GattWriteResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattWriteResult(Local<Object> exports)
{
GattWriteResult::Init(exports);
}
class GattPresentationFormatTypes : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattPresentationFormatTypes").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetAccessor(constructor, Nan::New<String>("bit2").ToLocalChecked(), Bit2Getter);
Nan::SetAccessor(constructor, Nan::New<String>("boolean").ToLocalChecked(), BooleanGetter);
Nan::SetAccessor(constructor, Nan::New<String>("dUInt16").ToLocalChecked(), DUInt16Getter);
Nan::SetAccessor(constructor, Nan::New<String>("float").ToLocalChecked(), FloatGetter);
Nan::SetAccessor(constructor, Nan::New<String>("float32").ToLocalChecked(), Float32Getter);
Nan::SetAccessor(constructor, Nan::New<String>("float64").ToLocalChecked(), Float64Getter);
Nan::SetAccessor(constructor, Nan::New<String>("nibble").ToLocalChecked(), NibbleGetter);
Nan::SetAccessor(constructor, Nan::New<String>("sFloat").ToLocalChecked(), SFloatGetter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt12").ToLocalChecked(), SInt12Getter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt128").ToLocalChecked(), SInt128Getter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt16").ToLocalChecked(), SInt16Getter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt24").ToLocalChecked(), SInt24Getter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt32").ToLocalChecked(), SInt32Getter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt48").ToLocalChecked(), SInt48Getter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt64").ToLocalChecked(), SInt64Getter);
Nan::SetAccessor(constructor, Nan::New<String>("sInt8").ToLocalChecked(), SInt8Getter);
Nan::SetAccessor(constructor, Nan::New<String>("struct").ToLocalChecked(), StructGetter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt12").ToLocalChecked(), UInt12Getter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt128").ToLocalChecked(), UInt128Getter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt16").ToLocalChecked(), UInt16Getter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt24").ToLocalChecked(), UInt24Getter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt32").ToLocalChecked(), UInt32Getter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt48").ToLocalChecked(), UInt48Getter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt64").ToLocalChecked(), UInt64Getter);
Nan::SetAccessor(constructor, Nan::New<String>("uInt8").ToLocalChecked(), UInt8Getter);
Nan::SetAccessor(constructor, Nan::New<String>("utf16").ToLocalChecked(), Utf16Getter);
Nan::SetAccessor(constructor, Nan::New<String>("utf8").ToLocalChecked(), Utf8Getter);
Nan::Set(exports, Nan::New<String>("GattPresentationFormatTypes").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattPresentationFormatTypes(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattPresentationFormatTypes *wrapperInstance = new GattPresentationFormatTypes(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattPresentationFormatTypes(winRtInstance));
}
static void Bit2Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Bit2;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BooleanGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Boolean;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DUInt16Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::DUInt16;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void FloatGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Float;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void Float32Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Float32;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void Float64Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Float64;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void NibbleGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Nibble;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SFloatGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SFloat;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt12Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt12;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt128Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt128;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt16Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt16;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt24Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt24;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt32Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt32;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt48Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt48;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt64Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt64;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SInt8Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::SInt8;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StructGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Struct;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt12Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt12;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt128Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt128;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt16Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt16;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt24Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt24;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt32Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt32;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt48Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt48;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt64Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt64;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UInt8Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::UInt8;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void Utf16Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Utf16;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void Utf8Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
unsigned char result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes::Utf8;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattPresentationFormatTypes(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ UnwrapGattPresentationFormatTypes(Local<Value> value);
};
Persistent<FunctionTemplate> GattPresentationFormatTypes::s_constructorTemplate;
v8::Local<v8::Value> WrapGattPresentationFormatTypes(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattPresentationFormatTypes::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormatTypes^ UnwrapGattPresentationFormatTypes(Local<Value> value)
{
return GattPresentationFormatTypes::Unwrap<GattPresentationFormatTypes>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattPresentationFormatTypes(Local<Object> exports)
{
GattPresentationFormatTypes::Init(exports);
}
class GattServiceUuids : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattServiceUuids").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetAccessor(constructor, Nan::New<String>("cyclingSpeedAndCadence").ToLocalChecked(), CyclingSpeedAndCadenceGetter);
Nan::SetAccessor(constructor, Nan::New<String>("battery").ToLocalChecked(), BatteryGetter);
Nan::SetAccessor(constructor, Nan::New<String>("bloodPressure").ToLocalChecked(), BloodPressureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("genericAccess").ToLocalChecked(), GenericAccessGetter);
Nan::SetAccessor(constructor, Nan::New<String>("genericAttribute").ToLocalChecked(), GenericAttributeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("glucose").ToLocalChecked(), GlucoseGetter);
Nan::SetAccessor(constructor, Nan::New<String>("healthThermometer").ToLocalChecked(), HealthThermometerGetter);
Nan::SetAccessor(constructor, Nan::New<String>("heartRate").ToLocalChecked(), HeartRateGetter);
Nan::SetAccessor(constructor, Nan::New<String>("runningSpeedAndCadence").ToLocalChecked(), RunningSpeedAndCadenceGetter);
Nan::SetAccessor(constructor, Nan::New<String>("nextDstChange").ToLocalChecked(), NextDstChangeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("alertNotification").ToLocalChecked(), AlertNotificationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("currentTime").ToLocalChecked(), CurrentTimeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("cyclingPower").ToLocalChecked(), CyclingPowerGetter);
Nan::SetAccessor(constructor, Nan::New<String>("deviceInformation").ToLocalChecked(), DeviceInformationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("humanInterfaceDevice").ToLocalChecked(), HumanInterfaceDeviceGetter);
Nan::SetAccessor(constructor, Nan::New<String>("immediateAlert").ToLocalChecked(), ImmediateAlertGetter);
Nan::SetAccessor(constructor, Nan::New<String>("linkLoss").ToLocalChecked(), LinkLossGetter);
Nan::SetAccessor(constructor, Nan::New<String>("locationAndNavigation").ToLocalChecked(), LocationAndNavigationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("phoneAlertStatus").ToLocalChecked(), PhoneAlertStatusGetter);
Nan::SetAccessor(constructor, Nan::New<String>("referenceTimeUpdate").ToLocalChecked(), ReferenceTimeUpdateGetter);
Nan::SetAccessor(constructor, Nan::New<String>("scanParameters").ToLocalChecked(), ScanParametersGetter);
Nan::SetAccessor(constructor, Nan::New<String>("txPower").ToLocalChecked(), TxPowerGetter);
Nan::Set(exports, Nan::New<String>("GattServiceUuids").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattServiceUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattServiceUuids *wrapperInstance = new GattServiceUuids(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattServiceUuids(winRtInstance));
}
static void CyclingSpeedAndCadenceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::CyclingSpeedAndCadence;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BatteryGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::Battery;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BloodPressureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::BloodPressure;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GenericAccessGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::GenericAccess;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GenericAttributeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::GenericAttribute;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GlucoseGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::Glucose;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HealthThermometerGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::HealthThermometer;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HeartRateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::HeartRate;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void RunningSpeedAndCadenceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::RunningSpeedAndCadence;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void NextDstChangeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::NextDstChange;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AlertNotificationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::AlertNotification;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CurrentTimeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::CurrentTime;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CyclingPowerGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::CyclingPower;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DeviceInformationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::DeviceInformation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HumanInterfaceDeviceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::HumanInterfaceDevice;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ImmediateAlertGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::ImmediateAlert;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void LinkLossGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::LinkLoss;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void LocationAndNavigationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::LocationAndNavigation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void PhoneAlertStatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::PhoneAlertStatus;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReferenceTimeUpdateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::ReferenceTimeUpdate;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ScanParametersGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::ScanParameters;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TxPowerGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids::TxPower;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattServiceUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ UnwrapGattServiceUuids(Local<Value> value);
};
Persistent<FunctionTemplate> GattServiceUuids::s_constructorTemplate;
v8::Local<v8::Value> WrapGattServiceUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattServiceUuids::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceUuids^ UnwrapGattServiceUuids(Local<Value> value)
{
return GattServiceUuids::Unwrap<GattServiceUuids>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattServiceUuids(Local<Object> exports)
{
GattServiceUuids::Init(exports);
}
class GattCharacteristicUuids : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattCharacteristicUuids").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetAccessor(constructor, Nan::New<String>("batteryLevel").ToLocalChecked(), BatteryLevelGetter);
Nan::SetAccessor(constructor, Nan::New<String>("bloodPressureFeature").ToLocalChecked(), BloodPressureFeatureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("bloodPressureMeasurement").ToLocalChecked(), BloodPressureMeasurementGetter);
Nan::SetAccessor(constructor, Nan::New<String>("bodySensorLocation").ToLocalChecked(), BodySensorLocationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("cscFeature").ToLocalChecked(), CscFeatureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("cscMeasurement").ToLocalChecked(), CscMeasurementGetter);
Nan::SetAccessor(constructor, Nan::New<String>("glucoseFeature").ToLocalChecked(), GlucoseFeatureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("glucoseMeasurement").ToLocalChecked(), GlucoseMeasurementGetter);
Nan::SetAccessor(constructor, Nan::New<String>("glucoseMeasurementContext").ToLocalChecked(), GlucoseMeasurementContextGetter);
Nan::SetAccessor(constructor, Nan::New<String>("heartRateControlPoint").ToLocalChecked(), HeartRateControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("heartRateMeasurement").ToLocalChecked(), HeartRateMeasurementGetter);
Nan::SetAccessor(constructor, Nan::New<String>("intermediateCuffPressure").ToLocalChecked(), IntermediateCuffPressureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("intermediateTemperature").ToLocalChecked(), IntermediateTemperatureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("measurementInterval").ToLocalChecked(), MeasurementIntervalGetter);
Nan::SetAccessor(constructor, Nan::New<String>("recordAccessControlPoint").ToLocalChecked(), RecordAccessControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("rscFeature").ToLocalChecked(), RscFeatureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("rscMeasurement").ToLocalChecked(), RscMeasurementGetter);
Nan::SetAccessor(constructor, Nan::New<String>("sCControlPoint").ToLocalChecked(), SCControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("sensorLocation").ToLocalChecked(), SensorLocationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("temperatureMeasurement").ToLocalChecked(), TemperatureMeasurementGetter);
Nan::SetAccessor(constructor, Nan::New<String>("temperatureType").ToLocalChecked(), TemperatureTypeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("lnFeature").ToLocalChecked(), LnFeatureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("alertCategoryId").ToLocalChecked(), AlertCategoryIdGetter);
Nan::SetAccessor(constructor, Nan::New<String>("alertCategoryIdBitMask").ToLocalChecked(), AlertCategoryIdBitMaskGetter);
Nan::SetAccessor(constructor, Nan::New<String>("alertLevel").ToLocalChecked(), AlertLevelGetter);
Nan::SetAccessor(constructor, Nan::New<String>("alertNotificationControlPoint").ToLocalChecked(), AlertNotificationControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("alertStatus").ToLocalChecked(), AlertStatusGetter);
Nan::SetAccessor(constructor, Nan::New<String>("bootKeyboardInputReport").ToLocalChecked(), BootKeyboardInputReportGetter);
Nan::SetAccessor(constructor, Nan::New<String>("bootKeyboardOutputReport").ToLocalChecked(), BootKeyboardOutputReportGetter);
Nan::SetAccessor(constructor, Nan::New<String>("bootMouseInputReport").ToLocalChecked(), BootMouseInputReportGetter);
Nan::SetAccessor(constructor, Nan::New<String>("currentTime").ToLocalChecked(), CurrentTimeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("cyclingPowerControlPoint").ToLocalChecked(), CyclingPowerControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("cyclingPowerFeature").ToLocalChecked(), CyclingPowerFeatureGetter);
Nan::SetAccessor(constructor, Nan::New<String>("cyclingPowerMeasurement").ToLocalChecked(), CyclingPowerMeasurementGetter);
Nan::SetAccessor(constructor, Nan::New<String>("cyclingPowerVector").ToLocalChecked(), CyclingPowerVectorGetter);
Nan::SetAccessor(constructor, Nan::New<String>("dateTime").ToLocalChecked(), DateTimeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("dayDateTime").ToLocalChecked(), DayDateTimeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("dayOfWeek").ToLocalChecked(), DayOfWeekGetter);
Nan::SetAccessor(constructor, Nan::New<String>("dstOffset").ToLocalChecked(), DstOffsetGetter);
Nan::SetAccessor(constructor, Nan::New<String>("exactTime256").ToLocalChecked(), ExactTime256Getter);
Nan::SetAccessor(constructor, Nan::New<String>("firmwareRevisionString").ToLocalChecked(), FirmwareRevisionStringGetter);
Nan::SetAccessor(constructor, Nan::New<String>("gapAppearance").ToLocalChecked(), GapAppearanceGetter);
Nan::SetAccessor(constructor, Nan::New<String>("gapDeviceName").ToLocalChecked(), GapDeviceNameGetter);
Nan::SetAccessor(constructor, Nan::New<String>("gapPeripheralPreferredConnectionParameters").ToLocalChecked(), GapPeripheralPreferredConnectionParametersGetter);
Nan::SetAccessor(constructor, Nan::New<String>("gapPeripheralPrivacyFlag").ToLocalChecked(), GapPeripheralPrivacyFlagGetter);
Nan::SetAccessor(constructor, Nan::New<String>("gapReconnectionAddress").ToLocalChecked(), GapReconnectionAddressGetter);
Nan::SetAccessor(constructor, Nan::New<String>("gattServiceChanged").ToLocalChecked(), GattServiceChangedGetter);
Nan::SetAccessor(constructor, Nan::New<String>("hardwareRevisionString").ToLocalChecked(), HardwareRevisionStringGetter);
Nan::SetAccessor(constructor, Nan::New<String>("hidControlPoint").ToLocalChecked(), HidControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("hidInformation").ToLocalChecked(), HidInformationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("ieee1107320601RegulatoryCertificationDataList").ToLocalChecked(), Ieee1107320601RegulatoryCertificationDataListGetter);
Nan::SetAccessor(constructor, Nan::New<String>("lnControlPoint").ToLocalChecked(), LnControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("localTimeInformation").ToLocalChecked(), LocalTimeInformationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("locationAndSpeed").ToLocalChecked(), LocationAndSpeedGetter);
Nan::SetAccessor(constructor, Nan::New<String>("manufacturerNameString").ToLocalChecked(), ManufacturerNameStringGetter);
Nan::SetAccessor(constructor, Nan::New<String>("modelNumberString").ToLocalChecked(), ModelNumberStringGetter);
Nan::SetAccessor(constructor, Nan::New<String>("navigation").ToLocalChecked(), NavigationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("newAlert").ToLocalChecked(), NewAlertGetter);
Nan::SetAccessor(constructor, Nan::New<String>("pnpId").ToLocalChecked(), PnpIdGetter);
Nan::SetAccessor(constructor, Nan::New<String>("positionQuality").ToLocalChecked(), PositionQualityGetter);
Nan::SetAccessor(constructor, Nan::New<String>("protocolMode").ToLocalChecked(), ProtocolModeGetter);
Nan::SetAccessor(constructor, Nan::New<String>("referenceTimeInformation").ToLocalChecked(), ReferenceTimeInformationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("report").ToLocalChecked(), ReportGetter);
Nan::SetAccessor(constructor, Nan::New<String>("reportMap").ToLocalChecked(), ReportMapGetter);
Nan::SetAccessor(constructor, Nan::New<String>("ringerControlPoint").ToLocalChecked(), RingerControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("ringerSetting").ToLocalChecked(), RingerSettingGetter);
Nan::SetAccessor(constructor, Nan::New<String>("scanIntervalWindow").ToLocalChecked(), ScanIntervalWindowGetter);
Nan::SetAccessor(constructor, Nan::New<String>("scanRefresh").ToLocalChecked(), ScanRefreshGetter);
Nan::SetAccessor(constructor, Nan::New<String>("serialNumberString").ToLocalChecked(), SerialNumberStringGetter);
Nan::SetAccessor(constructor, Nan::New<String>("softwareRevisionString").ToLocalChecked(), SoftwareRevisionStringGetter);
Nan::SetAccessor(constructor, Nan::New<String>("supportUnreadAlertCategory").ToLocalChecked(), SupportUnreadAlertCategoryGetter);
Nan::SetAccessor(constructor, Nan::New<String>("supportedNewAlertCategory").ToLocalChecked(), SupportedNewAlertCategoryGetter);
Nan::SetAccessor(constructor, Nan::New<String>("systemId").ToLocalChecked(), SystemIdGetter);
Nan::SetAccessor(constructor, Nan::New<String>("timeAccuracy").ToLocalChecked(), TimeAccuracyGetter);
Nan::SetAccessor(constructor, Nan::New<String>("timeSource").ToLocalChecked(), TimeSourceGetter);
Nan::SetAccessor(constructor, Nan::New<String>("timeUpdateControlPoint").ToLocalChecked(), TimeUpdateControlPointGetter);
Nan::SetAccessor(constructor, Nan::New<String>("timeUpdateState").ToLocalChecked(), TimeUpdateStateGetter);
Nan::SetAccessor(constructor, Nan::New<String>("timeWithDst").ToLocalChecked(), TimeWithDstGetter);
Nan::SetAccessor(constructor, Nan::New<String>("timeZone").ToLocalChecked(), TimeZoneGetter);
Nan::SetAccessor(constructor, Nan::New<String>("txPowerLevel").ToLocalChecked(), TxPowerLevelGetter);
Nan::SetAccessor(constructor, Nan::New<String>("unreadAlertStatus").ToLocalChecked(), UnreadAlertStatusGetter);
Nan::Set(exports, Nan::New<String>("GattCharacteristicUuids").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattCharacteristicUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattCharacteristicUuids *wrapperInstance = new GattCharacteristicUuids(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattCharacteristicUuids(winRtInstance));
}
static void BatteryLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::BatteryLevel;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BloodPressureFeatureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::BloodPressureFeature;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BloodPressureMeasurementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::BloodPressureMeasurement;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BodySensorLocationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::BodySensorLocation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CscFeatureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::CscFeature;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CscMeasurementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::CscMeasurement;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GlucoseFeatureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GlucoseFeature;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GlucoseMeasurementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GlucoseMeasurement;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GlucoseMeasurementContextGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GlucoseMeasurementContext;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HeartRateControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::HeartRateControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HeartRateMeasurementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::HeartRateMeasurement;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void IntermediateCuffPressureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::IntermediateCuffPressure;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void IntermediateTemperatureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::IntermediateTemperature;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void MeasurementIntervalGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::MeasurementInterval;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void RecordAccessControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::RecordAccessControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void RscFeatureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::RscFeature;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void RscMeasurementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::RscMeasurement;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SCControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::SCControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SensorLocationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::SensorLocation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TemperatureMeasurementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TemperatureMeasurement;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TemperatureTypeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TemperatureType;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void LnFeatureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::LnFeature;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AlertCategoryIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::AlertCategoryId;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AlertCategoryIdBitMaskGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::AlertCategoryIdBitMask;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AlertLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::AlertLevel;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AlertNotificationControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::AlertNotificationControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AlertStatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::AlertStatus;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BootKeyboardInputReportGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::BootKeyboardInputReport;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BootKeyboardOutputReportGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::BootKeyboardOutputReport;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void BootMouseInputReportGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::BootMouseInputReport;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CurrentTimeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::CurrentTime;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CyclingPowerControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::CyclingPowerControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CyclingPowerFeatureGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::CyclingPowerFeature;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CyclingPowerMeasurementGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::CyclingPowerMeasurement;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CyclingPowerVectorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::CyclingPowerVector;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DateTimeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::DateTime;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DayDateTimeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::DayDateTime;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DayOfWeekGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::DayOfWeek;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DstOffsetGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::DstOffset;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ExactTime256Getter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ExactTime256;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void FirmwareRevisionStringGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::FirmwareRevisionString;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GapAppearanceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GapAppearance;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GapDeviceNameGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GapDeviceName;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GapPeripheralPreferredConnectionParametersGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GapPeripheralPreferredConnectionParameters;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GapPeripheralPrivacyFlagGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GapPeripheralPrivacyFlag;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GapReconnectionAddressGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GapReconnectionAddress;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void GattServiceChangedGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::GattServiceChanged;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HardwareRevisionStringGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::HardwareRevisionString;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HidControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::HidControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void HidInformationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::HidInformation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void Ieee1107320601RegulatoryCertificationDataListGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::Ieee1107320601RegulatoryCertificationDataList;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void LnControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::LnControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void LocalTimeInformationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::LocalTimeInformation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void LocationAndSpeedGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::LocationAndSpeed;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ManufacturerNameStringGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ManufacturerNameString;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ModelNumberStringGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ModelNumberString;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void NavigationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::Navigation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void NewAlertGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::NewAlert;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void PnpIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::PnpId;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void PositionQualityGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::PositionQuality;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ProtocolModeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ProtocolMode;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReferenceTimeInformationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ReferenceTimeInformation;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReportGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::Report;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReportMapGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ReportMap;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void RingerControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::RingerControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void RingerSettingGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::RingerSetting;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ScanIntervalWindowGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ScanIntervalWindow;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ScanRefreshGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::ScanRefresh;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SerialNumberStringGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::SerialNumberString;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SoftwareRevisionStringGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::SoftwareRevisionString;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SupportUnreadAlertCategoryGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::SupportUnreadAlertCategory;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SupportedNewAlertCategoryGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::SupportedNewAlertCategory;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SystemIdGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::SystemId;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TimeAccuracyGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TimeAccuracy;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TimeSourceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TimeSource;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TimeUpdateControlPointGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TimeUpdateControlPoint;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TimeUpdateStateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TimeUpdateState;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TimeWithDstGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TimeWithDst;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TimeZoneGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TimeZone;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void TxPowerLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::TxPowerLevel;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UnreadAlertStatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids::UnreadAlertStatus;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattCharacteristicUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ UnwrapGattCharacteristicUuids(Local<Value> value);
};
Persistent<FunctionTemplate> GattCharacteristicUuids::s_constructorTemplate;
v8::Local<v8::Value> WrapGattCharacteristicUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattCharacteristicUuids::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicUuids^ UnwrapGattCharacteristicUuids(Local<Value> value)
{
return GattCharacteristicUuids::Unwrap<GattCharacteristicUuids>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattCharacteristicUuids(Local<Object> exports)
{
GattCharacteristicUuids::Init(exports);
}
class GattDescriptorUuids : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattDescriptorUuids").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::SetAccessor(constructor, Nan::New<String>("characteristicAggregateFormat").ToLocalChecked(), CharacteristicAggregateFormatGetter);
Nan::SetAccessor(constructor, Nan::New<String>("characteristicExtendedProperties").ToLocalChecked(), CharacteristicExtendedPropertiesGetter);
Nan::SetAccessor(constructor, Nan::New<String>("characteristicPresentationFormat").ToLocalChecked(), CharacteristicPresentationFormatGetter);
Nan::SetAccessor(constructor, Nan::New<String>("characteristicUserDescription").ToLocalChecked(), CharacteristicUserDescriptionGetter);
Nan::SetAccessor(constructor, Nan::New<String>("clientCharacteristicConfiguration").ToLocalChecked(), ClientCharacteristicConfigurationGetter);
Nan::SetAccessor(constructor, Nan::New<String>("serverCharacteristicConfiguration").ToLocalChecked(), ServerCharacteristicConfigurationGetter);
Nan::Set(exports, Nan::New<String>("GattDescriptorUuids").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattDescriptorUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattDescriptorUuids *wrapperInstance = new GattDescriptorUuids(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattDescriptorUuids(winRtInstance));
}
static void CharacteristicAggregateFormatGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids::CharacteristicAggregateFormat;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CharacteristicExtendedPropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids::CharacteristicExtendedProperties;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CharacteristicPresentationFormatGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids::CharacteristicPresentationFormat;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CharacteristicUserDescriptionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids::CharacteristicUserDescription;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ClientCharacteristicConfigurationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids::ClientCharacteristicConfiguration;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ServerCharacteristicConfigurationGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
try
{
::Platform::Guid result = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids::ServerCharacteristicConfiguration;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattDescriptorUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ UnwrapGattDescriptorUuids(Local<Value> value);
};
Persistent<FunctionTemplate> GattDescriptorUuids::s_constructorTemplate;
v8::Local<v8::Value> WrapGattDescriptorUuids(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattDescriptorUuids::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattDescriptorUuids^ UnwrapGattDescriptorUuids(Local<Value> value)
{
return GattDescriptorUuids::Unwrap<GattDescriptorUuids>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattDescriptorUuids(Local<Object> exports)
{
GattDescriptorUuids::Init(exports);
}
class GattReliableWriteTransaction : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattReliableWriteTransaction").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "writeValue", WriteValue);
Nan::SetPrototypeMethod(localRef, "commitAsync", CommitAsync);
Nan::SetPrototypeMethod(localRef, "commitWithResultAsync", CommitWithResultAsync);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattReliableWriteTransaction").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattReliableWriteTransaction(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 0)
{
try
{
winRtInstance = ref new ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattReliableWriteTransaction *wrapperInstance = new GattReliableWriteTransaction(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattReliableWriteTransaction(winRtInstance));
}
static void CommitAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattReliableWriteTransaction *wrapper = GattReliableWriteTransaction::Unwrap<GattReliableWriteTransaction>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->CommitAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = Nan::New<Integer>(static_cast<int>(result));
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void CommitWithResultAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattReliableWriteTransaction *wrapper = GattReliableWriteTransaction::Unwrap<GattReliableWriteTransaction>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->CommitWithResultAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattWriteResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void WriteValue(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^>(info.This()))
{
return;
}
GattReliableWriteTransaction *wrapper = GattReliableWriteTransaction::Unwrap<GattReliableWriteTransaction>(info.This());
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^>(info[0])
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[1]))
{
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristic^ arg0 = UnwrapGattCharacteristic(info[0]);
::Windows::Storage::Streams::IBuffer^ arg1 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[1]));
wrapper->_instance->WriteValue(arg0, arg1);
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattReliableWriteTransaction(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ UnwrapGattReliableWriteTransaction(Local<Value> value);
};
Persistent<FunctionTemplate> GattReliableWriteTransaction::s_constructorTemplate;
v8::Local<v8::Value> WrapGattReliableWriteTransaction(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattReliableWriteTransaction::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReliableWriteTransaction^ UnwrapGattReliableWriteTransaction(Local<Value> value)
{
return GattReliableWriteTransaction::Unwrap<GattReliableWriteTransaction>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattReliableWriteTransaction(Local<Object> exports)
{
GattReliableWriteTransaction::Init(exports);
}
class GattServiceProviderAdvertisingParameters : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattServiceProviderAdvertisingParameters").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("isDiscoverable").ToLocalChecked(), IsDiscoverableGetter, IsDiscoverableSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("isConnectable").ToLocalChecked(), IsConnectableGetter, IsConnectableSetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattServiceProviderAdvertisingParameters").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattServiceProviderAdvertisingParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 0)
{
try
{
winRtInstance = ref new ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattServiceProviderAdvertisingParameters *wrapperInstance = new GattServiceProviderAdvertisingParameters(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattServiceProviderAdvertisingParameters(winRtInstance));
}
static void IsDiscoverableGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(info.This()))
{
return;
}
GattServiceProviderAdvertisingParameters *wrapper = GattServiceProviderAdvertisingParameters::Unwrap<GattServiceProviderAdvertisingParameters>(info.This());
try
{
bool result = wrapper->_instance->IsDiscoverable;
info.GetReturnValue().Set(Nan::New<Boolean>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void IsDiscoverableSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsBoolean())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(info.This()))
{
return;
}
GattServiceProviderAdvertisingParameters *wrapper = GattServiceProviderAdvertisingParameters::Unwrap<GattServiceProviderAdvertisingParameters>(info.This());
try
{
bool winRtValue = Nan::To<bool>(value).FromMaybe(false);
wrapper->_instance->IsDiscoverable = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void IsConnectableGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(info.This()))
{
return;
}
GattServiceProviderAdvertisingParameters *wrapper = GattServiceProviderAdvertisingParameters::Unwrap<GattServiceProviderAdvertisingParameters>(info.This());
try
{
bool result = wrapper->_instance->IsConnectable;
info.GetReturnValue().Set(Nan::New<Boolean>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void IsConnectableSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsBoolean())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(info.This()))
{
return;
}
GattServiceProviderAdvertisingParameters *wrapper = GattServiceProviderAdvertisingParameters::Unwrap<GattServiceProviderAdvertisingParameters>(info.This());
try
{
bool winRtValue = Nan::To<bool>(value).FromMaybe(false);
wrapper->_instance->IsConnectable = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattServiceProviderAdvertisingParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ UnwrapGattServiceProviderAdvertisingParameters(Local<Value> value);
};
Persistent<FunctionTemplate> GattServiceProviderAdvertisingParameters::s_constructorTemplate;
v8::Local<v8::Value> WrapGattServiceProviderAdvertisingParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattServiceProviderAdvertisingParameters::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ UnwrapGattServiceProviderAdvertisingParameters(Local<Value> value)
{
return GattServiceProviderAdvertisingParameters::Unwrap<GattServiceProviderAdvertisingParameters>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattServiceProviderAdvertisingParameters(Local<Object> exports)
{
GattServiceProviderAdvertisingParameters::Init(exports);
}
class GattLocalCharacteristicParameters : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattLocalCharacteristicParameters").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("writeProtectionLevel").ToLocalChecked(), WriteProtectionLevelGetter, WriteProtectionLevelSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("userDescription").ToLocalChecked(), UserDescriptionGetter, UserDescriptionSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("staticValue").ToLocalChecked(), StaticValueGetter, StaticValueSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("readProtectionLevel").ToLocalChecked(), ReadProtectionLevelGetter, ReadProtectionLevelSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristicProperties").ToLocalChecked(), CharacteristicPropertiesGetter, CharacteristicPropertiesSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("presentationFormats").ToLocalChecked(), PresentationFormatsGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattLocalCharacteristicParameters").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattLocalCharacteristicParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 0)
{
try
{
winRtInstance = ref new ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattLocalCharacteristicParameters *wrapperInstance = new GattLocalCharacteristicParameters(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattLocalCharacteristicParameters(winRtInstance));
}
static void WriteProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->WriteProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void WriteProtectionLevelSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsInt32())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel winRtValue = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel>(Nan::To<int32_t>(value).FromMaybe(0));
wrapper->_instance->WriteProtectionLevel = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void UserDescriptionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
Platform::String^ result = wrapper->_instance->UserDescription;
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UserDescriptionSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsString())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
Platform::String^ winRtValue = ref new Platform::String(NodeRT::Utils::StringToWchar(v8::String::Value(value)));
wrapper->_instance->UserDescription = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void StaticValueGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ result = wrapper->_instance->StaticValue;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IBuffer", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StaticValueSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(value))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ winRtValue = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(value));
wrapper->_instance->StaticValue = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void ReadProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->ReadProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReadProtectionLevelSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsInt32())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel winRtValue = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel>(Nan::To<int32_t>(value).FromMaybe(0));
wrapper->_instance->ReadProtectionLevel = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void CharacteristicPropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties result = wrapper->_instance->CharacteristicProperties;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void CharacteristicPropertiesSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsInt32())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties winRtValue = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties>(Nan::To<int32_t>(value).FromMaybe(0));
wrapper->_instance->CharacteristicProperties = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void PresentationFormatsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info.This()))
{
return;
}
GattLocalCharacteristicParameters *wrapper = GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(info.This());
try
{
::Windows::Foundation::Collections::IVector<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>^ result = wrapper->_instance->PresentationFormats;
info.GetReturnValue().Set(NodeRT::Collections::VectorWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>::CreateVectorWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ val) -> Local<Value> {
return WrapGattPresentationFormat(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ {
return UnwrapGattPresentationFormat(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattLocalCharacteristicParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ UnwrapGattLocalCharacteristicParameters(Local<Value> value);
};
Persistent<FunctionTemplate> GattLocalCharacteristicParameters::s_constructorTemplate;
v8::Local<v8::Value> WrapGattLocalCharacteristicParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattLocalCharacteristicParameters::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ UnwrapGattLocalCharacteristicParameters(Local<Value> value)
{
return GattLocalCharacteristicParameters::Unwrap<GattLocalCharacteristicParameters>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattLocalCharacteristicParameters(Local<Object> exports)
{
GattLocalCharacteristicParameters::Init(exports);
}
class GattLocalDescriptorParameters : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattLocalDescriptorParameters").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("writeProtectionLevel").ToLocalChecked(), WriteProtectionLevelGetter, WriteProtectionLevelSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("staticValue").ToLocalChecked(), StaticValueGetter, StaticValueSetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("readProtectionLevel").ToLocalChecked(), ReadProtectionLevelGetter, ReadProtectionLevelSetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattLocalDescriptorParameters").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattLocalDescriptorParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 0)
{
try
{
winRtInstance = ref new ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattLocalDescriptorParameters *wrapperInstance = new GattLocalDescriptorParameters(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattLocalDescriptorParameters(winRtInstance));
}
static void WriteProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info.This()))
{
return;
}
GattLocalDescriptorParameters *wrapper = GattLocalDescriptorParameters::Unwrap<GattLocalDescriptorParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->WriteProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void WriteProtectionLevelSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsInt32())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info.This()))
{
return;
}
GattLocalDescriptorParameters *wrapper = GattLocalDescriptorParameters::Unwrap<GattLocalDescriptorParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel winRtValue = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel>(Nan::To<int32_t>(value).FromMaybe(0));
wrapper->_instance->WriteProtectionLevel = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void StaticValueGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info.This()))
{
return;
}
GattLocalDescriptorParameters *wrapper = GattLocalDescriptorParameters::Unwrap<GattLocalDescriptorParameters>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ result = wrapper->_instance->StaticValue;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IBuffer", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StaticValueSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(value))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info.This()))
{
return;
}
GattLocalDescriptorParameters *wrapper = GattLocalDescriptorParameters::Unwrap<GattLocalDescriptorParameters>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ winRtValue = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(value));
wrapper->_instance->StaticValue = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
static void ReadProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info.This()))
{
return;
}
GattLocalDescriptorParameters *wrapper = GattLocalDescriptorParameters::Unwrap<GattLocalDescriptorParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->ReadProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReadProtectionLevelSetter(Local<String> property, Local<Value> value, const Nan::PropertyCallbackInfo<void> &info)
{
HandleScope scope;
if (!value->IsInt32())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Value to set is of unexpected type")));
return;
}
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info.This()))
{
return;
}
GattLocalDescriptorParameters *wrapper = GattLocalDescriptorParameters::Unwrap<GattLocalDescriptorParameters>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel winRtValue = static_cast<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel>(Nan::To<int32_t>(value).FromMaybe(0));
wrapper->_instance->ReadProtectionLevel = winRtValue;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattLocalDescriptorParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ UnwrapGattLocalDescriptorParameters(Local<Value> value);
};
Persistent<FunctionTemplate> GattLocalDescriptorParameters::s_constructorTemplate;
v8::Local<v8::Value> WrapGattLocalDescriptorParameters(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattLocalDescriptorParameters::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ UnwrapGattLocalDescriptorParameters(Local<Value> value)
{
return GattLocalDescriptorParameters::Unwrap<GattLocalDescriptorParameters>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattLocalDescriptorParameters(Local<Object> exports)
{
GattLocalDescriptorParameters::Init(exports);
}
class GattServiceProviderResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattServiceProviderResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("error").ToLocalChecked(), ErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("serviceProvider").ToLocalChecked(), ServiceProviderGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattServiceProviderResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattServiceProviderResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattServiceProviderResult *wrapperInstance = new GattServiceProviderResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattServiceProviderResult(winRtInstance));
}
static void ErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^>(info.This()))
{
return;
}
GattServiceProviderResult *wrapper = GattServiceProviderResult::Unwrap<GattServiceProviderResult>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothError result = wrapper->_instance->Error;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ServiceProviderGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^>(info.This()))
{
return;
}
GattServiceProviderResult *wrapper = GattServiceProviderResult::Unwrap<GattServiceProviderResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ result = wrapper->_instance->ServiceProvider;
info.GetReturnValue().Set(WrapGattServiceProvider(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattServiceProviderResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ UnwrapGattServiceProviderResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattServiceProviderResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattServiceProviderResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattServiceProviderResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^ UnwrapGattServiceProviderResult(Local<Value> value)
{
return GattServiceProviderResult::Unwrap<GattServiceProviderResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattServiceProviderResult(Local<Object> exports)
{
GattServiceProviderResult::Init(exports);
}
class GattLocalService : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattLocalService").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "createCharacteristicAsync", CreateCharacteristicAsync);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristics").ToLocalChecked(), CharacteristicsGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("uuid").ToLocalChecked(), UuidGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattLocalService").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattLocalService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattLocalService *wrapperInstance = new GattLocalService(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattLocalService(winRtInstance));
}
static void CreateCharacteristicAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattLocalService *wrapper = GattLocalService::Unwrap<GattLocalService>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^>^ op;
if (info.Length() == 3
&& NodeRT::Utils::IsGuid(info[0])
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^>(info[1]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicParameters^ arg1 = UnwrapGattLocalCharacteristicParameters(info[1]);
op = wrapper->_instance->CreateCharacteristicAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattLocalCharacteristicResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void CharacteristicsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^>(info.This()))
{
return;
}
GattLocalService *wrapper = GattLocalService::Unwrap<GattLocalService>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>^ result = wrapper->_instance->Characteristics;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ val) -> Local<Value> {
return WrapGattLocalCharacteristic(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ {
return UnwrapGattLocalCharacteristic(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UuidGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^>(info.This()))
{
return;
}
GattLocalService *wrapper = GattLocalService::Unwrap<GattLocalService>(info.This());
try
{
::Platform::Guid result = wrapper->_instance->Uuid;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattLocalService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ UnwrapGattLocalService(Local<Value> value);
};
Persistent<FunctionTemplate> GattLocalService::s_constructorTemplate;
v8::Local<v8::Value> WrapGattLocalService(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattLocalService::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ UnwrapGattLocalService(Local<Value> value)
{
return GattLocalService::Unwrap<GattLocalService>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattLocalService(Local<Object> exports)
{
GattLocalService::Init(exports);
}
class GattServiceProvider : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattServiceProvider").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "startAdvertising", StartAdvertising);
Nan::SetPrototypeMethod(localRef, "stopAdvertising", StopAdvertising);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("advertisementStatus").ToLocalChecked(), AdvertisementStatusGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("service").ToLocalChecked(), ServiceGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
func = Nan::GetFunction(Nan::New<FunctionTemplate>(CreateAsync)).ToLocalChecked();
Nan::Set(constructor, Nan::New<String>("createAsync").ToLocalChecked(), func);
Nan::Set(exports, Nan::New<String>("GattServiceProvider").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattServiceProvider(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattServiceProvider *wrapperInstance = new GattServiceProvider(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattServiceProvider(winRtInstance));
}
static void StartAdvertising(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info.This()))
{
return;
}
GattServiceProvider *wrapper = GattServiceProvider::Unwrap<GattServiceProvider>(info.This());
if (info.Length() == 0)
{
try
{
wrapper->_instance->StartAdvertising();
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 1
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^>(info[0]))
{
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisingParameters^ arg0 = UnwrapGattServiceProviderAdvertisingParameters(info[0]);
wrapper->_instance->StartAdvertising(arg0);
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void StopAdvertising(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info.This()))
{
return;
}
GattServiceProvider *wrapper = GattServiceProvider::Unwrap<GattServiceProvider>(info.This());
if (info.Length() == 0)
{
try
{
wrapper->_instance->StopAdvertising();
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void CreateAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^>^ op;
if (info.Length() == 2
&& NodeRT::Utils::IsGuid(info[0]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
op = ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider::CreateAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattServiceProviderResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void AdvertisementStatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info.This()))
{
return;
}
GattServiceProvider *wrapper = GattServiceProvider::Unwrap<GattServiceProvider>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatus result = wrapper->_instance->AdvertisementStatus;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ServiceGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info.This()))
{
return;
}
GattServiceProvider *wrapper = GattServiceProvider::Unwrap<GattServiceProvider>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalService^ result = wrapper->_instance->Service;
info.GetReturnValue().Set(WrapGattLocalService(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"advertisementStatusChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattServiceProvider *wrapper = GattServiceProvider::Unwrap<GattServiceProvider>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->AdvertisementStatusChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattServiceProvider(arg0);
wrappedArg1 = WrapGattServiceProviderAdvertisementStatusChangedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"advertisementStatusChanged", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"advertisementStatusChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattServiceProvider *wrapper = GattServiceProvider::Unwrap<GattServiceProvider>(info.This());
wrapper->_instance->AdvertisementStatusChanged::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattServiceProvider(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ UnwrapGattServiceProvider(Local<Value> value);
};
Persistent<FunctionTemplate> GattServiceProvider::s_constructorTemplate;
v8::Local<v8::Value> WrapGattServiceProvider(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattServiceProvider::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProvider^ UnwrapGattServiceProvider(Local<Value> value)
{
return GattServiceProvider::Unwrap<GattServiceProvider>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattServiceProvider(Local<Object> exports)
{
GattServiceProvider::Init(exports);
}
class GattServiceProviderAdvertisementStatusChangedEventArgs : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattServiceProviderAdvertisementStatusChangedEventArgs").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("error").ToLocalChecked(), ErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattServiceProviderAdvertisementStatusChangedEventArgs").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattServiceProviderAdvertisementStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattServiceProviderAdvertisementStatusChangedEventArgs *wrapperInstance = new GattServiceProviderAdvertisementStatusChangedEventArgs(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattServiceProviderAdvertisementStatusChangedEventArgs(winRtInstance));
}
static void ErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^>(info.This()))
{
return;
}
GattServiceProviderAdvertisementStatusChangedEventArgs *wrapper = GattServiceProviderAdvertisementStatusChangedEventArgs::Unwrap<GattServiceProviderAdvertisementStatusChangedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothError result = wrapper->_instance->Error;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^>(info.This()))
{
return;
}
GattServiceProviderAdvertisementStatusChangedEventArgs *wrapper = GattServiceProviderAdvertisementStatusChangedEventArgs::Unwrap<GattServiceProviderAdvertisementStatusChangedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattServiceProviderAdvertisementStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ UnwrapGattServiceProviderAdvertisementStatusChangedEventArgs(Local<Value> value);
};
Persistent<FunctionTemplate> GattServiceProviderAdvertisementStatusChangedEventArgs::s_constructorTemplate;
v8::Local<v8::Value> WrapGattServiceProviderAdvertisementStatusChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattServiceProviderAdvertisementStatusChangedEventArgs::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattServiceProviderAdvertisementStatusChangedEventArgs^ UnwrapGattServiceProviderAdvertisementStatusChangedEventArgs(Local<Value> value)
{
return GattServiceProviderAdvertisementStatusChangedEventArgs::Unwrap<GattServiceProviderAdvertisementStatusChangedEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattServiceProviderAdvertisementStatusChangedEventArgs(Local<Object> exports)
{
GattServiceProviderAdvertisementStatusChangedEventArgs::Init(exports);
}
class GattLocalCharacteristicResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattLocalCharacteristicResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristic").ToLocalChecked(), CharacteristicGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("error").ToLocalChecked(), ErrorGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattLocalCharacteristicResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattLocalCharacteristicResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattLocalCharacteristicResult *wrapperInstance = new GattLocalCharacteristicResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattLocalCharacteristicResult(winRtInstance));
}
static void CharacteristicGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^>(info.This()))
{
return;
}
GattLocalCharacteristicResult *wrapper = GattLocalCharacteristicResult::Unwrap<GattLocalCharacteristicResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ result = wrapper->_instance->Characteristic;
info.GetReturnValue().Set(WrapGattLocalCharacteristic(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^>(info.This()))
{
return;
}
GattLocalCharacteristicResult *wrapper = GattLocalCharacteristicResult::Unwrap<GattLocalCharacteristicResult>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothError result = wrapper->_instance->Error;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattLocalCharacteristicResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ UnwrapGattLocalCharacteristicResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattLocalCharacteristicResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattLocalCharacteristicResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattLocalCharacteristicResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristicResult^ UnwrapGattLocalCharacteristicResult(Local<Value> value)
{
return GattLocalCharacteristicResult::Unwrap<GattLocalCharacteristicResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattLocalCharacteristicResult(Local<Object> exports)
{
GattLocalCharacteristicResult::Init(exports);
}
class GattLocalCharacteristic : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattLocalCharacteristic").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "createDescriptorAsync", CreateDescriptorAsync);
Nan::SetPrototypeMethod(localRef, "notifyValueAsync", NotifyValueAsync);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("characteristicProperties").ToLocalChecked(), CharacteristicPropertiesGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("descriptors").ToLocalChecked(), DescriptorsGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("presentationFormats").ToLocalChecked(), PresentationFormatsGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("readProtectionLevel").ToLocalChecked(), ReadProtectionLevelGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("staticValue").ToLocalChecked(), StaticValueGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("subscribedClients").ToLocalChecked(), SubscribedClientsGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("userDescription").ToLocalChecked(), UserDescriptionGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("uuid").ToLocalChecked(), UuidGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("writeProtectionLevel").ToLocalChecked(), WriteProtectionLevelGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattLocalCharacteristic").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattLocalCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattLocalCharacteristic *wrapperInstance = new GattLocalCharacteristic(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattLocalCharacteristic(winRtInstance));
}
static void CreateDescriptorAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^>^ op;
if (info.Length() == 3
&& NodeRT::Utils::IsGuid(info[0])
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^>(info[1]))
{
try
{
::Platform::Guid arg0 = NodeRT::Utils::GuidFromJs(info[0]);
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorParameters^ arg1 = UnwrapGattLocalDescriptorParameters(info[1]);
op = wrapper->_instance->CreateDescriptorAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattLocalDescriptorResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void NotifyValueAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
// (jasongin) Hand-patched generated code due to NodeRT bug for method overloads having different return types.
::Windows::Foundation::IAsyncOperation<::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>^>^ op1 = nullptr;
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>^ op2 = nullptr;
if (info.Length() == 2
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0]))
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
op1 = wrapper->_instance->NotifyValueAsync(arg0);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (info.Length() == 3
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0])
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(info[1]))
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ arg1 = UnwrapGattSubscribedClient(info[1]);
op2 = wrapper->_instance->NotifyValueAsync(arg0,arg1);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
if (op1 != nullptr)
{
auto opTask = create_task(op1);
opTask.then( [asyncToken] (task<::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ val) -> Local<Value> {
return WrapGattClientNotificationResult(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ {
return UnwrapGattClientNotificationResult(value);
}
);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
else
{
auto opTask = create_task(op2);
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattClientNotificationResult(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
}
static void CharacteristicPropertiesGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCharacteristicProperties result = wrapper->_instance->CharacteristicProperties;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void DescriptorsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>^ result = wrapper->_instance->Descriptors;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ val) -> Local<Value> {
return WrapGattLocalDescriptor(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ {
return UnwrapGattLocalDescriptor(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void PresentationFormatsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>^ result = wrapper->_instance->PresentationFormats;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ val) -> Local<Value> {
return WrapGattPresentationFormat(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattPresentationFormat^ {
return UnwrapGattPresentationFormat(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ReadProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->ReadProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StaticValueGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ result = wrapper->_instance->StaticValue;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IBuffer", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SubscribedClientsGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Windows::Foundation::Collections::IVectorView<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>^ result = wrapper->_instance->SubscribedClients;
info.GetReturnValue().Set(NodeRT::Collections::VectorViewWrapper<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>::CreateVectorViewWrapper(result,
[](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ val) -> Local<Value> {
return WrapGattSubscribedClient(val);
},
[](Local<Value> value) -> bool {
return NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(value);
},
[](Local<Value> value) -> ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ {
return UnwrapGattSubscribedClient(value);
}
));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UserDescriptionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
Platform::String^ result = wrapper->_instance->UserDescription;
info.GetReturnValue().Set(NodeRT::Utils::NewString(result->Data()));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UuidGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Platform::Guid result = wrapper->_instance->Uuid;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void WriteProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->WriteProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"readRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->ReadRequested::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattLocalCharacteristic(arg0);
wrappedArg1 = WrapGattReadRequestedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"subscribedClientsChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->SubscribedClientsChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^, ::Platform::Object^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ arg0, ::Platform::Object^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattLocalCharacteristic(arg0);
wrappedArg1 = CreateOpaqueWrapper(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"writeRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->WriteRequested::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattLocalCharacteristic(arg0);
wrappedArg1 = WrapGattWriteRequestedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"readRequested", str)) &&(!NodeRT::Utils::CaseInsenstiveEquals(L"subscribedClientsChanged", str)) &&(!NodeRT::Utils::CaseInsenstiveEquals(L"writeRequested", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"readRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
wrapper->_instance->ReadRequested::remove(registrationToken);
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"subscribedClientsChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
wrapper->_instance->SubscribedClientsChanged::remove(registrationToken);
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"writeRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalCharacteristic *wrapper = GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(info.This());
wrapper->_instance->WriteRequested::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattLocalCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ UnwrapGattLocalCharacteristic(Local<Value> value);
};
Persistent<FunctionTemplate> GattLocalCharacteristic::s_constructorTemplate;
v8::Local<v8::Value> WrapGattLocalCharacteristic(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattLocalCharacteristic::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalCharacteristic^ UnwrapGattLocalCharacteristic(Local<Value> value)
{
return GattLocalCharacteristic::Unwrap<GattLocalCharacteristic>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattLocalCharacteristic(Local<Object> exports)
{
GattLocalCharacteristic::Init(exports);
}
class GattLocalDescriptorResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattLocalDescriptorResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("descriptor").ToLocalChecked(), DescriptorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("error").ToLocalChecked(), ErrorGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattLocalDescriptorResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattLocalDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattLocalDescriptorResult *wrapperInstance = new GattLocalDescriptorResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattLocalDescriptorResult(winRtInstance));
}
static void DescriptorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^>(info.This()))
{
return;
}
GattLocalDescriptorResult *wrapper = GattLocalDescriptorResult::Unwrap<GattLocalDescriptorResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ result = wrapper->_instance->Descriptor;
info.GetReturnValue().Set(WrapGattLocalDescriptor(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^>(info.This()))
{
return;
}
GattLocalDescriptorResult *wrapper = GattLocalDescriptorResult::Unwrap<GattLocalDescriptorResult>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothError result = wrapper->_instance->Error;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattLocalDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ UnwrapGattLocalDescriptorResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattLocalDescriptorResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattLocalDescriptorResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattLocalDescriptorResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptorResult^ UnwrapGattLocalDescriptorResult(Local<Value> value)
{
return GattLocalDescriptorResult::Unwrap<GattLocalDescriptorResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattLocalDescriptorResult(Local<Object> exports)
{
GattLocalDescriptorResult::Init(exports);
}
class GattLocalDescriptor : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattLocalDescriptor").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("readProtectionLevel").ToLocalChecked(), ReadProtectionLevelGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("staticValue").ToLocalChecked(), StaticValueGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("uuid").ToLocalChecked(), UuidGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("writeProtectionLevel").ToLocalChecked(), WriteProtectionLevelGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattLocalDescriptor").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattLocalDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattLocalDescriptor *wrapperInstance = new GattLocalDescriptor(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattLocalDescriptor(winRtInstance));
}
static void ReadProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->ReadProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StaticValueGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ result = wrapper->_instance->StaticValue;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IBuffer", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void UuidGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
try
{
::Platform::Guid result = wrapper->_instance->Uuid;
info.GetReturnValue().Set(NodeRT::Utils::GuidToJs(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void WriteProtectionLevelGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattProtectionLevel result = wrapper->_instance->WriteProtectionLevel;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"readRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->ReadRequested::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattLocalDescriptor(arg0);
wrappedArg1 = WrapGattReadRequestedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"writeRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->WriteRequested::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattLocalDescriptor(arg0);
wrappedArg1 = WrapGattWriteRequestedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"readRequested", str)) &&(!NodeRT::Utils::CaseInsenstiveEquals(L"writeRequested", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"readRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
wrapper->_instance->ReadRequested::remove(registrationToken);
}
else if (NodeRT::Utils::CaseInsenstiveEquals(L"writeRequested", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattLocalDescriptor *wrapper = GattLocalDescriptor::Unwrap<GattLocalDescriptor>(info.This());
wrapper->_instance->WriteRequested::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattLocalDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ UnwrapGattLocalDescriptor(Local<Value> value);
};
Persistent<FunctionTemplate> GattLocalDescriptor::s_constructorTemplate;
v8::Local<v8::Value> WrapGattLocalDescriptor(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattLocalDescriptor::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattLocalDescriptor^ UnwrapGattLocalDescriptor(Local<Value> value)
{
return GattLocalDescriptor::Unwrap<GattLocalDescriptor>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattLocalDescriptor(Local<Object> exports)
{
GattLocalDescriptor::Init(exports);
}
class GattSubscribedClient : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattSubscribedClient").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("maxNotificationSize").ToLocalChecked(), MaxNotificationSizeGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("session").ToLocalChecked(), SessionGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattSubscribedClient").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattSubscribedClient(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattSubscribedClient *wrapperInstance = new GattSubscribedClient(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattSubscribedClient(winRtInstance));
}
static void MaxNotificationSizeGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(info.This()))
{
return;
}
GattSubscribedClient *wrapper = GattSubscribedClient::Unwrap<GattSubscribedClient>(info.This());
try
{
unsigned short result = wrapper->_instance->MaxNotificationSize;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SessionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(info.This()))
{
return;
}
GattSubscribedClient *wrapper = GattSubscribedClient::Unwrap<GattSubscribedClient>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ result = wrapper->_instance->Session;
info.GetReturnValue().Set(WrapGattSession(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"maxNotificationSizeChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattSubscribedClient *wrapper = GattSubscribedClient::Unwrap<GattSubscribedClient>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->MaxNotificationSizeChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^, ::Platform::Object^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ arg0, ::Platform::Object^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattSubscribedClient(arg0);
wrappedArg1 = CreateOpaqueWrapper(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"maxNotificationSizeChanged", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"maxNotificationSizeChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattSubscribedClient *wrapper = GattSubscribedClient::Unwrap<GattSubscribedClient>(info.This());
wrapper->_instance->MaxNotificationSizeChanged::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattSubscribedClient(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ UnwrapGattSubscribedClient(Local<Value> value);
};
Persistent<FunctionTemplate> GattSubscribedClient::s_constructorTemplate;
v8::Local<v8::Value> WrapGattSubscribedClient(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattSubscribedClient::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ UnwrapGattSubscribedClient(Local<Value> value)
{
return GattSubscribedClient::Unwrap<GattSubscribedClient>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattSubscribedClient(Local<Object> exports)
{
GattSubscribedClient::Init(exports);
}
class GattReadRequestedEventArgs : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattReadRequestedEventArgs").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "getDeferral", GetDeferral);
Nan::SetPrototypeMethod(localRef, "getRequestAsync", GetRequestAsync);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("session").ToLocalChecked(), SessionGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattReadRequestedEventArgs").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattReadRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattReadRequestedEventArgs *wrapperInstance = new GattReadRequestedEventArgs(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattReadRequestedEventArgs(winRtInstance));
}
static void GetRequestAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattReadRequestedEventArgs *wrapper = GattReadRequestedEventArgs::Unwrap<GattReadRequestedEventArgs>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->GetRequestAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattReadRequest(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetDeferral(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^>(info.This()))
{
return;
}
GattReadRequestedEventArgs *wrapper = GattReadRequestedEventArgs::Unwrap<GattReadRequestedEventArgs>(info.This());
if (info.Length() == 0)
{
try
{
::Windows::Foundation::Deferral^ result;
result = wrapper->_instance->GetDeferral();
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation", "Deferral", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void SessionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^>(info.This()))
{
return;
}
GattReadRequestedEventArgs *wrapper = GattReadRequestedEventArgs::Unwrap<GattReadRequestedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ result = wrapper->_instance->Session;
info.GetReturnValue().Set(WrapGattSession(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattReadRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ UnwrapGattReadRequestedEventArgs(Local<Value> value);
};
Persistent<FunctionTemplate> GattReadRequestedEventArgs::s_constructorTemplate;
v8::Local<v8::Value> WrapGattReadRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattReadRequestedEventArgs::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequestedEventArgs^ UnwrapGattReadRequestedEventArgs(Local<Value> value)
{
return GattReadRequestedEventArgs::Unwrap<GattReadRequestedEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattReadRequestedEventArgs(Local<Object> exports)
{
GattReadRequestedEventArgs::Init(exports);
}
class GattWriteRequestedEventArgs : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattWriteRequestedEventArgs").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Local<Function> func;
Local<FunctionTemplate> funcTemplate;
Nan::SetPrototypeMethod(localRef, "getDeferral", GetDeferral);
Nan::SetPrototypeMethod(localRef, "getRequestAsync", GetRequestAsync);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("session").ToLocalChecked(), SessionGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattWriteRequestedEventArgs").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattWriteRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattWriteRequestedEventArgs *wrapperInstance = new GattWriteRequestedEventArgs(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattWriteRequestedEventArgs(winRtInstance));
}
static void GetRequestAsync(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^>(info.This()))
{
return;
}
if (info.Length() == 0 || !info[info.Length() -1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: No callback was given")));
return;
}
GattWriteRequestedEventArgs *wrapper = GattWriteRequestedEventArgs::Unwrap<GattWriteRequestedEventArgs>(info.This());
::Windows::Foundation::IAsyncOperation<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>^ op;
if (info.Length() == 1)
{
try
{
op = wrapper->_instance->GetRequestAsync();
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
auto opTask = create_task(op);
uv_async_t* asyncToken = NodeUtils::Async::GetAsyncToken(info[info.Length() -1].As<Function>());
opTask.then( [asyncToken] (task<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^> t)
{
try
{
auto result = t.get();
NodeUtils::Async::RunCallbackOnMain(asyncToken, [result](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error;
Local<Value> arg1;
{
TryCatch tryCatch;
arg1 = WrapGattWriteRequest(result);
if (tryCatch.HasCaught())
{
error = Nan::To<Object>(tryCatch.Exception()).ToLocalChecked();
}
else
{
error = Undefined();
}
if (arg1.IsEmpty()) arg1 = Undefined();
}
Local<Value> args[] = {error, arg1};
invokeCallback(_countof(args), args);
});
}
catch (Platform::Exception^ exception)
{
NodeUtils::Async::RunCallbackOnMain(asyncToken, [exception](NodeUtils::InvokeCallbackDelegate invokeCallback) {
Local<Value> error = NodeRT::Utils::WinRtExceptionToJsError(exception);
Local<Value> args[] = {error};
invokeCallback(_countof(args), args);
});
}
});
}
static void GetDeferral(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^>(info.This()))
{
return;
}
GattWriteRequestedEventArgs *wrapper = GattWriteRequestedEventArgs::Unwrap<GattWriteRequestedEventArgs>(info.This());
if (info.Length() == 0)
{
try
{
::Windows::Foundation::Deferral^ result;
result = wrapper->_instance->GetDeferral();
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Foundation", "Deferral", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void SessionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^>(info.This()))
{
return;
}
GattWriteRequestedEventArgs *wrapper = GattWriteRequestedEventArgs::Unwrap<GattWriteRequestedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSession^ result = wrapper->_instance->Session;
info.GetReturnValue().Set(WrapGattSession(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattWriteRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ UnwrapGattWriteRequestedEventArgs(Local<Value> value);
};
Persistent<FunctionTemplate> GattWriteRequestedEventArgs::s_constructorTemplate;
v8::Local<v8::Value> WrapGattWriteRequestedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattWriteRequestedEventArgs::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequestedEventArgs^ UnwrapGattWriteRequestedEventArgs(Local<Value> value)
{
return GattWriteRequestedEventArgs::Unwrap<GattWriteRequestedEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattWriteRequestedEventArgs(Local<Object> exports)
{
GattWriteRequestedEventArgs::Init(exports);
}
class GattClientNotificationResult : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattClientNotificationResult").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("protocolError").ToLocalChecked(), ProtocolErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("status").ToLocalChecked(), StatusGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("subscribedClient").ToLocalChecked(), SubscribedClientGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattClientNotificationResult").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattClientNotificationResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattClientNotificationResult *wrapperInstance = new GattClientNotificationResult(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattClientNotificationResult(winRtInstance));
}
static void ProtocolErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>(info.This()))
{
return;
}
GattClientNotificationResult *wrapper = GattClientNotificationResult::Unwrap<GattClientNotificationResult>(info.This());
try
{
::Platform::IBox<unsigned char>^ result = wrapper->_instance->ProtocolError;
info.GetReturnValue().Set(result ? static_cast<Local<Value>>(Nan::New<Integer>(result->Value)) : Undefined());
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StatusGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>(info.This()))
{
return;
}
GattClientNotificationResult *wrapper = GattClientNotificationResult::Unwrap<GattClientNotificationResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattCommunicationStatus result = wrapper->_instance->Status;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void SubscribedClientGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^>(info.This()))
{
return;
}
GattClientNotificationResult *wrapper = GattClientNotificationResult::Unwrap<GattClientNotificationResult>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattSubscribedClient^ result = wrapper->_instance->SubscribedClient;
info.GetReturnValue().Set(WrapGattSubscribedClient(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattClientNotificationResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ UnwrapGattClientNotificationResult(Local<Value> value);
};
Persistent<FunctionTemplate> GattClientNotificationResult::s_constructorTemplate;
v8::Local<v8::Value> WrapGattClientNotificationResult(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattClientNotificationResult::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattClientNotificationResult^ UnwrapGattClientNotificationResult(Local<Value> value)
{
return GattClientNotificationResult::Unwrap<GattClientNotificationResult>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattClientNotificationResult(Local<Object> exports)
{
GattClientNotificationResult::Init(exports);
}
class GattReadRequest : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattReadRequest").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetPrototypeMethod(localRef, "respondWithValue", RespondWithValue);
Nan::SetPrototypeMethod(localRef, "respondWithProtocolError", RespondWithProtocolError);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("length").ToLocalChecked(), LengthGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("offset").ToLocalChecked(), OffsetGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("state").ToLocalChecked(), StateGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattReadRequest").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattReadRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattReadRequest *wrapperInstance = new GattReadRequest(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattReadRequest(winRtInstance));
}
static void RespondWithValue(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info.This()))
{
return;
}
GattReadRequest *wrapper = GattReadRequest::Unwrap<GattReadRequest>(info.This());
if (info.Length() == 1
&& NodeRT::Utils::IsWinRtWrapperOf<::Windows::Storage::Streams::IBuffer^>(info[0]))
{
try
{
::Windows::Storage::Streams::IBuffer^ arg0 = dynamic_cast<::Windows::Storage::Streams::IBuffer^>(NodeRT::Utils::GetObjectInstance(info[0]));
wrapper->_instance->RespondWithValue(arg0);
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void RespondWithProtocolError(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info.This()))
{
return;
}
GattReadRequest *wrapper = GattReadRequest::Unwrap<GattReadRequest>(info.This());
if (info.Length() == 1
&& info[0]->IsInt32())
{
try
{
unsigned char arg0 = static_cast<unsigned char>(Nan::To<int32_t>(info[0]).FromMaybe(0));
wrapper->_instance->RespondWithProtocolError(arg0);
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void LengthGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info.This()))
{
return;
}
GattReadRequest *wrapper = GattReadRequest::Unwrap<GattReadRequest>(info.This());
try
{
unsigned int result = wrapper->_instance->Length;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void OffsetGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info.This()))
{
return;
}
GattReadRequest *wrapper = GattReadRequest::Unwrap<GattReadRequest>(info.This());
try
{
unsigned int result = wrapper->_instance->Offset;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info.This()))
{
return;
}
GattReadRequest *wrapper = GattReadRequest::Unwrap<GattReadRequest>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestState result = wrapper->_instance->State;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"stateChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattReadRequest *wrapper = GattReadRequest::Unwrap<GattReadRequest>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->StateChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattReadRequest(arg0);
wrappedArg1 = WrapGattRequestStateChangedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"stateChanged", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"stateChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattReadRequest *wrapper = GattReadRequest::Unwrap<GattReadRequest>(info.This());
wrapper->_instance->StateChanged::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattReadRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ UnwrapGattReadRequest(Local<Value> value);
};
Persistent<FunctionTemplate> GattReadRequest::s_constructorTemplate;
v8::Local<v8::Value> WrapGattReadRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattReadRequest::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattReadRequest^ UnwrapGattReadRequest(Local<Value> value)
{
return GattReadRequest::Unwrap<GattReadRequest>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattReadRequest(Local<Object> exports)
{
GattReadRequest::Init(exports);
}
class GattRequestStateChangedEventArgs : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattRequestStateChangedEventArgs").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("error").ToLocalChecked(), ErrorGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("state").ToLocalChecked(), StateGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattRequestStateChangedEventArgs").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattRequestStateChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattRequestStateChangedEventArgs *wrapperInstance = new GattRequestStateChangedEventArgs(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattRequestStateChangedEventArgs(winRtInstance));
}
static void ErrorGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^>(info.This()))
{
return;
}
GattRequestStateChangedEventArgs *wrapper = GattRequestStateChangedEventArgs::Unwrap<GattRequestStateChangedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::BluetoothError result = wrapper->_instance->Error;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^>(info.This()))
{
return;
}
GattRequestStateChangedEventArgs *wrapper = GattRequestStateChangedEventArgs::Unwrap<GattRequestStateChangedEventArgs>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestState result = wrapper->_instance->State;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattRequestStateChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ UnwrapGattRequestStateChangedEventArgs(Local<Value> value);
};
Persistent<FunctionTemplate> GattRequestStateChangedEventArgs::s_constructorTemplate;
v8::Local<v8::Value> WrapGattRequestStateChangedEventArgs(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattRequestStateChangedEventArgs::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ UnwrapGattRequestStateChangedEventArgs(Local<Value> value)
{
return GattRequestStateChangedEventArgs::Unwrap<GattRequestStateChangedEventArgs>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattRequestStateChangedEventArgs(Local<Object> exports)
{
GattRequestStateChangedEventArgs::Init(exports);
}
class GattWriteRequest : public WrapperBase
{
public:
static void Init(const Local<Object> exports)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(New);
s_constructorTemplate.Reset(localRef);
localRef->SetClassName(Nan::New<String>("GattWriteRequest").ToLocalChecked());
localRef->InstanceTemplate()->SetInternalFieldCount(1);
Nan::SetPrototypeMethod(localRef, "respond", Respond);
Nan::SetPrototypeMethod(localRef, "respondWithProtocolError", RespondWithProtocolError);
Nan::SetPrototypeMethod(localRef,"addListener", AddListener);
Nan::SetPrototypeMethod(localRef,"on", AddListener);
Nan::SetPrototypeMethod(localRef,"removeListener", RemoveListener);
Nan::SetPrototypeMethod(localRef, "off", RemoveListener);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("offset").ToLocalChecked(), OffsetGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("option").ToLocalChecked(), OptionGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("state").ToLocalChecked(), StateGetter);
Nan::SetAccessor(localRef->PrototypeTemplate(), Nan::New<String>("value").ToLocalChecked(), ValueGetter);
Local<Object> constructor = Nan::To<Object>(Nan::GetFunction(localRef).ToLocalChecked()).ToLocalChecked();
Nan::SetMethod(constructor, "castFrom", CastFrom);
Nan::Set(exports, Nan::New<String>("GattWriteRequest").ToLocalChecked(), constructor);
}
virtual ::Platform::Object^ GetObjectInstance() const override
{
return _instance;
}
private:
GattWriteRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ instance)
{
_instance = instance;
}
static void New(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(s_constructorTemplate);
// in case the constructor was called without the new operator
if (!localRef->HasInstance(info.This()))
{
if (info.Length() > 0)
{
std::unique_ptr<Local<Value> []> constructorArgs(new Local<Value>[info.Length()]);
Local<Value> *argsPtr = constructorArgs.get();
for (int i = 0; i < info.Length(); i++)
{
argsPtr[i] = info[i];
}
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), constructorArgs.get());
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
else
{
MaybeLocal<Object> res = Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(), info.Length(), nullptr);
if (res.IsEmpty())
{
return;
}
info.GetReturnValue().Set(res.ToLocalChecked());
return;
}
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ winRtInstance;
if (info.Length() == 1 && OpaqueWrapper::IsOpaqueWrapper(info[0]) &&
NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info[0]))
{
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no suitable constructor found")));
return;
}
NodeRT::Utils::SetHiddenValue(info.This(), Nan::New<String>("__winRtInstance__").ToLocalChecked(), True());
GattWriteRequest *wrapperInstance = new GattWriteRequest(winRtInstance);
wrapperInstance->Wrap(info.This());
info.GetReturnValue().Set(info.This());
}
static void CastFrom(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 1 || !NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info[0]))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Invalid arguments, no object provided, or given object could not be casted to requested type")));
return;
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ winRtInstance;
try
{
winRtInstance = (::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^) NodeRT::Utils::GetObjectInstance(info[0]);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
info.GetReturnValue().Set(WrapGattWriteRequest(winRtInstance));
}
static void Respond(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
if (info.Length() == 0)
{
try
{
wrapper->_instance->Respond();
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void RespondWithProtocolError(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
if (info.Length() == 1
&& info[0]->IsInt32())
{
try
{
unsigned char arg0 = static_cast<unsigned char>(Nan::To<int32_t>(info[0]).FromMaybe(0));
wrapper->_instance->RespondWithProtocolError(arg0);
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"Bad arguments: no suitable overload found")));
return;
}
}
static void OffsetGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
try
{
unsigned int result = wrapper->_instance->Offset;
info.GetReturnValue().Set(Nan::New<Integer>(result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void OptionGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteOption result = wrapper->_instance->Option;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void StateGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
try
{
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestState result = wrapper->_instance->State;
info.GetReturnValue().Set(Nan::New<Integer>(static_cast<int>(result)));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void ValueGetter(Local<String> property, const Nan::PropertyCallbackInfo<v8::Value> &info)
{
HandleScope scope;
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
try
{
::Windows::Storage::Streams::IBuffer^ result = wrapper->_instance->Value;
info.GetReturnValue().Set(NodeRT::Utils::CreateExternalWinRTObject("Windows.Storage.Streams", "IBuffer", result));
return;
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
static void AddListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected arguments are eventName(string),callback(function)")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
Local<Function> callback = info[1].As<Function>();
::Windows::Foundation::EventRegistrationToken registrationToken;
if (NodeRT::Utils::CaseInsenstiveEquals(L"stateChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
try
{
Persistent<Object>* perstPtr = new Persistent<Object>();
perstPtr->Reset(NodeRT::Utils::CreateCallbackObjectInDomain(callback));
std::shared_ptr<Persistent<Object>> callbackObjPtr(perstPtr,
[] (Persistent<Object> *ptr ) {
NodeUtils::Async::RunOnMain([ptr]() {
ptr->Reset();
delete ptr;
});
});
registrationToken = wrapper->_instance->StateChanged::add(
ref new ::Windows::Foundation::TypedEventHandler<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^>(
[callbackObjPtr](::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ arg0, ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattRequestStateChangedEventArgs^ arg1) {
NodeUtils::Async::RunOnMain([callbackObjPtr , arg0, arg1]() {
HandleScope scope;
Local<Value> wrappedArg0;
Local<Value> wrappedArg1;
{
TryCatch tryCatch;
wrappedArg0 = WrapGattWriteRequest(arg0);
wrappedArg1 = WrapGattRequestStateChangedEventArgs(arg1);
if (wrappedArg0.IsEmpty()) wrappedArg0 = Undefined();
if (wrappedArg1.IsEmpty()) wrappedArg1 = Undefined();
}
Local<Value> args[] = { wrappedArg0, wrappedArg1 };
Local<Object> callbackObjLocalRef = Nan::New<Object>(*callbackObjPtr);
NodeRT::Utils::CallCallbackInDomain(callbackObjLocalRef, _countof(args), args);
});
})
);
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
return;
}
}
else
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Value> tokenMapVal = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
Local<Object> tokenMap;
if (tokenMapVal.IsEmpty() || Nan::Equals(tokenMapVal, Undefined()).FromMaybe(false))
{
tokenMap = Nan::New<Object>();
NodeRT::Utils::SetHiddenValueWithObject(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked(), tokenMap);
}
else
{
tokenMap = Nan::To<Object>(tokenMapVal).ToLocalChecked();
}
Nan::Set(tokenMap, info[0], CreateOpaqueWrapper(::Windows::Foundation::PropertyValue::CreateInt64(registrationToken.Value)));
}
static void RemoveListener(Nan::NAN_METHOD_ARGS_TYPE info)
{
HandleScope scope;
if (info.Length() < 2 || !info[0]->IsString() || !info[1]->IsFunction())
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"wrong arguments, expected a string and a callback")));
return;
}
String::Value eventName(info[0]);
auto str = *eventName;
if ((!NodeRT::Utils::CaseInsenstiveEquals(L"stateChanged", str)))
{
Nan::ThrowError(Nan::Error(String::Concat(NodeRT::Utils::NewString(L"given event name isn't supported: "), info[0].As<String>())));
return;
}
Local<Function> callback = info[1].As<Function>();
Local<Value> tokenMap = NodeRT::Utils::GetHiddenValue(callback, Nan::New<String>(REGISTRATION_TOKEN_MAP_PROPERTY_NAME).ToLocalChecked());
if (tokenMap.IsEmpty() || Nan::Equals(tokenMap, Undefined()).FromMaybe(false))
{
return;
}
Local<Value> opaqueWrapperObj = Nan::Get(Nan::To<Object>(tokenMap).ToLocalChecked(), info[0]).ToLocalChecked();
if (opaqueWrapperObj.IsEmpty() || Nan::Equals(opaqueWrapperObj,Undefined()).FromMaybe(false))
{
return;
}
OpaqueWrapper *opaqueWrapper = OpaqueWrapper::Unwrap<OpaqueWrapper>(opaqueWrapperObj.As<Object>());
long long tokenValue = (long long) opaqueWrapper->GetObjectInstance();
::Windows::Foundation::EventRegistrationToken registrationToken;
registrationToken.Value = tokenValue;
try
{
if (NodeRT::Utils::CaseInsenstiveEquals(L"stateChanged", str))
{
if (!NodeRT::Utils::IsWinRtWrapperOf<::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^>(info.This()))
{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"The caller of this method isn't of the expected type or internal WinRt object was disposed")));
return;
}
GattWriteRequest *wrapper = GattWriteRequest::Unwrap<GattWriteRequest>(info.This());
wrapper->_instance->StateChanged::remove(registrationToken);
}
}
catch (Platform::Exception ^exception)
{
NodeRT::Utils::ThrowWinRtExceptionInJs(exception);
}
Nan::Delete(Nan::To<Object>(tokenMap).ToLocalChecked(), Nan::To<String>(info[0]).ToLocalChecked());
}
private:
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ _instance;
static Persistent<FunctionTemplate> s_constructorTemplate;
friend v8::Local<v8::Value> WrapGattWriteRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ wintRtInstance);
friend ::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ UnwrapGattWriteRequest(Local<Value> value);
};
Persistent<FunctionTemplate> GattWriteRequest::s_constructorTemplate;
v8::Local<v8::Value> WrapGattWriteRequest(::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ winRtInstance)
{
EscapableHandleScope scope;
if (winRtInstance == nullptr)
{
return scope.Escape(Undefined());
}
Local<Value> opaqueWrapper = CreateOpaqueWrapper(winRtInstance);
Local<Value> args[] = {opaqueWrapper};
Local<FunctionTemplate> localRef = Nan::New<FunctionTemplate>(GattWriteRequest::s_constructorTemplate);
return scope.Escape(Nan::NewInstance(Nan::GetFunction(localRef).ToLocalChecked(),_countof(args), args).ToLocalChecked());
}
::Windows::Devices::Bluetooth::GenericAttributeProfile::GattWriteRequest^ UnwrapGattWriteRequest(Local<Value> value)
{
return GattWriteRequest::Unwrap<GattWriteRequest>(Nan::To<Object>(value).ToLocalChecked())->_instance;
}
void InitGattWriteRequest(Local<Object> exports)
{
GattWriteRequest::Init(exports);
}
} } } } }
NAN_MODULE_INIT(init)
{
// we ignore failures for now since it probably means that the initialization already happened for STA, and that's cool
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
//if (FAILED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
/*{
Nan::ThrowError(Nan::Error(NodeRT::Utils::NewString(L"error in CoInitializeEx()")));
return;
}*/
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattSessionStatusEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattCharacteristicPropertiesEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattClientCharacteristicConfigurationDescriptorValueEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattProtectionLevelEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattWriteOptionEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattCommunicationStatusEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattSharingModeEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattOpenStatusEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattRequestStateEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattServiceProviderAdvertisementStatusEnum(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattDeviceService(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattDeviceServicesResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattProtocolError(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattSession(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattSessionStatusChangedEventArgs(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattCharacteristic(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattCharacteristicsResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattDescriptor(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattPresentationFormat(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattReadResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattReadClientCharacteristicConfigurationDescriptorResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattValueChangedEventArgs(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattDescriptorsResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattWriteResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattPresentationFormatTypes(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattServiceUuids(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattCharacteristicUuids(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattDescriptorUuids(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattReliableWriteTransaction(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattServiceProviderAdvertisingParameters(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattLocalCharacteristicParameters(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattLocalDescriptorParameters(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattServiceProviderResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattLocalService(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattServiceProvider(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattServiceProviderAdvertisementStatusChangedEventArgs(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattLocalCharacteristicResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattLocalCharacteristic(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattLocalDescriptorResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattLocalDescriptor(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattSubscribedClient(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattReadRequestedEventArgs(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattWriteRequestedEventArgs(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattClientNotificationResult(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattReadRequest(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattRequestStateChangedEventArgs(target);
NodeRT::Windows::Devices::Bluetooth::GenericAttributeProfile::InitGattWriteRequest(target);
NodeRT::Utils::RegisterNameSpace("Windows.Devices.Bluetooth.GenericAttributeProfile", target);
}
NODE_MODULE(binding, init) | mit |
renanaugustom/Ferramenta-de-transformacao-de-requisitos-para-arquitetura-de-tres-camadas | Projeto/parametros/urls.py | 487 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf.urls import patterns, include, url
from parametros import views
urlpatterns = patterns('',
url(r'^listar_ajax$', views.listar_ajax, name='listar_ajax'),
url(r'^excluir_ajax$', views.excluir_ajax, name='excluir_ajax'),
url(r'^cadastrar_ajax$', views.cadastrar_ajax, name='cadastrar_ajax'),
url(r'^verificanomeparametro_ajax$', views.verificanomeparametro_ajax, name='verificanomeparametro_ajax'),
) | mit |
extr0py/oni | browser/test/Services/Snippets/SnippetVariableResolverTests.ts | 826 | /**
* SnippetVariableResolverTests.ts
*/
import * as assert from "assert"
import { SnippetVariableResolver } from "./../../../src/Services/Snippets"
import { MockBuffer } from "./../../Mocks"
const createMockVariable = (name: string): any => ({
name,
})
describe("SnippetVariableResolverTests", () => {
it("tests", async () => {
const buffer = new MockBuffer("typescript", "test.ts")
buffer.setCursorPosition(1, 1)
const variableResolver = new SnippetVariableResolver(buffer as any)
assert.strictEqual(variableResolver.resolve(createMockVariable("TM_FILENAME_BASE")), "test")
assert.strictEqual(variableResolver.resolve(createMockVariable("TM_LINE_INDEX")), "1")
assert.strictEqual(variableResolver.resolve(createMockVariable("TM_LINE_NUMBER")), "2")
})
})
| mit |
tugberkugurlu/MvcBloggy | src/MvcBloggy.API/Config/RouteConfig.cs | 1021 | using MvcBloggy.API.Routing;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
namespace MvcBloggy.API.Config {
public static class RouteConfig {
public static void RegisterRoutes(HttpRouteCollection routes) {
routes.MapHttpRoute(
"BlogpostTagsHttpApiRoute",
"api/blogposts/tags/{*tags}",
new { controller = "blogposttags" }
);
routes.MapHttpRoute(
"BlogpostCommentsHttpApiRoute",
"api/blogposts/{blogpostkey}/comments",
new { controller = "blogpostcomments" },
new { blogpostkey = new GuidRouteConstraint() }
);
routes.MapHttpRoute(
"DefaultHttpApiRoute",
"api/{controller}/{id}",
new { id = RouteParameter.Optional }
);
}
}
}
| mit |
LeanKit-Labs/autohost | spec/setup.js | 1990 | var chai = require( 'chai' );
chai.use( require( 'chai-as-promised' ) );
global.should = chai.should();
global.expect = chai.expect;
var _ = global._ = require( 'lodash' );
global.when = require( 'when' );
global.lift = require( 'when/node' ).lift;
global.seq = require( 'when/sequence' );
global.fs = require( 'fs' );
global.path = require( 'path' );
global.sinon = require( 'sinon' );
global.proxyquire = require( 'proxyquire' ).noPreserveCache();
var sinonChai = require( 'sinon-chai' );
chai.use( sinonChai );
var logLib = require( "../src/log" );
var adapterPath = require.resolve( "./mockLogger.js" );
var mockAdapter = require( "./mockLogger.js" );
process.title = 'ahspec';
function transformResponse() {
var props = Array.prototype.slice.call( arguments, 0 );
return function( resp ) {
resp = _.isArray( resp ) ? resp[ 0 ] : resp;
var obj = {};
if ( _.includes( props, 'body' ) ) {
obj.body = resp.body;
}
if ( _.includes( props, 'type' ) ) {
obj.type = resp.headers[ 'content-type' ];
}
if ( _.includes( props, 'cache' ) ) {
obj.cache = resp.headers[ 'cache-control' ];
}
if ( _.includes( props, 'testHeader' ) ) {
obj.header = resp.headers[ 'test-header' ];
}
if ( _.includes( props, 'setCookie' ) ) {
obj.cookie = resp.headers[ 'set-cookie' ][ 0 ];
}
if ( _.includes( props, 'statusCode' ) ) {
obj.statusCode = resp.statusCode;
}
return obj;
};
}
function onError() {
return {};
}
global.setupLog = function setupLog( ns, level ) {
global.logAdapter = mockAdapter( ns );
var adapters = {};
adapters[ adapterPath ] = { level: level || 5 };
var logFn = global.Log = logLib( {
adapters: adapters
} );
return logFn( ns );
};
global.transformResponse = transformResponse;
global.onError = onError;
var _log = console.log;
console.log = function() {
if ( typeof arguments[ 0 ] === 'string' && /^[a-zA-Z]/.test( arguments[ 0 ] ) ) {
return; // swallow this message
} else {
_log.apply( console, arguments );
}
};
| mit |
kybarg/material-ui | packages/material-ui-icons/src/PhoneLockedOutlined.js | 727 | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.1-.03-.21-.05-.31-.05-.26 0-.51.1-.71.29l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM5.03 5h1.5c.07.88.22 1.75.45 2.58l-1.2 1.21c-.4-1.21-.66-2.47-.75-3.79zM19 18.97c-1.32-.09-2.6-.35-3.8-.76l1.2-1.2c.85.24 1.72.39 2.6.45v1.51zM20 4v-.5C20 2.12 18.88 1 17.5 1S15 2.12 15 3.5V4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h5c.55 0 1-.45 1-1V5c0-.55-.45-1-1-1zm-1 0h-3v-.5c0-.83.67-1.5 1.5-1.5s1.5.67 1.5 1.5V4z" />
, 'PhoneLockedOutlined');
| mit |
emclab/task_templatex | app/models/task_templatex/template.rb | 939 | module TaskTemplatex
class Template < ActiveRecord::Base
attr_accessible :active, :instruction, :last_updated_by_id, :name, :type_id, :ranking_order, :template_items_attributes, :as => :role_new
attr_accessible :active, :instruction, :last_updated_by_id, :name, :type_id, :ranking_order, :template_items_attributes, :as => :role_update
belongs_to :type, :class_name => TaskTemplatex.type_class.to_s
belongs_to :last_updated_by, :class_name => 'Authentify::User'
has_many :template_items, :class_name => 'TaskTemplatex::TemplateItem'
accepts_nested_attributes_for :template_items, :allow_destroy => true #data validate in task_template model
validates :type_id, :presence => true,
:numericality => {:greater_than => 0}
validates :name, :presence => true,
:uniqueness => { :case_sensitive => false, :message => 'Duplicate Name' }
end
end
| mit |
IgniteSTEM/IgniteSTEM-Web-App | server/src/routes/userRoutes.js | 239 | import { createUser, list, checkUsername } from '../controllers/users';
export default (app) => {
app.post('/api/users/create', createUser);
app.get('/api/users', list);
app.post('/api/users/checkUsername', checkUsername);
};
| mit |
benliddicott/DefinitelyTyped | types/react/index.d.ts | 161265 | // Type definitions for React 16.0
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>
// AssureSign <http://www.assuresign.com>
// Microsoft <https://microsoft.com>
// John Reilly <https://github.com/johnnyreilly>
// Benoit Benezech <https://github.com/bbenezech>
// Patricio Zavolinsky <https://github.com/pzavolinsky>
// Digiguru <https://github.com/digiguru>
// Eric Anderson <https://github.com/ericanderson>
// Albert Kurniawan <https://github.com/morcerf>
// Tanguy Krotoff <https://github.com/tkrotoff>
// Dovydas Navickas <https://github.com/DovydasNavickas>
// Stéphane Goetz <https://github.com/onigoetz>
// Rich Seviora <https://github.com/richseviora>
// Josh Rutherford <https://github.com/theruther4d>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/*
Known Problems & Workarounds
1. The type of cloneElement is incorrect.
cloneElement(element, props) should accept props object with a subset of properties on element.props.
React attributes, such as key and ref, should also be accepted in props, but should not exist on element.props.
The "correct" way to model this, then, is with:
declare function cloneElement<P extends Q, Q>(
element: ReactElement<P>,
props?: Q & Attributes,
...children: ReactNode[]): ReactElement<P>;
However, type inference for Q defaults to {} when intersected with another type.
(https://github.com/Microsoft/TypeScript/pull/5738#issuecomment-181904905)
And since any object is assignable to {}, we would lose the type safety of the P extends Q constraint.
Therefore, the type of props is left as Q, which should work for most cases.
If you need to call cloneElement with key or ref, you'll need a type cast:
interface ButtonProps {
label: string;
isDisabled?: boolean;
}
var element: React.CElement<ButtonProps, Button>;
React.cloneElement(element, { label: "label" });
// cloning with optional props requires a cast
React.cloneElement(element, <{ isDisabled?: boolean }>{ isDisabled: true });
// cloning with key or ref requires a cast
React.cloneElement(element, <React.ClassAttributes<Button>>{ ref: button => button.reset() });
React.cloneElement(element, <{ isDisabled?: boolean } & React.Attributes>{
key: "disabledButton",
isDisabled: true
});
*/
/// <reference path="global.d.ts" />
type NativeAnimationEvent = AnimationEvent;
type NativeClipboardEvent = ClipboardEvent;
type NativeCompositionEvent = CompositionEvent;
type NativeDragEvent = DragEvent;
type NativeFocusEvent = FocusEvent;
type NativeKeyboardEvent = KeyboardEvent;
type NativeMouseEvent = MouseEvent;
type NativeTouchEvent = TouchEvent;
type NativeTransitionEvent = TransitionEvent;
type NativeUIEvent = UIEvent;
type NativeWheelEvent = WheelEvent;
// tslint:disable-next-line:export-just-namespace
export = React;
export as namespace React;
declare namespace React {
//
// React Elements
// ----------------------------------------------------------------------
type ReactType<P = any> = string | ComponentType<P>;
type ComponentType<P = {}> = ComponentClass<P> | StatelessComponent<P>;
type Key = string | number;
type Ref<T> = string | { bivarianceHack(instance: T | null): any }["bivarianceHack"];
// tslint:disable-next-line:interface-over-type-literal
type ComponentState = {};
interface Attributes {
key?: Key;
}
interface ClassAttributes<T> extends Attributes {
ref?: Ref<T>;
}
interface ReactElement<P> {
type: string | ComponentClass<P> | SFC<P>;
props: P;
key: Key | null;
}
interface SFCElement<P> extends ReactElement<P> {
type: SFC<P>;
}
type CElement<P, T extends Component<P, ComponentState>> = ComponentElement<P, T>;
interface ComponentElement<P, T extends Component<P, ComponentState>> extends ReactElement<P> {
type: ComponentClass<P>;
ref?: Ref<T>;
}
type ClassicElement<P> = CElement<P, ClassicComponent<P, ComponentState>>;
// string fallback for custom web-components
interface DOMElement<P extends HTMLAttributes<T> | SVGAttributes<T>, T extends Element> extends ReactElement<P> {
type: string;
ref: Ref<T>;
}
// ReactHTML for ReactHTMLElement
// tslint:disable-next-line:no-empty-interface
interface ReactHTMLElement<T extends HTMLElement> extends DetailedReactHTMLElement<AllHTMLAttributes<T>, T> { }
interface DetailedReactHTMLElement<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMElement<P, T> {
type: keyof ReactHTML;
}
// ReactSVG for ReactSVGElement
interface ReactSVGElement extends DOMElement<SVGAttributes<SVGElement>, SVGElement> {
type: keyof ReactSVG;
}
interface ReactPortal {
key: Key | null;
children: ReactNode;
}
//
// Factories
// ----------------------------------------------------------------------
type Factory<P> = (props?: Attributes & P, ...children: ReactNode[]) => ReactElement<P>;
type SFCFactory<P> = (props?: Attributes & P, ...children: ReactNode[]) => SFCElement<P>;
type ComponentFactory<P, T extends Component<P, ComponentState>> =
(props?: ClassAttributes<T> & P, ...children: ReactNode[]) => CElement<P, T>;
type CFactory<P, T extends Component<P, ComponentState>> = ComponentFactory<P, T>;
type ClassicFactory<P> = CFactory<P, ClassicComponent<P, ComponentState>>;
type DOMFactory<P extends DOMAttributes<T>, T extends Element> =
(props?: ClassAttributes<T> & P | null, ...children: ReactNode[]) => DOMElement<P, T>;
// tslint:disable-next-line:no-empty-interface
interface HTMLFactory<T extends HTMLElement> extends DetailedHTMLFactory<AllHTMLAttributes<T>, T> {}
interface DetailedHTMLFactory<P extends HTMLAttributes<T>, T extends HTMLElement> extends DOMFactory<P, T> {
(props?: ClassAttributes<T> & P | null, ...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
}
interface SVGFactory extends DOMFactory<SVGAttributes<SVGElement>, SVGElement> {
(props?: ClassAttributes<SVGElement> & SVGAttributes<SVGElement> | null, ...children: ReactNode[]): ReactSVGElement;
}
//
// React Nodes
// http://facebook.github.io/react/docs/glossary.html
// ----------------------------------------------------------------------
type ReactText = string | number;
type ReactChild = ReactElement<any> | ReactText;
// Should be Array<ReactNode> but type aliases cannot be recursive
type ReactFragment = {} | Array<ReactChild | any[] | boolean>;
type ReactNode = ReactChild | ReactFragment | ReactPortal | string | number | boolean | null | undefined;
//
// Top Level API
// ----------------------------------------------------------------------
// DOM Elements
function createFactory<T extends HTMLElement>(
type: keyof ReactHTML): HTMLFactory<T>;
function createFactory(
type: keyof ReactSVG): SVGFactory;
function createFactory<P extends DOMAttributes<T>, T extends Element>(
type: string): DOMFactory<P, T>;
// Custom components
function createFactory<P>(type: SFC<P>): SFCFactory<P>;
function createFactory<P>(
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>): CFactory<P, ClassicComponent<P, ComponentState>>;
function createFactory<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
type: ClassType<P, T, C>): CFactory<P, T>;
function createFactory<P>(type: ComponentClass<P>): Factory<P>;
// DOM Elements
// TODO: generalize this to everything in `keyof ReactHTML`, not just "input"
function createElement(
type: "input",
props?: InputHTMLAttributes<HTMLInputElement> & ClassAttributes<HTMLInputElement>,
...children: ReactNode[]): DetailedReactHTMLElement<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
function createElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
type: keyof ReactHTML,
props?: ClassAttributes<T> & P,
...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
function createElement<P extends SVGAttributes<T>, T extends SVGElement>(
type: keyof ReactSVG,
props?: ClassAttributes<T> & P,
...children: ReactNode[]): ReactSVGElement;
function createElement<P extends DOMAttributes<T>, T extends Element>(
type: string,
props?: ClassAttributes<T> & P,
...children: ReactNode[]): DOMElement<P, T>;
// Custom components
function createElement<P>(
type: SFC<P>,
props?: Attributes & P,
...children: ReactNode[]): SFCElement<P>;
function createElement<P>(
type: ClassType<P, ClassicComponent<P, ComponentState>, ClassicComponentClass<P>>,
props?: ClassAttributes<ClassicComponent<P, ComponentState>> & P,
...children: ReactNode[]): CElement<P, ClassicComponent<P, ComponentState>>;
function createElement<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>>(
type: ClassType<P, T, C>,
props?: ClassAttributes<T> & P,
...children: ReactNode[]): CElement<P, T>;
function createElement<P>(
type: SFC<P> | ComponentClass<P> | string,
props?: Attributes & P,
...children: ReactNode[]): ReactElement<P>;
// DOM Elements
// ReactHTMLElement
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
element: DetailedReactHTMLElement<P, T>,
props?: P,
...children: ReactNode[]): DetailedReactHTMLElement<P, T>;
// ReactHTMLElement, less specific
function cloneElement<P extends HTMLAttributes<T>, T extends HTMLElement>(
element: ReactHTMLElement<T>,
props?: P,
...children: ReactNode[]): ReactHTMLElement<T>;
// SVGElement
function cloneElement<P extends SVGAttributes<T>, T extends SVGElement>(
element: ReactSVGElement,
props?: P,
...children: ReactNode[]): ReactSVGElement;
// DOM Element (has to be the last, because type checking stops at first overload that fits)
function cloneElement<P extends DOMAttributes<T>, T extends Element>(
element: DOMElement<P, T>,
props?: DOMAttributes<T> & P,
...children: ReactNode[]): DOMElement<P, T>;
// Custom components
function cloneElement<P extends Q, Q>(
element: SFCElement<P>,
props?: Q, // should be Q & Attributes, but then Q is inferred as {}
...children: ReactNode[]): SFCElement<P>;
function cloneElement<P extends Q, Q, T extends Component<P, ComponentState>>(
element: CElement<P, T>,
props?: Q, // should be Q & ClassAttributes<T>
...children: ReactNode[]): CElement<P, T>;
function cloneElement<P extends Q, Q>(
element: ReactElement<P>,
props?: Q, // should be Q & Attributes
...children: ReactNode[]): ReactElement<P>;
function isValidElement<P>(object: {} | null | undefined): object is ReactElement<P>;
const Children: ReactChildren;
const Fragment: ComponentType;
const version: string;
//
// Component API
// ----------------------------------------------------------------------
type ReactInstance = Component<any> | Element;
// Base component for plain JS classes
// tslint:disable-next-line:no-empty-interface
interface Component<P = {}, S = {}> extends ComponentLifecycle<P, S> { }
class Component<P, S> {
constructor(props: P, context?: any);
// Disabling unified-signatures to have separate overloads. It's easier to understand this way.
// tslint:disable-next-line:unified-signatures
setState<K extends keyof S>(f: (prevState: Readonly<S>, props: P) => Pick<S, K>, callback?: () => any): void;
// tslint:disable-next-line:unified-signatures
setState<K extends keyof S>(state: Pick<S, K>, callback?: () => any): void;
forceUpdate(callBack?: () => any): void;
render(): ReactNode;
// React.Props<T> is now deprecated, which means that the `children`
// property is not available on `P` by default, even though you can
// always pass children as variadic arguments to `createElement`.
// In the future, if we can define its call signature conditionally
// on the existence of `children` in `P`, then we should remove this.
props: Readonly<{ children?: ReactNode }> & Readonly<P>;
state: Readonly<S>;
context: any;
refs: {
[key: string]: ReactInstance
};
}
class PureComponent<P = {}, S = {}> extends Component<P, S> { }
interface ClassicComponent<P = {}, S = {}> extends Component<P, S> {
replaceState(nextState: S, callback?: () => any): void;
isMounted(): boolean;
getInitialState?(): S;
}
interface ChildContextProvider<CC> {
getChildContext(): CC;
}
//
// Class Interfaces
// ----------------------------------------------------------------------
type SFC<P = {}> = StatelessComponent<P>;
interface StatelessComponent<P = {}> {
(props: P & { children?: ReactNode }, context?: any): ReactElement<any> | null;
propTypes?: ValidationMap<P>;
contextTypes?: ValidationMap<any>;
defaultProps?: Partial<P>;
displayName?: string;
}
interface ComponentClass<P = {}> {
new (props: P, context?: any): Component<P, ComponentState>;
propTypes?: ValidationMap<P>;
contextTypes?: ValidationMap<any>;
childContextTypes?: ValidationMap<any>;
defaultProps?: Partial<P>;
displayName?: string;
}
interface ClassicComponentClass<P = {}> extends ComponentClass<P> {
new (props: P, context?: any): ClassicComponent<P, ComponentState>;
getDefaultProps?(): P;
}
/**
* We use an intersection type to infer multiple type parameters from
* a single argument, which is useful for many top-level API defs.
* See https://github.com/Microsoft/TypeScript/issues/7234 for more info.
*/
type ClassType<P, T extends Component<P, ComponentState>, C extends ComponentClass<P>> =
C &
(new (props: P, context?: any) => T) &
(new (props: P, context?: any) => { props: P });
//
// Component Specs and Lifecycle
// ----------------------------------------------------------------------
interface ComponentLifecycle<P, S> {
/**
* Called immediately before mounting occurs, and before `Component#render`.
* Avoid introducing any side-effects or subscriptions in this method.
*/
componentWillMount?(): void;
/**
* Called immediately after a compoment is mounted. Setting state here will trigger re-rendering.
*/
componentDidMount?(): void;
/**
* Called when the component may be receiving new props.
* React may call this even if props have not changed, so be sure to compare new and existing
* props if you only want to handle changes.
*
* Calling `Component#setState` generally does not trigger this method.
*/
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void;
/**
* Called to determine whether the change in props and state should trigger a re-render.
*
* `Component` always returns true.
* `PureComponent` implements a shallow comparison on props and state and returns true if any
* props or states have changed.
*
* If false is returned, `Component#render`, `componentWillUpdate`
* and `componentDidUpdate` will not be called.
*/
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean;
/**
* Called immediately before rendering when new props or state is received. Not called for the initial render.
*
* Note: You cannot call `Component#setState` here.
*/
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void;
/**
* Called immediately after updating occurs. Not called for the initial render.
*/
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, prevContext: any): void;
/**
* Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as
* cancelled network requests, or cleaning up any DOM elements created in `componentDidMount`.
*/
componentWillUnmount?(): void;
/**
* Catches exceptions generated in descendant components. Unhandled exceptions will cause
* the entire component tree to unmount.
*/
componentDidCatch?(error: Error, errorInfo: ErrorInfo): void;
}
interface Mixin<P, S> extends ComponentLifecycle<P, S> {
mixins?: Array<Mixin<P, S>>;
statics?: {
[key: string]: any;
};
displayName?: string;
propTypes?: ValidationMap<any>;
contextTypes?: ValidationMap<any>;
childContextTypes?: ValidationMap<any>;
getDefaultProps?(): P;
getInitialState?(): S;
}
interface ComponentSpec<P, S> extends Mixin<P, S> {
render(): ReactNode;
[propertyName: string]: any;
}
//
// Event System
// ----------------------------------------------------------------------
interface SyntheticEvent<T> {
bubbles: boolean;
/**
* A reference to the element on which the event listener is registered.
*/
currentTarget: EventTarget & T;
cancelable: boolean;
defaultPrevented: boolean;
eventPhase: number;
isTrusted: boolean;
nativeEvent: Event;
preventDefault(): void;
isDefaultPrevented(): boolean;
stopPropagation(): void;
isPropagationStopped(): boolean;
persist(): void;
// If you thought this should be `EventTarget & T`, see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/12239
/**
* A reference to the element from which the event was originally dispatched.
* This might be a child element to the element on which the event listener is registered.
*
* @see currentTarget
*/
target: EventTarget;
timeStamp: number;
type: string;
}
interface ClipboardEvent<T> extends SyntheticEvent<T> {
clipboardData: DataTransfer;
nativeEvent: NativeClipboardEvent;
}
interface CompositionEvent<T> extends SyntheticEvent<T> {
data: string;
nativeEvent: NativeCompositionEvent;
}
interface DragEvent<T> extends MouseEvent<T> {
dataTransfer: DataTransfer;
nativeEvent: NativeDragEvent;
}
interface FocusEvent<T> extends SyntheticEvent<T> {
nativeEvent: NativeFocusEvent;
relatedTarget: EventTarget;
}
// tslint:disable-next-line:no-empty-interface
interface FormEvent<T> extends SyntheticEvent<T> {
}
interface InvalidEvent<T> extends SyntheticEvent<T> {
target: EventTarget & T;
}
interface ChangeEvent<T> extends SyntheticEvent<T> {
target: EventTarget & T;
}
interface KeyboardEvent<T> extends SyntheticEvent<T> {
altKey: boolean;
charCode: number;
ctrlKey: boolean;
/**
* See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
*/
getModifierState(key: string): boolean;
/**
* See the [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#named-key-attribute-values). for possible values
*/
key: string;
keyCode: number;
locale: string;
location: number;
metaKey: boolean;
nativeEvent: NativeKeyboardEvent;
repeat: boolean;
shiftKey: boolean;
which: number;
}
interface MouseEvent<T> extends SyntheticEvent<T> {
altKey: boolean;
button: number;
buttons: number;
clientX: number;
clientY: number;
ctrlKey: boolean;
/**
* See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
*/
getModifierState(key: string): boolean;
metaKey: boolean;
nativeEvent: NativeMouseEvent;
pageX: number;
pageY: number;
relatedTarget: EventTarget;
screenX: number;
screenY: number;
shiftKey: boolean;
}
interface TouchEvent<T> extends SyntheticEvent<T> {
altKey: boolean;
changedTouches: TouchList;
ctrlKey: boolean;
/**
* See [DOM Level 3 Events spec](https://www.w3.org/TR/uievents-key/#keys-modifier). for a list of valid (case-sensitive) arguments to this method.
*/
getModifierState(key: string): boolean;
metaKey: boolean;
nativeEvent: NativeTouchEvent;
shiftKey: boolean;
targetTouches: TouchList;
touches: TouchList;
}
interface UIEvent<T> extends SyntheticEvent<T> {
detail: number;
nativeEvent: NativeUIEvent;
view: AbstractView;
}
interface WheelEvent<T> extends MouseEvent<T> {
deltaMode: number;
deltaX: number;
deltaY: number;
deltaZ: number;
nativeEvent: NativeWheelEvent;
}
interface AnimationEvent<T> extends SyntheticEvent<T> {
animationName: string;
elapsedTime: number;
nativeEvent: NativeAnimationEvent;
pseudoElement: string;
}
interface TransitionEvent<T> extends SyntheticEvent<T> {
elapsedTime: number;
nativeEvent: NativeTransitionEvent;
propertyName: string;
pseudoElement: string;
}
//
// Event Handler Types
// ----------------------------------------------------------------------
type EventHandler<E extends SyntheticEvent<any>> = { bivarianceHack(event: E): void }["bivarianceHack"];
type ReactEventHandler<T> = EventHandler<SyntheticEvent<T>>;
type ClipboardEventHandler<T> = EventHandler<ClipboardEvent<T>>;
type CompositionEventHandler<T> = EventHandler<CompositionEvent<T>>;
type DragEventHandler<T> = EventHandler<DragEvent<T>>;
type FocusEventHandler<T> = EventHandler<FocusEvent<T>>;
type FormEventHandler<T> = EventHandler<FormEvent<T>>;
type ChangeEventHandler<T> = EventHandler<ChangeEvent<T>>;
type KeyboardEventHandler<T> = EventHandler<KeyboardEvent<T>>;
type MouseEventHandler<T> = EventHandler<MouseEvent<T>>;
type TouchEventHandler<T> = EventHandler<TouchEvent<T>>;
type UIEventHandler<T> = EventHandler<UIEvent<T>>;
type WheelEventHandler<T> = EventHandler<WheelEvent<T>>;
type AnimationEventHandler<T> = EventHandler<AnimationEvent<T>>;
type TransitionEventHandler<T> = EventHandler<TransitionEvent<T>>;
//
// Props / DOM Attributes
// ----------------------------------------------------------------------
/**
* @deprecated. This was used to allow clients to pass `ref` and `key`
* to `createElement`, which is no longer necessary due to intersection
* types. If you need to declare a props object before passing it to
* `createElement` or a factory, use `ClassAttributes<T>`:
*
* ```ts
* var b: Button | null;
* var props: ButtonProps & ClassAttributes<Button> = {
* ref: b => button = b, // ok!
* label: "I'm a Button"
* };
* ```
*/
interface Props<T> {
children?: ReactNode;
key?: Key;
ref?: Ref<T>;
}
interface HTMLProps<T> extends AllHTMLAttributes<T>, ClassAttributes<T> {
}
type DetailedHTMLProps<E extends HTMLAttributes<T>, T> = ClassAttributes<T> & E;
interface SVGProps<T> extends SVGAttributes<T>, ClassAttributes<T> {
}
interface DOMAttributes<T> {
children?: ReactNode;
dangerouslySetInnerHTML?: {
__html: string;
};
// Clipboard Events
onCopy?: ClipboardEventHandler<T>;
onCopyCapture?: ClipboardEventHandler<T>;
onCut?: ClipboardEventHandler<T>;
onCutCapture?: ClipboardEventHandler<T>;
onPaste?: ClipboardEventHandler<T>;
onPasteCapture?: ClipboardEventHandler<T>;
// Composition Events
onCompositionEnd?: CompositionEventHandler<T>;
onCompositionEndCapture?: CompositionEventHandler<T>;
onCompositionStart?: CompositionEventHandler<T>;
onCompositionStartCapture?: CompositionEventHandler<T>;
onCompositionUpdate?: CompositionEventHandler<T>;
onCompositionUpdateCapture?: CompositionEventHandler<T>;
// Focus Events
onFocus?: FocusEventHandler<T>;
onFocusCapture?: FocusEventHandler<T>;
onBlur?: FocusEventHandler<T>;
onBlurCapture?: FocusEventHandler<T>;
// Form Events
onChange?: FormEventHandler<T>;
onChangeCapture?: FormEventHandler<T>;
onInput?: FormEventHandler<T>;
onInputCapture?: FormEventHandler<T>;
onReset?: FormEventHandler<T>;
onResetCapture?: FormEventHandler<T>;
onSubmit?: FormEventHandler<T>;
onSubmitCapture?: FormEventHandler<T>;
onInvalid?: FormEventHandler<T>;
onInvalidCapture?: FormEventHandler<T>;
// Image Events
onLoad?: ReactEventHandler<T>;
onLoadCapture?: ReactEventHandler<T>;
onError?: ReactEventHandler<T>; // also a Media Event
onErrorCapture?: ReactEventHandler<T>; // also a Media Event
// Keyboard Events
onKeyDown?: KeyboardEventHandler<T>;
onKeyDownCapture?: KeyboardEventHandler<T>;
onKeyPress?: KeyboardEventHandler<T>;
onKeyPressCapture?: KeyboardEventHandler<T>;
onKeyUp?: KeyboardEventHandler<T>;
onKeyUpCapture?: KeyboardEventHandler<T>;
// Media Events
onAbort?: ReactEventHandler<T>;
onAbortCapture?: ReactEventHandler<T>;
onCanPlay?: ReactEventHandler<T>;
onCanPlayCapture?: ReactEventHandler<T>;
onCanPlayThrough?: ReactEventHandler<T>;
onCanPlayThroughCapture?: ReactEventHandler<T>;
onDurationChange?: ReactEventHandler<T>;
onDurationChangeCapture?: ReactEventHandler<T>;
onEmptied?: ReactEventHandler<T>;
onEmptiedCapture?: ReactEventHandler<T>;
onEncrypted?: ReactEventHandler<T>;
onEncryptedCapture?: ReactEventHandler<T>;
onEnded?: ReactEventHandler<T>;
onEndedCapture?: ReactEventHandler<T>;
onLoadedData?: ReactEventHandler<T>;
onLoadedDataCapture?: ReactEventHandler<T>;
onLoadedMetadata?: ReactEventHandler<T>;
onLoadedMetadataCapture?: ReactEventHandler<T>;
onLoadStart?: ReactEventHandler<T>;
onLoadStartCapture?: ReactEventHandler<T>;
onPause?: ReactEventHandler<T>;
onPauseCapture?: ReactEventHandler<T>;
onPlay?: ReactEventHandler<T>;
onPlayCapture?: ReactEventHandler<T>;
onPlaying?: ReactEventHandler<T>;
onPlayingCapture?: ReactEventHandler<T>;
onProgress?: ReactEventHandler<T>;
onProgressCapture?: ReactEventHandler<T>;
onRateChange?: ReactEventHandler<T>;
onRateChangeCapture?: ReactEventHandler<T>;
onSeeked?: ReactEventHandler<T>;
onSeekedCapture?: ReactEventHandler<T>;
onSeeking?: ReactEventHandler<T>;
onSeekingCapture?: ReactEventHandler<T>;
onStalled?: ReactEventHandler<T>;
onStalledCapture?: ReactEventHandler<T>;
onSuspend?: ReactEventHandler<T>;
onSuspendCapture?: ReactEventHandler<T>;
onTimeUpdate?: ReactEventHandler<T>;
onTimeUpdateCapture?: ReactEventHandler<T>;
onVolumeChange?: ReactEventHandler<T>;
onVolumeChangeCapture?: ReactEventHandler<T>;
onWaiting?: ReactEventHandler<T>;
onWaitingCapture?: ReactEventHandler<T>;
// MouseEvents
onClick?: MouseEventHandler<T>;
onClickCapture?: MouseEventHandler<T>;
onContextMenu?: MouseEventHandler<T>;
onContextMenuCapture?: MouseEventHandler<T>;
onDoubleClick?: MouseEventHandler<T>;
onDoubleClickCapture?: MouseEventHandler<T>;
onDrag?: DragEventHandler<T>;
onDragCapture?: DragEventHandler<T>;
onDragEnd?: DragEventHandler<T>;
onDragEndCapture?: DragEventHandler<T>;
onDragEnter?: DragEventHandler<T>;
onDragEnterCapture?: DragEventHandler<T>;
onDragExit?: DragEventHandler<T>;
onDragExitCapture?: DragEventHandler<T>;
onDragLeave?: DragEventHandler<T>;
onDragLeaveCapture?: DragEventHandler<T>;
onDragOver?: DragEventHandler<T>;
onDragOverCapture?: DragEventHandler<T>;
onDragStart?: DragEventHandler<T>;
onDragStartCapture?: DragEventHandler<T>;
onDrop?: DragEventHandler<T>;
onDropCapture?: DragEventHandler<T>;
onMouseDown?: MouseEventHandler<T>;
onMouseDownCapture?: MouseEventHandler<T>;
onMouseEnter?: MouseEventHandler<T>;
onMouseLeave?: MouseEventHandler<T>;
onMouseMove?: MouseEventHandler<T>;
onMouseMoveCapture?: MouseEventHandler<T>;
onMouseOut?: MouseEventHandler<T>;
onMouseOutCapture?: MouseEventHandler<T>;
onMouseOver?: MouseEventHandler<T>;
onMouseOverCapture?: MouseEventHandler<T>;
onMouseUp?: MouseEventHandler<T>;
onMouseUpCapture?: MouseEventHandler<T>;
// Selection Events
onSelect?: ReactEventHandler<T>;
onSelectCapture?: ReactEventHandler<T>;
// Touch Events
onTouchCancel?: TouchEventHandler<T>;
onTouchCancelCapture?: TouchEventHandler<T>;
onTouchEnd?: TouchEventHandler<T>;
onTouchEndCapture?: TouchEventHandler<T>;
onTouchMove?: TouchEventHandler<T>;
onTouchMoveCapture?: TouchEventHandler<T>;
onTouchStart?: TouchEventHandler<T>;
onTouchStartCapture?: TouchEventHandler<T>;
// UI Events
onScroll?: UIEventHandler<T>;
onScrollCapture?: UIEventHandler<T>;
// Wheel Events
onWheel?: WheelEventHandler<T>;
onWheelCapture?: WheelEventHandler<T>;
// Animation Events
onAnimationStart?: AnimationEventHandler<T>;
onAnimationStartCapture?: AnimationEventHandler<T>;
onAnimationEnd?: AnimationEventHandler<T>;
onAnimationEndCapture?: AnimationEventHandler<T>;
onAnimationIteration?: AnimationEventHandler<T>;
onAnimationIterationCapture?: AnimationEventHandler<T>;
// Transition Events
onTransitionEnd?: TransitionEventHandler<T>;
onTransitionEndCapture?: TransitionEventHandler<T>;
}
// See CSS 3 CSS-wide keywords https://www.w3.org/TR/css3-values/#common-keywords
// See CSS 3 Explicit Defaulting https://www.w3.org/TR/css-cascade-3/#defaulting-keywords
// "all CSS properties can accept these values"
type CSSWideKeyword = "initial" | "inherit" | "unset";
// See CSS 3 <percentage> type https://drafts.csswg.org/css-values-3/#percentages
type CSSPercentage = string;
// See CSS 3 <length> type https://drafts.csswg.org/css-values-3/#lengths
type CSSLength = number | string;
// This interface is not complete. Only properties accepting
// unitless numbers are listed here (see CSSProperty.js in React)
interface CSSProperties {
/**
* Aligns a flex container's lines within the flex container when there is extra space in the cross-axis, similar to how justify-content aligns individual items within the main-axis.
*/
alignContent?: CSSWideKeyword | "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "stretch";
/**
* Sets the default alignment in the cross axis for all of the flex container's items, including anonymous flex items, similarly to how justify-content aligns items along the main axis.
*/
alignItems?: CSSWideKeyword | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
/**
* Allows the default alignment to be overridden for individual flex items.
*/
alignSelf?: CSSWideKeyword | "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
/**
* This property allows precise alignment of elements, such as graphics,
* that do not have a baseline-table or lack the desired baseline in their baseline-table.
* With the alignment-adjust property, the position of the baseline identified by the alignment-baseline
* can be explicitly determined. It also determines precisely the alignment point for each glyph within a textual element.
*/
alignmentAdjust?: CSSWideKeyword | any;
alignmentBaseline?: CSSWideKeyword | any;
/**
* Defines a length of time to elapse before an animation starts, allowing an animation to begin execution some time after it is applied.
*/
animationDelay?: CSSWideKeyword | any;
/**
* Defines whether an animation should run in reverse on some or all cycles.
*/
animationDirection?: CSSWideKeyword | any;
/**
* Specifies how many times an animation cycle should play.
*/
animationIterationCount?: CSSWideKeyword | any;
/**
* Defines the list of animations that apply to the element.
*/
animationName?: CSSWideKeyword | any;
/**
* Defines whether an animation is running or paused.
*/
animationPlayState?: CSSWideKeyword | any;
/**
* Allows changing the style of any element to platform-based interface elements or vice versa.
*/
appearance?: CSSWideKeyword | any;
/**
* Determines whether or not the “back” side of a transformed element is visible when facing the viewer.
*/
backfaceVisibility?: CSSWideKeyword | any;
/**
* Shorthand property to set the values for one or more of:
* background-clip, background-color, background-image,
* background-origin, background-position, background-repeat,
* background-size, and background-attachment.
*/
background?: CSSWideKeyword | any;
/**
* If a background-image is specified, this property determines
* whether that image's position is fixed within the viewport,
* or scrolls along with its containing block.
* See CSS 3 background-attachment property https://drafts.csswg.org/css-backgrounds-3/#the-background-attachment
*/
backgroundAttachment?: CSSWideKeyword | "scroll" | "fixed" | "local";
/**
* This property describes how the element's background images should blend with each other and the element's background color.
* The value is a list of blend modes that corresponds to each background image. Each element in the list will apply to the
* corresponding element of background-image. If a property doesn’t have enough comma-separated values to match the number of layers,
* the UA must calculate its used value by repeating the list of values until there are enough.
*/
backgroundBlendMode?: CSSWideKeyword | any;
/**
* Sets the background color of an element.
*/
backgroundColor?: CSSWideKeyword | any;
backgroundComposite?: CSSWideKeyword | any;
/**
* Applies one or more background images to an element. These can be any valid CSS image, including url() paths to image files or CSS gradients.
*/
backgroundImage?: CSSWideKeyword | any;
/**
* Specifies what the background-position property is relative to.
*/
backgroundOrigin?: CSSWideKeyword | any;
/**
* Sets the position of a background image.
*/
backgroundPosition?: CSSWideKeyword | any;
/**
* Background-repeat defines if and how background images will be repeated after they have been sized and positioned
*/
backgroundRepeat?: CSSWideKeyword | any;
/**
* Defines the size of the background images
*/
backgroundSize?: CSSWideKeyword | any;
/**
* Obsolete - spec retired, not implemented.
*/
baselineShift?: CSSWideKeyword | any;
/**
* Non standard. Sets or retrieves the location of the Dynamic HTML (DHTML) behavior.
*/
behavior?: CSSWideKeyword | any;
/**
* Shorthand property that defines the different properties of all four sides of an element's border in a single declaration.
* It can be used to set border-width, border-style and border-color, or a subset of these.
*/
border?: CSSWideKeyword | any;
/**
* Shorthand that sets the values of border-bottom-color,
* border-bottom-style, and border-bottom-width.
*/
borderBottom?: CSSWideKeyword | any;
/**
* Sets the color of the bottom border of an element.
*/
borderBottomColor?: CSSWideKeyword | any;
/**
* Defines the shape of the border of the bottom-left corner.
*/
borderBottomLeftRadius?: CSSWideKeyword | CSSLength;
/**
* Defines the shape of the border of the bottom-right corner.
*/
borderBottomRightRadius?: CSSWideKeyword | CSSLength;
/**
* Sets the line style of the bottom border of a box.
*/
borderBottomStyle?: CSSWideKeyword | any;
/**
* Sets the width of an element's bottom border. To set all four borders,
* use the border-width shorthand property which sets the values simultaneously for border-top-width,
* border-right-width, border-bottom-width, and border-left-width.
*/
borderBottomWidth?: CSSWideKeyword | any;
/**
* Border-collapse can be used for collapsing the borders between table cells
*/
borderCollapse?: CSSWideKeyword | any;
/**
* The CSS border-color property sets the color of an element's four borders.
* This property can have from one to four values, made up of the elementary properties:
* • border-top-color
* • border-right-color
* • border-bottom-color
* • border-left-color The default color is the currentColor of each of these values.
* If you provide one value, it sets the color for the element. Two values set the horizontal and vertical values,
* respectively. Providing three values sets the top, vertical, and bottom values, in that order.
* Four values set all for sides: top, right, bottom, and left, in that order.
*/
borderColor?: CSSWideKeyword | any;
/**
* Specifies different corner clipping effects, such as scoop (inner curves), bevel (straight cuts) or notch (cut-off rectangles).
* Works along with border-radius to specify the size of each corner effect.
*/
borderCornerShape?: CSSWideKeyword | any;
/**
* The property border-image-source is used to set the image to be used instead of the border style.
* If this is set to none the border-style is used instead.
*/
borderImageSource?: CSSWideKeyword | any;
/**
* The border-image-width CSS property defines the offset to use for dividing the border image in nine parts,
* the top-left corner, central top edge, top-right-corner, central right edge, bottom-right corner, central bottom edge,
* bottom-left corner, and central right edge. They represent inward distance from the top, right, bottom, and left edges.
*/
borderImageWidth?: CSSWideKeyword | any;
/**
* Shorthand property that defines the border-width, border-style and border-color of an element's left border in a single declaration.
* Note that you can use the corresponding longhand properties to set specific individual properties of the left border — border-left-width,
* border-left-style and border-left-color.
*/
borderLeft?: CSSWideKeyword | any;
/**
* The CSS border-left-color property sets the color of an element's left border. This page explains the border-left-color value,
* but often you will find it more convenient to fix the border's left color as part of a shorthand set, either border-left or border-color.
* Colors can be defined several ways. For more information, see Usage.
*/
borderLeftColor?: CSSWideKeyword | any;
/**
* Sets the style of an element's left border. To set all four borders, use the shorthand property, border-style.
* Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style.
*/
borderLeftStyle?: CSSWideKeyword | any;
/**
* Sets the width of an element's left border. To set all four borders,
* use the border-width shorthand property which sets the values simultaneously for border-top-width,
* border-right-width, border-bottom-width, and border-left-width.
*/
borderLeftWidth?: CSSWideKeyword | any;
/**
* Shorthand property that sets the rounding of all four corners.
*/
borderRadius?: CSSWideKeyword | CSSLength;
/**
* Shorthand property that defines the border-width, border-style and border-color of an element's right border
* in a single declaration. Note that you can use the corresponding longhand properties to set specific
* individual properties of the right border — border-right-width, border-right-style and border-right-color.
*/
borderRight?: CSSWideKeyword | any;
/**
* Sets the color of an element's right border. This page explains the border-right-color value,
* but often you will find it more convenient to fix the border's right color as part of a shorthand set,
* either border-right or border-color.
* Colors can be defined several ways. For more information, see Usage.
*/
borderRightColor?: CSSWideKeyword | any;
/**
* Sets the style of an element's right border. To set all four borders, use the shorthand property,
* border-style. Otherwise, you can set the borders individually with border-top-style, border-right-style,
* border-bottom-style, border-left-style.
*/
borderRightStyle?: CSSWideKeyword | any;
/**
* Sets the width of an element's right border. To set all four borders,
* use the border-width shorthand property which sets the values simultaneously for border-top-width,
* border-right-width, border-bottom-width, and border-left-width.
*/
borderRightWidth?: CSSWideKeyword | any;
/**
* Specifies the distance between the borders of adjacent cells.
*/
borderSpacing?: CSSWideKeyword | any;
/**
* Sets the style of an element's four borders. This property can have from one to four values.
* With only one value, the value will be applied to all four borders;
* otherwise, this works as a shorthand property for each of border-top-style, border-right-style,
* border-bottom-style, border-left-style, where each border style may be assigned a separate value.
*/
borderStyle?: CSSWideKeyword | any;
/**
* Shorthand property that defines the border-width, border-style and border-color of an element's top border
* in a single declaration. Note that you can use the corresponding longhand properties to set specific
* individual properties of the top border — border-top-width, border-top-style and border-top-color.
*/
borderTop?: CSSWideKeyword | any;
/**
* Sets the color of an element's top border. This page explains the border-top-color value,
* but often you will find it more convenient to fix the border's top color as part of a shorthand set,
* either border-top or border-color.
* Colors can be defined several ways. For more information, see Usage.
*/
borderTopColor?: CSSWideKeyword | any;
/**
* Sets the rounding of the top-left corner of the element.
*/
borderTopLeftRadius?: CSSWideKeyword | CSSLength;
/**
* Sets the rounding of the top-right corner of the element.
*/
borderTopRightRadius?: CSSWideKeyword | CSSLength;
/**
* Sets the style of an element's top border. To set all four borders, use the shorthand property, border-style.
* Otherwise, you can set the borders individually with border-top-style, border-right-style, border-bottom-style, border-left-style.
*/
borderTopStyle?: CSSWideKeyword | any;
/**
* Sets the width of an element's top border. To set all four borders,
* use the border-width shorthand property which sets the values simultaneously for border-top-width,
* border-right-width, border-bottom-width, and border-left-width.
*/
borderTopWidth?: CSSWideKeyword | any;
/**
* Sets the width of an element's four borders. This property can have from one to four values.
* This is a shorthand property for setting values simultaneously for border-top-width,
* border-right-width, border-bottom-width, and border-left-width.
*/
borderWidth?: CSSWideKeyword | any;
/**
* This property specifies how far an absolutely positioned box's bottom margin edge
* is offset above the bottom edge of the box's containing block. For relatively positioned boxes,
* the offset is with respect to the bottom edges of the box itself
* (i.e., the box is given a position in the normal flow, then offset from that position according to these properties).
*/
bottom?: CSSWideKeyword | any;
/**
* Obsolete.
*/
boxAlign?: CSSWideKeyword | any;
/**
* Breaks a box into fragments creating new borders,
* padding and repeating backgrounds or lets it stay as a continuous box on a page break,
* column break, or, for inline elements, at a line break.
*/
boxDecorationBreak?: CSSWideKeyword | any;
/**
* Deprecated
*/
boxDirection?: CSSWideKeyword | any;
/**
* Do not use. This property has been replaced by the flex-wrap property.
* Gets or sets a value that specifies the direction to add successive rows or columns when the value of box-lines is set to multiple.
*/
boxLineProgression?: CSSWideKeyword | any;
/**
* Do not use. This property has been replaced by the flex-wrap property.
* Gets or sets a value that specifies whether child elements wrap onto multiple lines or columns based on the space available in the object.
*/
boxLines?: CSSWideKeyword | any;
/**
* Do not use. This property has been replaced by flex-order.
* Specifies the ordinal group that a child element of the object belongs to.
* This ordinal value identifies the display order (along the axis defined by the box-orient property) for the group.
*/
boxOrdinalGroup?: CSSWideKeyword | any;
/**
* Deprecated.
*/
boxFlex?: CSSWideKeyword | number;
/**
* Deprecated.
*/
boxFlexGroup?: CSSWideKeyword | number;
/**
* Cast a drop shadow from the frame of almost any element.
* MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow
*/
boxShadow?: CSSWideKeyword | any;
/**
* The CSS break-after property allows you to force a break on multi-column layouts.
* More specifically, it allows you to force a break after an element.
* It allows you to determine if a break should occur, and what type of break it should be.
* The break-after CSS property describes how the page, column or region break behaves after the generated box.
* If there is no generated box, the property is ignored.
*/
breakAfter?: CSSWideKeyword | any;
/**
* Control page/column/region breaks that fall above a block of content
*/
breakBefore?: CSSWideKeyword | any;
/**
* Control page/column/region breaks that fall within a block of content
*/
breakInside?: CSSWideKeyword | any;
/**
* The clear CSS property specifies if an element can be positioned next to
* or must be positioned below the floating elements that precede it in the markup.
*/
clear?: CSSWideKeyword | any;
/**
* Deprecated; see clip-path.
* Lets you specify the dimensions of an absolutely positioned element that should be visible,
* and the element is clipped into this shape, and displayed.
*/
clip?: CSSWideKeyword | any;
/**
* Clipping crops an graphic, so that only a portion of the graphic is rendered, or filled.
* This clip-rule property, when used with the clip-path property, defines which clip rule, or algorithm,
* to use when filling the different parts of a graphics.
*/
clipRule?: CSSWideKeyword | any;
/**
* The color property sets the color of an element's foreground content (usually text),
* accepting any standard CSS color from keywords and hex values to RGB(a) and HSL(a).
*/
color?: CSSWideKeyword | any;
/**
* Describes the number of columns of the element.
* See CSS 3 column-count property https://www.w3.org/TR/css3-multicol/#cc
*/
columnCount?: CSSWideKeyword | number | "auto";
/**
* Specifies how to fill columns (balanced or sequential).
*/
columnFill?: CSSWideKeyword | any;
/**
* The column-gap property controls the width of the gap between columns in multi-column elements.
*/
columnGap?: CSSWideKeyword | any;
/**
* Sets the width, style, and color of the rule between columns.
*/
columnRule?: CSSWideKeyword | any;
/**
* Specifies the color of the rule between columns.
*/
columnRuleColor?: CSSWideKeyword | any;
/**
* Specifies the width of the rule between columns.
*/
columnRuleWidth?: CSSWideKeyword | any;
/**
* The column-span CSS property makes it possible for an element to span across all columns when its value is set to all.
* An element that spans more than one column is called a spanning element.
*/
columnSpan?: CSSWideKeyword | any;
/**
* Specifies the width of columns in multi-column elements.
*/
columnWidth?: CSSWideKeyword | any;
/**
* This property is a shorthand property for setting column-width and/or column-count.
*/
columns?: CSSWideKeyword | any;
/**
* The counter-increment property accepts one or more names of counters (identifiers),
* each one optionally followed by an integer which specifies the value by which the counter should be incremented
* (e.g. if the value is 2, the counter increases by 2 each time it is invoked).
*/
counterIncrement?: CSSWideKeyword | any;
/**
* The counter-reset property contains a list of one or more names of counters,
* each one optionally followed by an integer (otherwise, the integer defaults to 0.).
* Each time the given element is invoked, the counters specified by the property are set to the given integer.
*/
counterReset?: CSSWideKeyword | any;
/**
* The cue property specifies sound files (known as an "auditory icon") to be played by speech media agents
* before and after presenting an element's content; if only one file is specified, it is played both before and after.
* The volume at which the file(s) should be played, relative to the volume of the main element, may also be specified.
* The icon files may also be set separately with the cue-before and cue-after properties.
*/
cue?: CSSWideKeyword | any;
/**
* The cue-after property specifies a sound file (known as an "auditory icon") to be played by speech media agents
* after presenting an element's content; the volume at which the file should be played may also be specified.
* The shorthand property cue sets cue sounds for both before and after the element is presented.
*/
cueAfter?: CSSWideKeyword | any;
/**
* Specifies the mouse cursor displayed when the mouse pointer is over an element.
*/
cursor?: CSSWideKeyword | any;
/**
* The direction CSS property specifies the text direction/writing direction. The rtl is used for Hebrew or Arabic text, the ltr is for other languages.
*/
direction?: CSSWideKeyword | any;
/**
* This property specifies the type of rendering box used for an element. It is a shorthand property for many other display properties.
*/
display?: CSSWideKeyword | any;
/**
* The ‘fill’ property paints the interior of the given graphical element.
* The area to be painted consists of any areas inside the outline of the shape.
* To determine the inside of the shape, all subpaths are considered,
* and the interior is determined according to the rules associated with the current value of the ‘fill-rule’ property.
* The zero-width geometric outline of a shape is included in the area to be painted.
*/
fill?: CSSWideKeyword | any;
/**
* SVG: Specifies the opacity of the color or the content the current object is filled with.
* See SVG 1.1 https://www.w3.org/TR/SVG/painting.html#FillOpacityProperty
*/
fillOpacity?: CSSWideKeyword | number;
/**
* The ‘fill-rule’ property indicates the algorithm which is to be used to determine what parts of the canvas are included inside the shape.
* For a simple, non-intersecting path, it is intuitively clear what region lies "inside";
* however, for a more complex path, such as a path that intersects itself or where one subpath encloses another,
* the interpretation of "inside" is not so obvious.
* The ‘fill-rule’ property provides two options for how the inside of a shape is determined:
*/
fillRule?: CSSWideKeyword | any;
/**
* Applies various image processing effects. This property is largely unsupported. See Compatibility section for more information.
*/
filter?: CSSWideKeyword | any;
/**
* Shorthand for `flex-grow`, `flex-shrink`, and `flex-basis`.
*/
flex?: CSSWideKeyword | number | string;
/**
* Obsolete, do not use. This property has been renamed to align-items.
* Specifies the alignment (perpendicular to the layout axis defined by the flex-direction property) of child elements of the object.
*/
flexAlign?: CSSWideKeyword | any;
/**
* The flex-basis CSS property describes the initial main size of the flex item
* before any free space is distributed according to the flex factors described in the flex property (flex-grow and flex-shrink).
*/
flexBasis?: CSSWideKeyword | any;
/**
* The flex-direction CSS property describes how flex items are placed in the flex container, by setting the direction of the flex container's main axis.
*/
flexDirection?: CSSWideKeyword | "row" | "row-reverse" | "column" | "column-reverse";
/**
* The flex-flow CSS property defines the flex container's main and cross axis. It is a shorthand property for the flex-direction and flex-wrap properties.
*/
flexFlow?: CSSWideKeyword | string;
/**
* Specifies the flex grow factor of a flex item.
* See CSS flex-grow property https://drafts.csswg.org/css-flexbox-1/#flex-grow-property
*/
flexGrow?: CSSWideKeyword | number;
/**
* Do not use. This property has been renamed to align-self
* Specifies the alignment (perpendicular to the layout axis defined by flex-direction) of child elements of the object.
*/
flexItemAlign?: CSSWideKeyword | any;
/**
* Do not use. This property has been renamed to align-content.
* Specifies how a flexbox's lines align within the flexbox when there is extra space along the axis that is perpendicular to the axis defined by the flex-direction property.
*/
flexLinePack?: CSSWideKeyword | any;
/**
* Gets or sets a value that specifies the ordinal group that a flexbox element belongs to. This ordinal value identifies the display order for the group.
*/
flexOrder?: CSSWideKeyword | any;
/**
* Specifies the flex shrink factor of a flex item.
* See CSS flex-shrink property https://drafts.csswg.org/css-flexbox-1/#flex-shrink-property
*/
flexShrink?: CSSWideKeyword | number;
/**
* Specifies whether flex items are forced into a single line or can be wrapped onto multiple lines.
* If wrapping is allowed, this property also enables you to control the direction in which lines are stacked.
* See CSS flex-wrap property https://drafts.csswg.org/css-flexbox-1/#flex-wrap-property
*/
flexWrap?: CSSWideKeyword | "nowrap" | "wrap" | "wrap-reverse";
/**
* Elements which have the style float are floated horizontally.
* These elements can move as far to the left or right of the containing element.
* All elements after the floating element will flow around it, but elements before the floating element are not impacted.
* If several floating elements are placed after each other, they will float next to each other as long as there is room.
*/
float?: CSSWideKeyword | any;
/**
* Flows content from a named flow (specified by a corresponding flow-into) through selected elements to form a dynamic chain of layout regions.
*/
flowFrom?: CSSWideKeyword | any;
/**
* The font property is shorthand that allows you to do one of two things: you can either set up six of the most mature font properties in one line,
* or you can set one of a choice of keywords to adopt a system font setting.
*/
font?: CSSWideKeyword | any;
/**
* The font-family property allows one or more font family names and/or generic family names to be specified for usage on the selected element(s)' text.
* The browser then goes through the list; for each character in the selection it applies the first font family that has an available glyph for that character.
*/
fontFamily?: CSSWideKeyword | any;
/**
* The font-kerning property allows contextual adjustment of inter-glyph spacing, i.e. the spaces between the characters in text.
* This property controls <bold>metric kerning</bold> - that utilizes adjustment data contained in the font. Optical Kerning is not supported as yet.
*/
fontKerning?: CSSWideKeyword | any;
/**
* Specifies the size of the font. Used to compute em and ex units.
* See CSS 3 font-size property https://www.w3.org/TR/css-fonts-3/#propdef-font-size
*/
fontSize?: CSSWideKeyword |
"xx-small" | "x-small" | "small" | "medium" | "large" | "x-large" | "xx-large" |
"larger" | "smaller" |
CSSLength | CSSPercentage;
/**
* The font-size-adjust property adjusts the font-size of the fallback fonts defined with font-family,
* so that the x-height is the same no matter what font is used.
* This preserves the readability of the text when fallback happens.
* See CSS 3 font-size-adjust property https://www.w3.org/TR/css-fonts-3/#propdef-font-size-adjust
*/
fontSizeAdjust?: CSSWideKeyword | "none" | number;
/**
* Allows you to expand or condense the widths for a normal, condensed, or expanded font face.
* See CSS 3 font-stretch property https://drafts.csswg.org/css-fonts-3/#propdef-font-stretch
*/
fontStretch?: CSSWideKeyword |
"normal" | "ultra-condensed" | "extra-condensed" | "condensed" | "semi-condensed" |
"semi-expanded" | "expanded" | "extra-expanded" | "ultra-expanded";
/**
* The font-style property allows normal, italic, or oblique faces to be selected.
* Italic forms are generally cursive in nature while oblique faces are typically sloped versions of the regular face.
* Oblique faces can be simulated by artificially sloping the glyphs of the regular face.
* See CSS 3 font-style property https://www.w3.org/TR/css-fonts-3/#propdef-font-style
*/
fontStyle?: CSSWideKeyword | "normal" | "italic" | "oblique";
/**
* This value specifies whether the user agent is allowed to synthesize bold or oblique font faces when a font family lacks bold or italic faces.
*/
fontSynthesis?: CSSWideKeyword | any;
/**
* The font-variant property enables you to select the small-caps font within a font family.
*/
fontVariant?: CSSWideKeyword | any;
/**
* Fonts can provide alternate glyphs in addition to default glyph for a character. This property provides control over the selection of these alternate glyphs.
*/
fontVariantAlternates?: CSSWideKeyword | any;
/**
* Specifies the weight or boldness of the font.
* See CSS 3 'font-weight' property https://www.w3.org/TR/css-fonts-3/#propdef-font-weight
*/
fontWeight?: CSSWideKeyword | "normal" | "bold" | "bolder" | "lighter" | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
/**
* Lays out one or more grid items bound by 4 grid lines. Shorthand for setting grid-column-start, grid-column-end, grid-row-start, and grid-row-end in a single declaration.
*/
gridArea?: CSSWideKeyword | any;
/**
* Controls a grid item's placement in a grid area, particularly grid position and a grid span. Shorthand for setting grid-column-start and grid-column-end in a single declaration.
*/
gridColumn?: CSSWideKeyword | any;
/**
* Controls a grid item's placement in a grid area as well as grid position and a grid span.
* The grid-column-end property (with grid-row-start, grid-row-end, and grid-column-start) determines a grid item's placement by specifying the grid lines of a grid item's grid area.
*/
gridColumnEnd?: CSSWideKeyword | any;
/**
* Determines a grid item's placement by specifying the starting grid lines of a grid item's grid area.
* A grid item's placement in a grid area consists of a grid position and a grid span.
* See also ( grid-row-start, grid-row-end, and grid-column-end)
*/
gridColumnStart?: CSSWideKeyword | any;
/**
* Gets or sets a value that indicates which row an element within a Grid should appear in. Shorthand for setting grid-row-start and grid-row-end in a single declaration.
*/
gridRow?: CSSWideKeyword | any;
/**
* Determines a grid item’s placement by specifying the block-end. A grid item's placement in a grid area consists of a grid position and a grid span.
* The grid-row-end property (with grid-row-start, grid-column-start, and grid-column-end) determines a grid item's placement by specifying the grid lines of a grid item's grid area.
*/
gridRowEnd?: CSSWideKeyword | any;
/**
* Specifies a row position based upon an integer location, string value, or desired row size.
* css/properties/grid-row is used as short-hand for grid-row-position and grid-row-position
*/
gridRowPosition?: CSSWideKeyword | any;
gridRowSpan?: CSSWideKeyword | any;
/**
* Specifies named grid areas which are not associated with any particular grid item, but can be referenced from the grid-placement properties.
* The syntax of the grid-template-areas property also provides a visualization of the structure of the grid, making the overall layout of the grid container easier to understand.
*/
gridTemplateAreas?: CSSWideKeyword | any;
/**
* Specifies (with grid-template-rows) the line names and track sizing functions of the grid.
* Each sizing function can be specified as a length, a percentage of the grid container’s size,
* a measurement of the contents occupying the column or row, or a fraction of the free space in the grid.
*/
gridTemplateColumns?: CSSWideKeyword | any;
/**
* Specifies (with grid-template-columns) the line names and track sizing functions of the grid.
* Each sizing function can be specified as a length, a percentage of the grid container’s size,
* a measurement of the contents occupying the column or row, or a fraction of the free space in the grid.
*/
gridTemplateRows?: CSSWideKeyword | any;
/**
* Sets the height of an element. The content area of the element height does not include the padding, border, and margin of the element.
*/
height?: CSSWideKeyword | any;
/**
* Specifies the minimum number of characters in a hyphenated word
*/
hyphenateLimitChars?: CSSWideKeyword | any;
/**
* Indicates the maximum number of successive hyphenated lines in an element. The ‘no-limit’ value means that there is no limit.
*/
hyphenateLimitLines?: CSSWideKeyword | any;
/**
* Specifies the maximum amount of trailing whitespace (before justification) that may be left in a line before hyphenation is triggered
* to pull part of a word from the next line back up into the current one.
*/
hyphenateLimitZone?: CSSWideKeyword | any;
/**
* Specifies whether or not words in a sentence can be split by the use of a manual or automatic hyphenation mechanism.
*/
hyphens?: CSSWideKeyword | any;
imeMode?: CSSWideKeyword | any;
/**
* Defines how the browser distributes space between and around flex items
* along the main-axis of their container.
* See CSS justify-content property https://www.w3.org/TR/css-flexbox-1/#justify-content-property
*/
justifyContent?: CSSWideKeyword | "flex-start" | "flex-end" | "center" | "space-between" | "space-around" | "space-evenly";
layoutGrid?: CSSWideKeyword | any;
layoutGridChar?: CSSWideKeyword | any;
layoutGridLine?: CSSWideKeyword | any;
layoutGridMode?: CSSWideKeyword | any;
layoutGridType?: CSSWideKeyword | any;
/**
* Sets the left edge of an element
*/
left?: CSSWideKeyword | any;
/**
* The letter-spacing CSS property specifies the spacing behavior between text characters.
*/
letterSpacing?: CSSWideKeyword | any;
/**
* Deprecated. Gets or sets line-breaking rules for text in selected languages such as Japanese, Chinese, and Korean.
*/
lineBreak?: CSSWideKeyword | any;
lineClamp?: CSSWideKeyword | number;
/**
* Specifies the height of an inline block level element.
* See CSS 2.1 line-height property https://www.w3.org/TR/CSS21/visudet.html#propdef-line-height
*/
lineHeight?: CSSWideKeyword | "normal" | number | CSSLength | CSSPercentage;
/**
* Shorthand property that sets the list-style-type, list-style-position and list-style-image properties in one declaration.
*/
listStyle?: CSSWideKeyword | any;
/**
* This property sets the image that will be used as the list item marker. When the image is available,
* it will replace the marker set with the 'list-style-type' marker. That also means that if the image is not available,
* it will show the style specified by list-style-property
*/
listStyleImage?: CSSWideKeyword | any;
/**
* Specifies if the list-item markers should appear inside or outside the content flow.
*/
listStylePosition?: CSSWideKeyword | any;
/**
* Specifies the type of list-item marker in a list.
*/
listStyleType?: CSSWideKeyword | any;
/**
* The margin property is shorthand to allow you to set all four margins of an element at once.
* Its equivalent longhand properties are margin-top, margin-right, margin-bottom and margin-left.
* Negative values are also allowed.
*/
margin?: CSSWideKeyword | any;
/**
* margin-bottom sets the bottom margin of an element.
*/
marginBottom?: CSSWideKeyword | any;
/**
* margin-left sets the left margin of an element.
*/
marginLeft?: CSSWideKeyword | any;
/**
* margin-right sets the right margin of an element.
*/
marginRight?: CSSWideKeyword | any;
/**
* margin-top sets the top margin of an element.
*/
marginTop?: CSSWideKeyword | any;
/**
* The marquee-direction determines the initial direction in which the marquee content moves.
*/
marqueeDirection?: CSSWideKeyword | any;
/**
* The 'marquee-style' property determines a marquee's scrolling behavior.
*/
marqueeStyle?: CSSWideKeyword | any;
/**
* This property is shorthand for setting mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-composite and mask-size.
* Omitted values are set to their original properties' initial values.
*/
mask?: CSSWideKeyword | any;
/**
* This property is shorthand for setting mask-border-source, mask-border-slice, mask-border-width, mask-border-outset, and mask-border-repeat.
* Omitted values are set to their original properties' initial values.
*/
maskBorder?: CSSWideKeyword | any;
/**
* This property specifies how the images for the sides and the middle part of the mask image are scaled and tiled.
* The first keyword applies to the horizontal sides, the second one applies to the vertical ones.
* If the second keyword is absent, it is assumed to be the same as the first, similar to the CSS border-image-repeat property.
*/
maskBorderRepeat?: CSSWideKeyword | any;
/**
* This property specifies inward offsets from the top, right, bottom, and left edges of the mask image,
* dividing it into nine regions: four corners, four edges, and a middle.
* The middle image part is discarded and treated as fully transparent black unless the fill keyword is present.
* The four values set the top, right, bottom and left offsets in that order, similar to the CSS border-image-slice property.
*/
maskBorderSlice?: CSSWideKeyword | any;
/**
* Specifies an image to be used as a mask. An image that is empty, fails to download, is non-existent, or cannot be displayed is ignored and does not mask the element.
*/
maskBorderSource?: CSSWideKeyword | any;
/**
* This property sets the width of the mask box image, similar to the CSS border-image-width property.
*/
maskBorderWidth?: CSSWideKeyword | any;
/**
* Determines the mask painting area, which defines the area that is affected by the mask.
* The painted content of an element may be restricted to this area.
*/
maskClip?: CSSWideKeyword | any;
/**
* For elements rendered as a single box, specifies the mask positioning area.
* For elements rendered as multiple boxes (e.g., inline boxes on several lines, boxes on several pages)
* specifies which boxes box-decoration-break operates on to determine the mask positioning area(s).
*/
maskOrigin?: CSSWideKeyword | any;
/**
* This property must not be used. It is no longer included in any standard or standard track specification,
* nor is it implemented in any browser. It is only used when the text-align-last property is set to size.
* It controls allowed adjustments of font-size to fit line content.
*/
maxFontSize?: CSSWideKeyword | any;
/**
* Sets the maximum height for an element. It prevents the height of the element to exceed the specified value.
* If min-height is specified and is greater than max-height, max-height is overridden.
*/
maxHeight?: CSSWideKeyword | any;
/**
* Sets the maximum width for an element. It limits the width property to be larger than the value specified in max-width.
*/
maxWidth?: CSSWideKeyword | any;
/**
* Sets the minimum height for an element. It prevents the height of the element to be smaller than the specified value.
* The value of min-height overrides both max-height and height.
*/
minHeight?: CSSWideKeyword | any;
/**
* Sets the minimum width of an element. It limits the width property to be not smaller than the value specified in min-width.
*/
minWidth?: CSSWideKeyword | any;
/**
* Specifies the transparency of an element.
* See CSS 3 opacity property https://drafts.csswg.org/css-color-3/#opacity
*/
opacity?: CSSWideKeyword | number;
/**
* Specifies the order used to lay out flex items in their flex container.
* Elements are laid out in the ascending order of the order value.
* See CSS order property https://drafts.csswg.org/css-flexbox-1/#order-property
*/
order?: CSSWideKeyword | number;
/**
* In paged media, this property defines the minimum number of lines in
* a block container that must be left at the bottom of the page.
* See CSS 3 orphans, widows properties https://drafts.csswg.org/css-break-3/#widows-orphans
*/
orphans?: CSSWideKeyword | number;
/**
* The CSS outline property is a shorthand property for setting one or more of the individual outline properties outline-style,
* outline-width and outline-color in a single rule. In most cases the use of this shortcut is preferable and more convenient.
* Outlines differ from borders in the following ways:
* • Outlines do not take up space, they are drawn above the content.
* • Outlines may be non-rectangular. They are rectangular in Gecko/Firefox.
* Internet Explorer attempts to place the smallest contiguous outline around all elements or shapes that are indicated to have an outline.
* Opera draws a non-rectangular shape around a construct.
*/
outline?: CSSWideKeyword | any;
/**
* The outline-color property sets the color of the outline of an element. An outline is a line that is drawn around elements, outside the border edge, to make the element stand out.
*/
outlineColor?: CSSWideKeyword | any;
/**
* The outline-offset property offsets the outline and draw it beyond the border edge.
*/
outlineOffset?: CSSWideKeyword | any;
/**
* The overflow property controls how extra content exceeding the bounding box of an element is rendered.
* It can be used in conjunction with an element that has a fixed width and height, to eliminate text-induced page distortion.
*/
overflow?: CSSWideKeyword | "auto" | "hidden" | "scroll" | "visible";
/**
* Specifies the preferred scrolling methods for elements that overflow.
*/
overflowStyle?: CSSWideKeyword | any;
/**
* Controls how extra content exceeding the x-axis of the bounding box of an element is rendered.
*/
overflowX?: CSSWideKeyword | "auto" | "hidden" | "scroll" | "visible";
/**
* Controls how extra content exceeding the y-axis of the bounding box of an element is rendered.
*/
overflowY?: CSSWideKeyword | "auto" | "hidden" | "scroll" | "visible";
/**
* The padding optional CSS property sets the required padding space on one to four sides of an element.
* The padding area is the space between an element and its border. Negative values are not allowed but decimal values are permitted.
* The element size is treated as fixed, and the content of the element shifts toward the center as padding is increased.
* The padding property is a shorthand to avoid setting each side separately (padding-top, padding-right, padding-bottom, padding-left).
*/
padding?: CSSWideKeyword | any;
/**
* The padding-bottom CSS property of an element sets the padding space required on the bottom of an element.
* The padding area is the space between the content of the element and its border.
* Contrary to margin-bottom values, negative values of padding-bottom are invalid.
*/
paddingBottom?: CSSWideKeyword | any;
/**
* The padding-left CSS property of an element sets the padding space required on the left side of an element.
* The padding area is the space between the content of the element and its border.
* Contrary to margin-left values, negative values of padding-left are invalid.
*/
paddingLeft?: CSSWideKeyword | any;
/**
* The padding-right CSS property of an element sets the padding space required on the right side of an element.
* The padding area is the space between the content of the element and its border.
* Contrary to margin-right values, negative values of padding-right are invalid.
*/
paddingRight?: CSSWideKeyword | any;
/**
* The padding-top CSS property of an element sets the padding space required on the top of an element.
* The padding area is the space between the content of the element and its border.
* Contrary to margin-top values, negative values of padding-top are invalid.
*/
paddingTop?: CSSWideKeyword | any;
/**
* The page-break-after property is supported in all major browsers. With CSS3, page-break-* properties are only aliases of the break-* properties.
* The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation.
*/
pageBreakAfter?: CSSWideKeyword | any;
/**
* The page-break-before property sets the page-breaking behavior before an element.
* With CSS3, page-break-* properties are only aliases of the break-* properties.
* The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation.
*/
pageBreakBefore?: CSSWideKeyword | any;
/**
* Sets the page-breaking behavior inside an element. With CSS3, page-break-* properties are only aliases of the break-* properties.
* The CSS3 Fragmentation spec defines breaks for all CSS box fragmentation.
*/
pageBreakInside?: CSSWideKeyword | any;
/**
* The pause property determines how long a speech media agent should pause before and after presenting an element.
* It is a shorthand for the pause-before and pause-after properties.
*/
pause?: CSSWideKeyword | any;
/**
* The pause-after property determines how long a speech media agent should pause after presenting an element.
* It may be replaced by the shorthand property pause, which sets pause time before and after.
*/
pauseAfter?: CSSWideKeyword | any;
/**
* The pause-before property determines how long a speech media agent should pause before presenting an element.
* It may be replaced by the shorthand property pause, which sets pause time before and after.
*/
pauseBefore?: CSSWideKeyword | any;
/**
* The perspective property defines how far an element is placed from the view on the z-axis, from the screen to the viewer.
* Perspective defines how an object is viewed. In graphic arts, perspective is the representation on a flat surface of what the viewer's eye would see in a 3D space.
* (See Wikipedia for more information about graphical perspective and for related illustrations.)
* The illusion of perspective on a flat surface, such as a computer screen,
* is created by projecting points on the flat surface as they would appear if the flat surface were a window
* through which the viewer was looking at the object. In discussion of virtual environments, this flat surface is called a projection plane.
*/
perspective?: CSSWideKeyword | any;
/**
* The perspective-origin property establishes the origin for the perspective property.
* It effectively sets the X and Y position at which the viewer appears to be looking at the children of the element.
* When used with perspective, perspective-origin changes the appearance of an object,
* as if a viewer were looking at it from a different origin.
* An object appears differently if a viewer is looking directly at it versus looking at it from below, above, or from the side.
* Thus, the perspective-origin is like a vanishing point.
* The default value of perspective-origin is 50% 50%.
* This displays an object as if the viewer's eye were positioned directly at the center of the screen, both top-to-bottom and left-to-right.
* A value of 0% 0% changes the object as if the viewer was looking toward the top left angle.
* A value of 100% 100% changes the appearance as if viewed toward the bottom right angle.
*/
perspectiveOrigin?: CSSWideKeyword | any;
/**
* The pointer-events property allows you to control whether an element can be the target for the pointing device (e.g, mouse, pen) events.
*/
pointerEvents?: CSSWideKeyword | any;
/**
* The position property controls the type of positioning used by an element within its parent elements.
* The effect of the position property depends on a lot of factors, for example the position property of parent elements.
*/
position?: CSSWideKeyword | "static" | "relative" | "absolute" | "fixed" | "sticky";
/**
* Obsolete: unsupported.
* This property determines whether or not a full-width punctuation mark character should be trimmed if it appears at the beginning of a line,
* so that its "ink" lines up with the first glyph in the line above and below.
*/
punctuationTrim?: CSSWideKeyword | any;
/**
* Sets the type of quotation marks for embedded quotations.
*/
quotes?: CSSWideKeyword | any;
/**
* Controls whether the last region in a chain displays additional 'overset' content according its default overflow property,
* or if it displays a fragment of content as if it were flowing into a subsequent region.
*/
regionFragment?: CSSWideKeyword | any;
/**
* The rest-after property determines how long a speech media agent should pause after presenting an element's main content,
* before presenting that element's exit cue sound. It may be replaced by the shorthand property rest, which sets rest time before and after.
*/
restAfter?: CSSWideKeyword | any;
/**
* The rest-before property determines how long a speech media agent should pause after presenting an intro cue sound for an element,
* before presenting that element's main content. It may be replaced by the shorthand property rest, which sets rest time before and after.
*/
restBefore?: CSSWideKeyword | any;
/**
* Specifies the position an element in relation to the right side of the containing element.
*/
right?: CSSWideKeyword | any;
rubyAlign?: CSSWideKeyword | any;
rubyPosition?: CSSWideKeyword | any;
/**
* Defines the alpha channel threshold used to extract a shape from an image. Can be thought of as a "minimum opacity" threshold;
* that is, a value of 0.5 means that the shape will enclose all the pixels that are more than 50% opaque.
*/
shapeImageThreshold?: CSSWideKeyword | any;
/**
* A future level of CSS Shapes will define a shape-inside property, which will define a shape to wrap content within the element.
* See Editor's Draft <http://dev.w3.org/csswg/css-shapes/> and CSSWG wiki page on next-level plans <http://wiki.csswg.org/spec/css-shapes>
*/
shapeInside?: CSSWideKeyword | any;
/**
* Adds a margin to a shape-outside. In effect, defines a new shape that is the smallest contour around all the points
* that are the shape-margin distance outward perpendicular to each point on the underlying shape.
* For points where a perpendicular direction is not defined (e.g., a triangle corner),
* takes all points on a circle centered at the point and with a radius of the shape-margin distance.
* This property accepts only non-negative values.
*/
shapeMargin?: CSSWideKeyword | any;
/**
* Declares a shape around which text should be wrapped, with possible modifications from the shape-margin property.
* The shape defined by shape-outside and shape-margin changes the geometry of a float element's float area.
*/
shapeOutside?: CSSWideKeyword | any;
/**
* The speak property determines whether or not a speech synthesizer will read aloud the contents of an element.
*/
speak?: CSSWideKeyword | any;
/**
* The speak-as property determines how the speech synthesizer interprets the content: words as whole words or as a sequence of letters,
* numbers as a numerical value or a sequence of digits, punctuation as pauses in speech or named punctuation characters.
*/
speakAs?: CSSWideKeyword | any;
/**
* SVG: Specifies the opacity of the outline on the current object.
* See SVG 1.1 https://www.w3.org/TR/SVG/painting.html#StrokeOpacityProperty
*/
strokeOpacity?: CSSWideKeyword | number;
/**
* SVG: Specifies the width of the outline on the current object.
* See SVG 1.1 https://www.w3.org/TR/SVG/painting.html#StrokeWidthProperty
*/
strokeWidth?: CSSWideKeyword | CSSPercentage | CSSLength;
/**
* The tab-size CSS property is used to customise the width of a tab (U+0009) character.
*/
tabSize?: CSSWideKeyword | any;
/**
* The 'table-layout' property controls the algorithm used to lay out the table cells, rows, and columns.
*/
tableLayout?: CSSWideKeyword | any;
/**
* The text-align CSS property describes how inline content like text is aligned in its parent block element.
* text-align does not control the alignment of block elements itself, only their inline content.
*/
textAlign?: CSSWideKeyword | any;
/**
* The text-align-last CSS property describes how the last line of a block element or a line before line break is aligned in its parent block element.
*/
textAlignLast?: CSSWideKeyword | any;
/**
* The text-decoration CSS property is used to set the text formatting to underline, overline, line-through or blink.
* underline and overline decorations are positioned under the text, line-through over it.
*/
textDecoration?: CSSWideKeyword | any;
/**
* Sets the color of any text decoration, such as underlines, overlines, and strike throughs.
*/
textDecorationColor?: CSSWideKeyword | any;
/**
* Sets what kind of line decorations are added to an element, such as underlines, overlines, etc.
*/
textDecorationLine?: CSSWideKeyword | any;
textDecorationLineThrough?: CSSWideKeyword | any;
textDecorationNone?: CSSWideKeyword | any;
textDecorationOverline?: CSSWideKeyword | any;
/**
* Specifies what parts of an element’s content are skipped over when applying any text decoration.
*/
textDecorationSkip?: CSSWideKeyword | any;
/**
* This property specifies the style of the text decoration line drawn on the specified element.
* The intended meaning for the values are the same as those of the border-style-properties.
*/
textDecorationStyle?: CSSWideKeyword | any;
textDecorationUnderline?: CSSWideKeyword | any;
/**
* The text-emphasis property will apply special emphasis marks to the elements text.
* Slightly similar to the text-decoration property only that this property can have affect on the line-height.
* It also is noted that this is shorthand for text-emphasis-style and for text-emphasis-color.
*/
textEmphasis?: CSSWideKeyword | any;
/**
* The text-emphasis-color property specifies the foreground color of the emphasis marks.
*/
textEmphasisColor?: CSSWideKeyword | any;
/**
* The text-emphasis-style property applies special emphasis marks to an element's text.
*/
textEmphasisStyle?: CSSWideKeyword | any;
/**
* This property helps determine an inline box's block-progression dimension,
* derived from the text-height and font-size properties for non-replaced elements,
* the height or the width for replaced elements, and the stacked block-progression dimension for inline-block elements.
* The block-progression dimension determines the position of the padding, border and margin for the element.
*/
textHeight?: CSSWideKeyword | any;
/**
* Specifies the amount of space horizontally that should be left on the first line of the text of an element.
* This horizontal spacing is at the beginning of the first line and is in respect to the left edge of the containing block box.
*/
textIndent?: CSSWideKeyword | any;
textJustifyTrim?: CSSWideKeyword | any;
textKashidaSpace?: CSSWideKeyword | any;
/**
* The text-line-through property is a shorthand property for text-line-through-style, text-line-through-color and text-line-through-mode.
* (Considered obsolete; use text-decoration instead.)
*/
textLineThrough?: CSSWideKeyword | any;
/**
* Specifies the line colors for the line-through text decoration.
* (Considered obsolete; use text-decoration-color instead.)
*/
textLineThroughColor?: CSSWideKeyword | any;
/**
* Sets the mode for the line-through text decoration, determining whether the text decoration affects the space characters or not.
* (Considered obsolete; use text-decoration-skip instead.)
*/
textLineThroughMode?: CSSWideKeyword | any;
/**
* Specifies the line style for line-through text decoration.
* (Considered obsolete; use text-decoration-style instead.)
*/
textLineThroughStyle?: CSSWideKeyword | any;
/**
* Specifies the line width for the line-through text decoration.
*/
textLineThroughWidth?: CSSWideKeyword | any;
/**
* The text-overflow shorthand CSS property determines how overflowed content that is not displayed is signaled to the users.
* It can be clipped, display an ellipsis ('…', U+2026 HORIZONTAL ELLIPSIS) or a Web author-defined string.
* It covers the two long-hand properties text-overflow-mode and text-overflow-ellipsis
*/
textOverflow?: CSSWideKeyword | any;
/**
* The text-overline property is the shorthand for the text-overline-style, text-overline-width, text-overline-color, and text-overline-mode properties.
*/
textOverline?: CSSWideKeyword | any;
/**
* Specifies the line color for the overline text decoration.
*/
textOverlineColor?: CSSWideKeyword | any;
/**
* Sets the mode for the overline text decoration, determining whether the text decoration affects the space characters or not.
*/
textOverlineMode?: CSSWideKeyword | any;
/**
* Specifies the line style for overline text decoration.
*/
textOverlineStyle?: CSSWideKeyword | any;
/**
* Specifies the line width for the overline text decoration.
*/
textOverlineWidth?: CSSWideKeyword | any;
/**
* The text-rendering CSS property provides information to the browser about how to optimize when rendering text.
* Options are: legibility, speed or geometric precision.
*/
textRendering?: CSSWideKeyword | any;
/**
* Obsolete: unsupported.
*/
textScript?: CSSWideKeyword | any;
/**
* The CSS text-shadow property applies one or more drop shadows to the text and <text-decorations> of an element.
* Each shadow is specified as an offset from the text, along with optional color and blur radius values.
*/
textShadow?: CSSWideKeyword | any;
/**
* This property transforms text for styling purposes. (It has no effect on the underlying content.)
*/
textTransform?: CSSWideKeyword | any;
/**
* Unsupported.
* This property will add a underline position value to the element that has an underline defined.
*/
textUnderlinePosition?: CSSWideKeyword | any;
/**
* After review this should be replaced by text-decoration should it not?
* This property will set the underline style for text with a line value for underline, overline, and line-through.
*/
textUnderlineStyle?: CSSWideKeyword | any;
/**
* This property specifies how far an absolutely positioned box's top margin edge is offset below the top edge of the box's containing block.
* For relatively positioned boxes, the offset is with respect to the top edges of the box itself (i.e., the box is given a position in the normal flow,
* then offset from that position according to these properties).
*/
top?: CSSWideKeyword | any;
/**
* Determines whether touch input may trigger default behavior supplied by the user agent, such as panning or zooming.
*/
touchAction?: CSSWideKeyword | any;
/**
* CSS transforms allow elements styled with CSS to be transformed in two-dimensional or three-dimensional space.
* Using this property, elements can be translated, rotated, scaled, and skewed. The value list may consist of 2D and/or 3D transform values.
*/
transform?: CSSWideKeyword | any;
/**
* This property defines the origin of the transformation axes relative to the element to which the transformation is applied.
*/
transformOrigin?: CSSWideKeyword | any;
/**
* This property allows you to define the relative position of the origin of the transformation grid along the z-axis.
*/
transformOriginZ?: CSSWideKeyword | any;
/**
* This property specifies how nested elements are rendered in 3D space relative to their parent.
*/
transformStyle?: CSSWideKeyword | any;
/**
* The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function,
* and transition-delay. It allows to define the transition between two states of an element.
*/
transition?: CSSWideKeyword | any;
/**
* Defines when the transition will start. A value of ‘0s’ means the transition will execute as soon as the property is changed.
* Otherwise, the value specifies an offset from the moment the property is changed, and the transition will delay execution by that offset.
*/
transitionDelay?: CSSWideKeyword | any;
/**
* The 'transition-duration' property specifies the length of time a transition animation takes to complete.
*/
transitionDuration?: CSSWideKeyword | any;
/**
* The 'transition-property' property specifies the name of the CSS property to which the transition is applied.
*/
transitionProperty?: CSSWideKeyword | any;
/**
* Sets the pace of action within a transition
*/
transitionTimingFunction?: CSSWideKeyword | any;
/**
* The unicode-bidi CSS property specifies the level of embedding with respect to the bidirectional algorithm.
*/
unicodeBidi?: CSSWideKeyword | any;
/**
* unicode-range allows you to set a specific range of characters to be downloaded from a font (embedded using @font-face) and made available for use on the current page.
*/
unicodeRange?: CSSWideKeyword | any;
/**
* This is for all the high level UX stuff.
*/
userFocus?: CSSWideKeyword | any;
/**
* For inputing user content
*/
userInput?: CSSWideKeyword | any;
/**
* The vertical-align property controls how inline elements or text are vertically aligned compared to the baseline.
* If this property is used on table-cells it controls the vertical alignment of content of the table cell.
*/
verticalAlign?: CSSWideKeyword | any;
/**
* The visibility property specifies whether the boxes generated by an element are rendered.
*/
visibility?: CSSWideKeyword | any;
/**
* The voice-balance property sets the apparent position (in stereo sound) of the synthesized voice for spoken media.
*/
voiceBalance?: CSSWideKeyword | any;
/**
* The voice-duration property allows the author to explicitly set the amount of time it should take a speech synthesizer to read an element's content,
* for example to allow the speech to be synchronized with other media.
* With a value of auto (the default) the length of time it takes to read the content is determined by the content itself and the voice-rate property.
*/
voiceDuration?: CSSWideKeyword | any;
/**
* The voice-family property sets the speaker's voice used by a speech media agent to read an element.
* The speaker may be specified as a named character (to match a voice option in the speech reading software)
* or as a generic description of the age and gender of the voice.
* Similar to the font-family property for visual media,
* a comma-separated list of fallback options may be given in case the speech reader does not recognize the character name
* or cannot synthesize the requested combination of generic properties.
*/
voiceFamily?: CSSWideKeyword | any;
/**
* The voice-pitch property sets pitch or tone (high or low) for the synthesized speech when reading an element;
* the pitch may be specified absolutely or relative to the normal pitch for the voice-family used to read the text.
*/
voicePitch?: CSSWideKeyword | any;
/**
* The voice-range property determines how much variation in pitch or tone will be created by the speech synthesize when reading an element.
* Emphasized text, grammatical structures and punctuation may all be rendered as changes in pitch,
* this property determines how strong or obvious those changes are;
* large ranges are associated with enthusiastic or emotional speech,
* while small ranges are associated with flat or mechanical speech.
*/
voiceRange?: CSSWideKeyword | any;
/**
* The voice-rate property sets the speed at which the voice synthesized by a speech media agent will read content.
*/
voiceRate?: CSSWideKeyword | any;
/**
* The voice-stress property sets the level of vocal emphasis to be used for synthesized speech reading the element.
*/
voiceStress?: CSSWideKeyword | any;
/**
* The voice-volume property sets the volume for spoken content in speech media. It replaces the deprecated volume property.
*/
voiceVolume?: CSSWideKeyword | any;
/**
* The white-space property controls whether and how white space inside the element is collapsed, and whether lines may wrap at unforced "soft wrap" opportunities.
*/
whiteSpace?: CSSWideKeyword | any;
/**
* Obsolete: unsupported.
*/
whiteSpaceTreatment?: CSSWideKeyword | any;
/**
* In paged media, this property defines the mimimum number of lines
* that must be left at the top of the second page.
* See CSS 3 orphans, widows properties https://drafts.csswg.org/css-break-3/#widows-orphans
*/
widows?: CSSWideKeyword | number;
/**
* Specifies the width of the content area of an element. The content area of the element width does not include the padding, border, and margin of the element.
*/
width?: CSSWideKeyword | any;
/**
* The word-break property is often used when there is long generated content that is strung together without and spaces or hyphens to beak apart.
* A common case of this is when there is a long URL that does not have any hyphens. This case could potentially cause the breaking of the layout as it could extend past the parent element.
*/
wordBreak?: CSSWideKeyword | any;
/**
* The word-spacing CSS property specifies the spacing behavior between "words".
*/
wordSpacing?: CSSWideKeyword | any;
/**
* An alias of css/properties/overflow-wrap, word-wrap defines whether to break words when the content exceeds the boundaries of its container.
*/
wordWrap?: CSSWideKeyword | any;
/**
* Specifies how exclusions affect inline content within block-level elements. Elements lay out their inline content in their content area but wrap around exclusion areas.
*/
wrapFlow?: CSSWideKeyword | any;
/**
* Set the value that is used to offset the inner wrap shape from other shapes. Inline content that intersects a shape with this property will be pushed by this shape's margin.
*/
wrapMargin?: CSSWideKeyword | any;
/**
* Obsolete and unsupported. Do not use.
* This CSS property controls the text when it reaches the end of the block in which it is enclosed.
*/
wrapOption?: CSSWideKeyword | any;
/**
* writing-mode specifies if lines of text are laid out horizontally or vertically, and the direction which lines of text and blocks progress.
*/
writingMode?: CSSWideKeyword | any;
/**
* The z-index property specifies the z-order of an element and its descendants.
* When elements overlap, z-order determines which one covers the other.
* See CSS 2 z-index property https://www.w3.org/TR/CSS2/visuren.html#z-index
*/
zIndex?: CSSWideKeyword | "auto" | number;
/**
* Sets the initial zoom factor of a document defined by @viewport.
* See CSS zoom descriptor https://drafts.csswg.org/css-device-adapt/#zoom-desc
*/
zoom?: CSSWideKeyword | "auto" | number | CSSPercentage;
[propertyName: string]: any;
}
interface HTMLAttributes<T> extends DOMAttributes<T> {
// React-specific Attributes
defaultChecked?: boolean;
defaultValue?: string | string[];
suppressContentEditableWarning?: boolean;
// Standard HTML Attributes
accessKey?: string;
className?: string;
contentEditable?: boolean;
contextMenu?: string;
dir?: string;
draggable?: boolean;
hidden?: boolean;
id?: string;
lang?: string;
slot?: string;
spellCheck?: boolean;
style?: CSSProperties;
tabIndex?: number;
title?: string;
// Unknown
inputMode?: string;
is?: string;
radioGroup?: string; // <command>, <menuitem>
// WAI-ARIA
role?: string;
// RDFa Attributes
about?: string;
datatype?: string;
inlist?: any;
prefix?: string;
property?: string;
resource?: string;
typeof?: string;
vocab?: string;
// Non-standard Attributes
autoCapitalize?: string;
autoCorrect?: string;
autoSave?: string;
color?: string;
itemProp?: string;
itemScope?: boolean;
itemType?: string;
itemID?: string;
itemRef?: string;
results?: number;
security?: string;
unselectable?: boolean;
}
interface AllHTMLAttributes<T> extends HTMLAttributes<T> {
// Standard HTML Attributes
accept?: string;
acceptCharset?: string;
action?: string;
allowFullScreen?: boolean;
allowTransparency?: boolean;
alt?: string;
as?: string;
async?: boolean;
autoComplete?: string;
autoFocus?: boolean;
autoPlay?: boolean;
capture?: boolean;
cellPadding?: number | string;
cellSpacing?: number | string;
charSet?: string;
challenge?: string;
checked?: boolean;
cite?: string;
classID?: string;
cols?: number;
colSpan?: number;
content?: string;
controls?: boolean;
coords?: string;
crossOrigin?: string;
data?: string;
dateTime?: string;
default?: boolean;
defer?: boolean;
disabled?: boolean;
download?: any;
encType?: string;
form?: string;
formAction?: string;
formEncType?: string;
formMethod?: string;
formNoValidate?: boolean;
formTarget?: string;
frameBorder?: number | string;
headers?: string;
height?: number | string;
high?: number;
href?: string;
hrefLang?: string;
htmlFor?: string;
httpEquiv?: string;
integrity?: string;
keyParams?: string;
keyType?: string;
kind?: string;
label?: string;
list?: string;
loop?: boolean;
low?: number;
manifest?: string;
marginHeight?: number;
marginWidth?: number;
max?: number | string;
maxLength?: number;
media?: string;
mediaGroup?: string;
method?: string;
min?: number | string;
minLength?: number;
multiple?: boolean;
muted?: boolean;
name?: string;
nonce?: string;
noValidate?: boolean;
open?: boolean;
optimum?: number;
pattern?: string;
placeholder?: string;
playsInline?: boolean;
poster?: string;
preload?: string;
readOnly?: boolean;
rel?: string;
required?: boolean;
reversed?: boolean;
rows?: number;
rowSpan?: number;
sandbox?: string;
scope?: string;
scoped?: boolean;
scrolling?: string;
seamless?: boolean;
selected?: boolean;
shape?: string;
size?: number;
sizes?: string;
span?: number;
src?: string;
srcDoc?: string;
srcLang?: string;
srcSet?: string;
start?: number;
step?: number | string;
summary?: string;
target?: string;
type?: string;
useMap?: string;
value?: string | string[] | number;
width?: number | string;
wmode?: string;
wrap?: string;
}
interface AnchorHTMLAttributes<T> extends HTMLAttributes<T> {
download?: any;
href?: string;
hrefLang?: string;
media?: string;
rel?: string;
target?: string;
type?: string;
as?: string;
}
// tslint:disable-next-line:no-empty-interface
interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> {}
interface AreaHTMLAttributes<T> extends HTMLAttributes<T> {
alt?: string;
coords?: string;
download?: any;
href?: string;
hrefLang?: string;
media?: string;
rel?: string;
shape?: string;
target?: string;
}
interface BaseHTMLAttributes<T> extends HTMLAttributes<T> {
href?: string;
target?: string;
}
interface BlockquoteHTMLAttributes<T> extends HTMLAttributes<T> {
cite?: string;
}
interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
autoFocus?: boolean;
disabled?: boolean;
form?: string;
formAction?: string;
formEncType?: string;
formMethod?: string;
formNoValidate?: boolean;
formTarget?: string;
name?: string;
type?: string;
value?: string | string[] | number;
}
interface CanvasHTMLAttributes<T> extends HTMLAttributes<T> {
height?: number | string;
width?: number | string;
}
interface ColHTMLAttributes<T> extends HTMLAttributes<T> {
span?: number;
width?: number | string;
}
interface ColgroupHTMLAttributes<T> extends HTMLAttributes<T> {
span?: number;
}
interface DetailsHTMLAttributes<T> extends HTMLAttributes<T> {
open?: boolean;
}
interface DelHTMLAttributes<T> extends HTMLAttributes<T> {
cite?: string;
dateTime?: string;
}
interface EmbedHTMLAttributes<T> extends HTMLAttributes<T> {
height?: number | string;
src?: string;
type?: string;
width?: number | string;
}
interface FieldsetHTMLAttributes<T> extends HTMLAttributes<T> {
disabled?: boolean;
form?: string;
name?: string;
}
interface FormHTMLAttributes<T> extends HTMLAttributes<T> {
acceptCharset?: string;
action?: string;
autoComplete?: string;
encType?: string;
method?: string;
name?: string;
noValidate?: boolean;
target?: string;
}
interface HtmlHTMLAttributes<T> extends HTMLAttributes<T> {
manifest?: string;
}
interface IframeHTMLAttributes<T> extends HTMLAttributes<T> {
allowFullScreen?: boolean;
allowTransparency?: boolean;
frameBorder?: number | string;
height?: number | string;
marginHeight?: number;
marginWidth?: number;
name?: string;
sandbox?: string;
scrolling?: string;
seamless?: boolean;
src?: string;
srcDoc?: string;
width?: number | string;
}
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
alt?: string;
height?: number | string;
sizes?: string;
src?: string;
srcSet?: string;
useMap?: string;
width?: number | string;
}
interface InsHTMLAttributes<T> extends HTMLAttributes<T> {
cite?: string;
dateTime?: string;
}
interface InputHTMLAttributes<T> extends HTMLAttributes<T> {
accept?: string;
alt?: string;
autoComplete?: string;
autoFocus?: boolean;
capture?: boolean; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute
checked?: boolean;
crossOrigin?: string;
disabled?: boolean;
form?: string;
formAction?: string;
formEncType?: string;
formMethod?: string;
formNoValidate?: boolean;
formTarget?: string;
height?: number | string;
list?: string;
max?: number | string;
maxLength?: number;
min?: number | string;
minLength?: number;
multiple?: boolean;
name?: string;
pattern?: string;
placeholder?: string;
readOnly?: boolean;
required?: boolean;
size?: number;
src?: string;
step?: number | string;
type?: string;
value?: string | string[] | number;
width?: number | string;
onChange?: ChangeEventHandler<T>;
}
interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
autoFocus?: boolean;
challenge?: string;
disabled?: boolean;
form?: string;
keyType?: string;
keyParams?: string;
name?: string;
}
interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
form?: string;
htmlFor?: string;
}
interface LiHTMLAttributes<T> extends HTMLAttributes<T> {
value?: string | string[] | number;
}
interface LinkHTMLAttributes<T> extends HTMLAttributes<T> {
as?: string;
crossOrigin?: string;
href?: string;
hrefLang?: string;
integrity?: string;
media?: string;
rel?: string;
sizes?: string;
type?: string;
}
interface MapHTMLAttributes<T> extends HTMLAttributes<T> {
name?: string;
}
interface MenuHTMLAttributes<T> extends HTMLAttributes<T> {
type?: string;
}
interface MediaHTMLAttributes<T> extends HTMLAttributes<T> {
autoPlay?: boolean;
controls?: boolean;
controlsList?: string;
crossOrigin?: string;
loop?: boolean;
mediaGroup?: string;
muted?: boolean;
playsinline?: boolean;
preload?: string;
src?: string;
}
interface MetaHTMLAttributes<T> extends HTMLAttributes<T> {
charSet?: string;
content?: string;
httpEquiv?: string;
name?: string;
}
interface MeterHTMLAttributes<T> extends HTMLAttributes<T> {
form?: string;
high?: number;
low?: number;
max?: number | string;
min?: number | string;
optimum?: number;
value?: string | string[] | number;
}
interface QuoteHTMLAttributes<T> extends HTMLAttributes<T> {
cite?: string;
}
interface ObjectHTMLAttributes<T> extends HTMLAttributes<T> {
classID?: string;
data?: string;
form?: string;
height?: number | string;
name?: string;
type?: string;
useMap?: string;
width?: number | string;
wmode?: string;
}
interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
reversed?: boolean;
start?: number;
}
interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
disabled?: boolean;
label?: string;
}
interface OptionHTMLAttributes<T> extends HTMLAttributes<T> {
disabled?: boolean;
label?: string;
selected?: boolean;
value?: string | string[] | number;
}
interface OutputHTMLAttributes<T> extends HTMLAttributes<T> {
form?: string;
htmlFor?: string;
name?: string;
}
interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
name?: string;
value?: string | string[] | number;
}
interface ProgressHTMLAttributes<T> extends HTMLAttributes<T> {
max?: number | string;
value?: string | string[] | number;
}
interface ScriptHTMLAttributes<T> extends HTMLAttributes<T> {
async?: boolean;
charSet?: string;
crossOrigin?: string;
defer?: boolean;
integrity?: string;
nonce?: string;
src?: string;
type?: string;
}
interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
autoFocus?: boolean;
disabled?: boolean;
form?: string;
multiple?: boolean;
name?: string;
required?: boolean;
size?: number;
value?: string | string[] | number;
onChange?: ChangeEventHandler<T>;
}
interface SourceHTMLAttributes<T> extends HTMLAttributes<T> {
media?: string;
sizes?: string;
src?: string;
srcSet?: string;
type?: string;
}
interface StyleHTMLAttributes<T> extends HTMLAttributes<T> {
media?: string;
nonce?: string;
scoped?: boolean;
type?: string;
}
interface TableHTMLAttributes<T> extends HTMLAttributes<T> {
cellPadding?: number | string;
cellSpacing?: number | string;
summary?: string;
}
interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
autoComplete?: string;
autoFocus?: boolean;
cols?: number;
dirName?: string;
disabled?: boolean;
form?: string;
maxLength?: number;
minLength?: number;
name?: string;
placeholder?: string;
readOnly?: boolean;
required?: boolean;
rows?: number;
value?: string | string[] | number;
wrap?: string;
onChange?: ChangeEventHandler<T>;
}
interface TdHTMLAttributes<T> extends HTMLAttributes<T> {
colSpan?: number;
headers?: string;
rowSpan?: number;
scope?: string;
}
interface ThHTMLAttributes<T> extends HTMLAttributes<T> {
colSpan?: number;
headers?: string;
rowSpan?: number;
scope?: string;
}
interface TimeHTMLAttributes<T> extends HTMLAttributes<T> {
dateTime?: string;
}
interface TrackHTMLAttributes<T> extends HTMLAttributes<T> {
default?: boolean;
kind?: string;
label?: string;
src?: string;
srcLang?: string;
}
interface VideoHTMLAttributes<T> extends MediaHTMLAttributes<T> {
height?: number | string;
playsInline?: boolean;
poster?: string;
width?: number | string;
}
// this list is "complete" in that it contains every SVG attribute
// that React supports, but the types can be improved.
// Full list here: https://facebook.github.io/react/docs/dom-elements.html
//
// The three broad type categories are (in order of restrictiveness):
// - "number | string"
// - "string"
// - union of string literals
interface SVGAttributes<T> extends DOMAttributes<T> {
// Attributes which also defined in HTMLAttributes
// See comment in SVGDOMPropertyConfig.js
className?: string;
color?: string;
height?: number | string;
id?: string;
lang?: string;
max?: number | string;
media?: string;
method?: string;
min?: number | string;
name?: string;
style?: CSSProperties;
target?: string;
type?: string;
width?: number | string;
// Other HTML properties supported by SVG elements in browsers
role?: string;
tabIndex?: number;
// SVG Specific attributes
accentHeight?: number | string;
accumulate?: "none" | "sum";
additive?: "replace" | "sum";
alignmentBaseline?: "auto" | "baseline" | "before-edge" | "text-before-edge" | "middle" | "central" | "after-edge" |
"text-after-edge" | "ideographic" | "alphabetic" | "hanging" | "mathematical" | "inherit";
allowReorder?: "no" | "yes";
alphabetic?: number | string;
amplitude?: number | string;
arabicForm?: "initial" | "medial" | "terminal" | "isolated";
ascent?: number | string;
attributeName?: string;
attributeType?: string;
autoReverse?: number | string;
azimuth?: number | string;
baseFrequency?: number | string;
baselineShift?: number | string;
baseProfile?: number | string;
bbox?: number | string;
begin?: number | string;
bias?: number | string;
by?: number | string;
calcMode?: number | string;
capHeight?: number | string;
clip?: number | string;
clipPath?: string;
clipPathUnits?: number | string;
clipRule?: number | string;
colorInterpolation?: number | string;
colorInterpolationFilters?: "auto" | "sRGB" | "linearRGB" | "inherit";
colorProfile?: number | string;
colorRendering?: number | string;
contentScriptType?: number | string;
contentStyleType?: number | string;
cursor?: number | string;
cx?: number | string;
cy?: number | string;
d?: string;
decelerate?: number | string;
descent?: number | string;
diffuseConstant?: number | string;
direction?: number | string;
display?: number | string;
divisor?: number | string;
dominantBaseline?: number | string;
dur?: number | string;
dx?: number | string;
dy?: number | string;
edgeMode?: number | string;
elevation?: number | string;
enableBackground?: number | string;
end?: number | string;
exponent?: number | string;
externalResourcesRequired?: number | string;
fill?: string;
fillOpacity?: number | string;
fillRule?: "nonzero" | "evenodd" | "inherit";
filter?: string;
filterRes?: number | string;
filterUnits?: number | string;
floodColor?: number | string;
floodOpacity?: number | string;
focusable?: number | string;
fontFamily?: string;
fontSize?: number | string;
fontSizeAdjust?: number | string;
fontStretch?: number | string;
fontStyle?: number | string;
fontVariant?: number | string;
fontWeight?: number | string;
format?: number | string;
from?: number | string;
fx?: number | string;
fy?: number | string;
g1?: number | string;
g2?: number | string;
glyphName?: number | string;
glyphOrientationHorizontal?: number | string;
glyphOrientationVertical?: number | string;
glyphRef?: number | string;
gradientTransform?: string;
gradientUnits?: string;
hanging?: number | string;
horizAdvX?: number | string;
horizOriginX?: number | string;
ideographic?: number | string;
imageRendering?: number | string;
in2?: number | string;
in?: string;
intercept?: number | string;
k1?: number | string;
k2?: number | string;
k3?: number | string;
k4?: number | string;
k?: number | string;
kernelMatrix?: number | string;
kernelUnitLength?: number | string;
kerning?: number | string;
keyPoints?: number | string;
keySplines?: number | string;
keyTimes?: number | string;
lengthAdjust?: number | string;
letterSpacing?: number | string;
lightingColor?: number | string;
limitingConeAngle?: number | string;
local?: number | string;
markerEnd?: string;
markerHeight?: number | string;
markerMid?: string;
markerStart?: string;
markerUnits?: number | string;
markerWidth?: number | string;
mask?: string;
maskContentUnits?: number | string;
maskUnits?: number | string;
mathematical?: number | string;
mode?: number | string;
numOctaves?: number | string;
offset?: number | string;
opacity?: number | string;
operator?: number | string;
order?: number | string;
orient?: number | string;
orientation?: number | string;
origin?: number | string;
overflow?: number | string;
overlinePosition?: number | string;
overlineThickness?: number | string;
paintOrder?: number | string;
panose1?: number | string;
pathLength?: number | string;
patternContentUnits?: string;
patternTransform?: number | string;
patternUnits?: string;
pointerEvents?: number | string;
points?: string;
pointsAtX?: number | string;
pointsAtY?: number | string;
pointsAtZ?: number | string;
preserveAlpha?: number | string;
preserveAspectRatio?: string;
primitiveUnits?: number | string;
r?: number | string;
radius?: number | string;
refX?: number | string;
refY?: number | string;
renderingIntent?: number | string;
repeatCount?: number | string;
repeatDur?: number | string;
requiredExtensions?: number | string;
requiredFeatures?: number | string;
restart?: number | string;
result?: string;
rotate?: number | string;
rx?: number | string;
ry?: number | string;
scale?: number | string;
seed?: number | string;
shapeRendering?: number | string;
slope?: number | string;
spacing?: number | string;
specularConstant?: number | string;
specularExponent?: number | string;
speed?: number | string;
spreadMethod?: string;
startOffset?: number | string;
stdDeviation?: number | string;
stemh?: number | string;
stemv?: number | string;
stitchTiles?: number | string;
stopColor?: string;
stopOpacity?: number | string;
strikethroughPosition?: number | string;
strikethroughThickness?: number | string;
string?: number | string;
stroke?: string;
strokeDasharray?: string | number;
strokeDashoffset?: string | number;
strokeLinecap?: "butt" | "round" | "square" | "inherit";
strokeLinejoin?: "miter" | "round" | "bevel" | "inherit";
strokeMiterlimit?: number | string;
strokeOpacity?: number | string;
strokeWidth?: number | string;
surfaceScale?: number | string;
systemLanguage?: number | string;
tableValues?: number | string;
targetX?: number | string;
targetY?: number | string;
textAnchor?: string;
textDecoration?: number | string;
textLength?: number | string;
textRendering?: number | string;
to?: number | string;
transform?: string;
u1?: number | string;
u2?: number | string;
underlinePosition?: number | string;
underlineThickness?: number | string;
unicode?: number | string;
unicodeBidi?: number | string;
unicodeRange?: number | string;
unitsPerEm?: number | string;
vAlphabetic?: number | string;
values?: string;
vectorEffect?: number | string;
version?: string;
vertAdvY?: number | string;
vertOriginX?: number | string;
vertOriginY?: number | string;
vHanging?: number | string;
vIdeographic?: number | string;
viewBox?: string;
viewTarget?: number | string;
visibility?: number | string;
vMathematical?: number | string;
widths?: number | string;
wordSpacing?: number | string;
writingMode?: number | string;
x1?: number | string;
x2?: number | string;
x?: number | string;
xChannelSelector?: string;
xHeight?: number | string;
xlinkActuate?: string;
xlinkArcrole?: string;
xlinkHref?: string;
xlinkRole?: string;
xlinkShow?: string;
xlinkTitle?: string;
xlinkType?: string;
xmlBase?: string;
xmlLang?: string;
xmlns?: string;
xmlnsXlink?: string;
xmlSpace?: string;
y1?: number | string;
y2?: number | string;
y?: number | string;
yChannelSelector?: string;
z?: number | string;
zoomAndPan?: string;
}
//
// React.DOM
// ----------------------------------------------------------------------
interface ReactHTML {
a: DetailedHTMLFactory<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
abbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
address: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
area: DetailedHTMLFactory<AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
article: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
aside: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
audio: DetailedHTMLFactory<AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
b: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
base: DetailedHTMLFactory<BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
bdi: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
bdo: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
big: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
blockquote: DetailedHTMLFactory<BlockquoteHTMLAttributes<HTMLElement>, HTMLElement>;
body: DetailedHTMLFactory<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
br: DetailedHTMLFactory<HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
button: DetailedHTMLFactory<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
canvas: DetailedHTMLFactory<CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
caption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
cite: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
code: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
col: DetailedHTMLFactory<ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
colgroup: DetailedHTMLFactory<ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
data: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
datalist: DetailedHTMLFactory<HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
dd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
del: DetailedHTMLFactory<DelHTMLAttributes<HTMLElement>, HTMLElement>;
details: DetailedHTMLFactory<DetailsHTMLAttributes<HTMLElement>, HTMLElement>;
dfn: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
dialog: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
div: DetailedHTMLFactory<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
dl: DetailedHTMLFactory<HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
dt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
em: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
embed: DetailedHTMLFactory<EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
fieldset: DetailedHTMLFactory<FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
figcaption: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
figure: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
footer: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
form: DetailedHTMLFactory<FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
h1: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h2: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h3: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h4: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h5: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h6: DetailedHTMLFactory<HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
head: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLHeadElement>;
header: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
hgroup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
hr: DetailedHTMLFactory<HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
html: DetailedHTMLFactory<HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
i: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
iframe: DetailedHTMLFactory<IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
img: DetailedHTMLFactory<ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
input: DetailedHTMLFactory<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
ins: DetailedHTMLFactory<InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
kbd: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
keygen: DetailedHTMLFactory<KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
label: DetailedHTMLFactory<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
legend: DetailedHTMLFactory<HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
li: DetailedHTMLFactory<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
link: DetailedHTMLFactory<LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
main: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
map: DetailedHTMLFactory<MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
mark: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
menu: DetailedHTMLFactory<MenuHTMLAttributes<HTMLElement>, HTMLElement>;
menuitem: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
meta: DetailedHTMLFactory<MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
meter: DetailedHTMLFactory<MeterHTMLAttributes<HTMLElement>, HTMLElement>;
nav: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
noscript: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
object: DetailedHTMLFactory<ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
ol: DetailedHTMLFactory<OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
optgroup: DetailedHTMLFactory<OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
option: DetailedHTMLFactory<OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
output: DetailedHTMLFactory<OutputHTMLAttributes<HTMLElement>, HTMLElement>;
p: DetailedHTMLFactory<HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
param: DetailedHTMLFactory<ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
picture: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
pre: DetailedHTMLFactory<HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
progress: DetailedHTMLFactory<ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
q: DetailedHTMLFactory<QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
rp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
rt: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
ruby: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
s: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
samp: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
script: DetailedHTMLFactory<ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
section: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
select: DetailedHTMLFactory<SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
small: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
source: DetailedHTMLFactory<SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
span: DetailedHTMLFactory<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
strong: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
style: DetailedHTMLFactory<StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
sub: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
summary: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
sup: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
table: DetailedHTMLFactory<TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
tbody: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
td: DetailedHTMLFactory<TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
textarea: DetailedHTMLFactory<TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
tfoot: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
th: DetailedHTMLFactory<ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
thead: DetailedHTMLFactory<HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
time: DetailedHTMLFactory<TimeHTMLAttributes<HTMLElement>, HTMLElement>;
title: DetailedHTMLFactory<HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
tr: DetailedHTMLFactory<HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
track: DetailedHTMLFactory<TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
u: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
ul: DetailedHTMLFactory<HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
"var": DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
video: DetailedHTMLFactory<VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
wbr: DetailedHTMLFactory<HTMLAttributes<HTMLElement>, HTMLElement>;
}
interface ReactSVG {
animate: SVGFactory;
circle: SVGFactory;
clipPath: SVGFactory;
defs: SVGFactory;
desc: SVGFactory;
ellipse: SVGFactory;
feBlend: SVGFactory;
feColorMatrix: SVGFactory;
feComponentTransfer: SVGFactory;
feComposite: SVGFactory;
feConvolveMatrix: SVGFactory;
feDiffuseLighting: SVGFactory;
feDisplacementMap: SVGFactory;
feDistantLight: SVGFactory;
feDropShadow: SVGFactory;
feFlood: SVGFactory;
feFuncA: SVGFactory;
feFuncB: SVGFactory;
feFuncG: SVGFactory;
feFuncR: SVGFactory;
feGaussianBlur: SVGFactory;
feImage: SVGFactory;
feMerge: SVGFactory;
feMergeNode: SVGFactory;
feMorphology: SVGFactory;
feOffset: SVGFactory;
fePointLight: SVGFactory;
feSpecularLighting: SVGFactory;
feSpotLight: SVGFactory;
feTile: SVGFactory;
feTurbulence: SVGFactory;
filter: SVGFactory;
foreignObject: SVGFactory;
g: SVGFactory;
image: SVGFactory;
line: SVGFactory;
linearGradient: SVGFactory;
marker: SVGFactory;
mask: SVGFactory;
metadata: SVGFactory;
path: SVGFactory;
pattern: SVGFactory;
polygon: SVGFactory;
polyline: SVGFactory;
radialGradient: SVGFactory;
rect: SVGFactory;
stop: SVGFactory;
svg: SVGFactory;
switch: SVGFactory;
symbol: SVGFactory;
text: SVGFactory;
textPath: SVGFactory;
tspan: SVGFactory;
use: SVGFactory;
view: SVGFactory;
}
interface ReactDOM extends ReactHTML, ReactSVG { }
//
// React.PropTypes
// ----------------------------------------------------------------------
type Validator<T> = { bivarianceHack(object: T, key: string, componentName: string, ...rest: any[]): Error | null }["bivarianceHack"];
interface Requireable<T> extends Validator<T> {
isRequired: Validator<T>;
}
type ValidationMap<T> = {[K in keyof T]?: Validator<T> };
interface ReactPropTypes {
any: Requireable<any>;
array: Requireable<any>;
bool: Requireable<any>;
func: Requireable<any>;
number: Requireable<any>;
object: Requireable<any>;
string: Requireable<any>;
node: Requireable<any>;
element: Requireable<any>;
instanceOf(expectedClass: {}): Requireable<any>;
oneOf(types: any[]): Requireable<any>;
oneOfType(types: Array<Validator<any>>): Requireable<any>;
arrayOf(type: Validator<any>): Requireable<any>;
objectOf(type: Validator<any>): Requireable<any>;
shape(type: ValidationMap<any>): Requireable<any>;
}
//
// React.Children
// ----------------------------------------------------------------------
interface ReactChildren {
map<T>(children: ReactNode, fn: (child: ReactChild, index: number) => T): T[];
forEach(children: ReactNode, fn: (child: ReactChild, index: number) => any): void;
count(children: ReactNode): number;
only(children: ReactNode): ReactElement<any>;
toArray(children: ReactNode): ReactChild[];
}
//
// Browser Interfaces
// https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
// ----------------------------------------------------------------------
interface AbstractView {
styleMedia: StyleMedia;
document: Document;
}
interface Touch {
identifier: number;
target: EventTarget;
screenX: number;
screenY: number;
clientX: number;
clientY: number;
pageX: number;
pageY: number;
}
interface TouchList {
[index: number]: Touch;
length: number;
item(index: number): Touch;
identifiedTouch(identifier: number): Touch;
}
//
// Error Interfaces
// ----------------------------------------------------------------------
interface ErrorInfo {
/**
* Captures which component contained the exception, and it's ancestors.
*/
componentStack: string;
}
}
declare global {
namespace JSX {
// tslint:disable-next-line:no-empty-interface
interface Element extends React.ReactElement<any> { }
interface ElementClass extends React.Component<any> {
render(): React.ReactNode;
}
interface ElementAttributesProperty { props: {}; }
interface ElementChildrenAttribute { children: {}; }
// tslint:disable-next-line:no-empty-interface
interface IntrinsicAttributes extends React.Attributes { }
// tslint:disable-next-line:no-empty-interface
interface IntrinsicClassAttributes<T> extends React.ClassAttributes<T> { }
interface IntrinsicElements {
// HTML
a: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>;
abbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
address: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
area: React.DetailedHTMLProps<React.AreaHTMLAttributes<HTMLAreaElement>, HTMLAreaElement>;
article: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
aside: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
audio: React.DetailedHTMLProps<React.AudioHTMLAttributes<HTMLAudioElement>, HTMLAudioElement>;
b: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
base: React.DetailedHTMLProps<React.BaseHTMLAttributes<HTMLBaseElement>, HTMLBaseElement>;
bdi: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
bdo: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
big: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
blockquote: React.DetailedHTMLProps<React.BlockquoteHTMLAttributes<HTMLElement>, HTMLElement>;
body: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>;
br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
canvas: React.DetailedHTMLProps<React.CanvasHTMLAttributes<HTMLCanvasElement>, HTMLCanvasElement>;
caption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
cite: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
code: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
col: React.DetailedHTMLProps<React.ColHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
colgroup: React.DetailedHTMLProps<React.ColgroupHTMLAttributes<HTMLTableColElement>, HTMLTableColElement>;
data: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
datalist: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDataListElement>, HTMLDataListElement>;
dd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
del: React.DetailedHTMLProps<React.DelHTMLAttributes<HTMLElement>, HTMLElement>;
details: React.DetailedHTMLProps<React.DetailsHTMLAttributes<HTMLElement>, HTMLElement>;
dfn: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
dialog: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
div: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
dl: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDListElement>, HTMLDListElement>;
dt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
em: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
embed: React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>;
fieldset: React.DetailedHTMLProps<React.FieldsetHTMLAttributes<HTMLFieldSetElement>, HTMLFieldSetElement>;
figcaption: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
figure: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
footer: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
form: React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>;
h1: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h2: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h3: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h4: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h5: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
h6: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>;
head: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadElement>, HTMLHeadElement>;
header: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
hgroup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
hr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLHRElement>, HTMLHRElement>;
html: React.DetailedHTMLProps<React.HtmlHTMLAttributes<HTMLHtmlElement>, HTMLHtmlElement>;
i: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
iframe: React.DetailedHTMLProps<React.IframeHTMLAttributes<HTMLIFrameElement>, HTMLIFrameElement>;
img: React.DetailedHTMLProps<React.ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>;
input: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
ins: React.DetailedHTMLProps<React.InsHTMLAttributes<HTMLModElement>, HTMLModElement>;
kbd: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
keygen: React.DetailedHTMLProps<React.KeygenHTMLAttributes<HTMLElement>, HTMLElement>;
label: React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
legend: React.DetailedHTMLProps<React.HTMLAttributes<HTMLLegendElement>, HTMLLegendElement>;
li: React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
link: React.DetailedHTMLProps<React.LinkHTMLAttributes<HTMLLinkElement>, HTMLLinkElement>;
main: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
map: React.DetailedHTMLProps<React.MapHTMLAttributes<HTMLMapElement>, HTMLMapElement>;
mark: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
menu: React.DetailedHTMLProps<React.MenuHTMLAttributes<HTMLElement>, HTMLElement>;
menuitem: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
meta: React.DetailedHTMLProps<React.MetaHTMLAttributes<HTMLMetaElement>, HTMLMetaElement>;
meter: React.DetailedHTMLProps<React.MeterHTMLAttributes<HTMLElement>, HTMLElement>;
nav: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
noindex: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
noscript: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
object: React.DetailedHTMLProps<React.ObjectHTMLAttributes<HTMLObjectElement>, HTMLObjectElement>;
ol: React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>;
optgroup: React.DetailedHTMLProps<React.OptgroupHTMLAttributes<HTMLOptGroupElement>, HTMLOptGroupElement>;
option: React.DetailedHTMLProps<React.OptionHTMLAttributes<HTMLOptionElement>, HTMLOptionElement>;
output: React.DetailedHTMLProps<React.OutputHTMLAttributes<HTMLElement>, HTMLElement>;
p: React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>;
param: React.DetailedHTMLProps<React.ParamHTMLAttributes<HTMLParamElement>, HTMLParamElement>;
picture: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
pre: React.DetailedHTMLProps<React.HTMLAttributes<HTMLPreElement>, HTMLPreElement>;
progress: React.DetailedHTMLProps<React.ProgressHTMLAttributes<HTMLProgressElement>, HTMLProgressElement>;
q: React.DetailedHTMLProps<React.QuoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>;
rp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
rt: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
ruby: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
s: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
samp: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
script: React.DetailedHTMLProps<React.ScriptHTMLAttributes<HTMLScriptElement>, HTMLScriptElement>;
section: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
select: React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>;
small: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
source: React.DetailedHTMLProps<React.SourceHTMLAttributes<HTMLSourceElement>, HTMLSourceElement>;
span: React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
strong: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
style: React.DetailedHTMLProps<React.StyleHTMLAttributes<HTMLStyleElement>, HTMLStyleElement>;
sub: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
summary: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
sup: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
table: React.DetailedHTMLProps<React.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>;
tbody: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
td: React.DetailedHTMLProps<React.TdHTMLAttributes<HTMLTableDataCellElement>, HTMLTableDataCellElement>;
textarea: React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>;
tfoot: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
th: React.DetailedHTMLProps<React.ThHTMLAttributes<HTMLTableHeaderCellElement>, HTMLTableHeaderCellElement>;
thead: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableSectionElement>, HTMLTableSectionElement>;
time: React.DetailedHTMLProps<React.TimeHTMLAttributes<HTMLElement>, HTMLElement>;
title: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTitleElement>, HTMLTitleElement>;
tr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>;
track: React.DetailedHTMLProps<React.TrackHTMLAttributes<HTMLTrackElement>, HTMLTrackElement>;
u: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
ul: React.DetailedHTMLProps<React.HTMLAttributes<HTMLUListElement>, HTMLUListElement>;
"var": React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
video: React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
wbr: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
// SVG
svg: React.SVGProps<SVGSVGElement>;
animate: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateElement but is not in TypeScript's lib.dom.d.ts for now.
animateTransform: React.SVGProps<SVGElement>; // TODO: It is SVGAnimateTransformElement but is not in TypeScript's lib.dom.d.ts for now.
circle: React.SVGProps<SVGCircleElement>;
clipPath: React.SVGProps<SVGClipPathElement>;
defs: React.SVGProps<SVGDefsElement>;
desc: React.SVGProps<SVGDescElement>;
ellipse: React.SVGProps<SVGEllipseElement>;
feBlend: React.SVGProps<SVGFEBlendElement>;
feColorMatrix: React.SVGProps<SVGFEColorMatrixElement>;
feComponentTransfer: React.SVGProps<SVGFEComponentTransferElement>;
feComposite: React.SVGProps<SVGFECompositeElement>;
feConvolveMatrix: React.SVGProps<SVGFEConvolveMatrixElement>;
feDiffuseLighting: React.SVGProps<SVGFEDiffuseLightingElement>;
feDisplacementMap: React.SVGProps<SVGFEDisplacementMapElement>;
feDistantLight: React.SVGProps<SVGFEDistantLightElement>;
feFlood: React.SVGProps<SVGFEFloodElement>;
feFuncA: React.SVGProps<SVGFEFuncAElement>;
feFuncB: React.SVGProps<SVGFEFuncBElement>;
feFuncG: React.SVGProps<SVGFEFuncGElement>;
feFuncR: React.SVGProps<SVGFEFuncRElement>;
feGaussianBlur: React.SVGProps<SVGFEGaussianBlurElement>;
feImage: React.SVGProps<SVGFEImageElement>;
feMerge: React.SVGProps<SVGFEMergeElement>;
feMergeNode: React.SVGProps<SVGFEMergeNodeElement>;
feMorphology: React.SVGProps<SVGFEMorphologyElement>;
feOffset: React.SVGProps<SVGFEOffsetElement>;
fePointLight: React.SVGProps<SVGFEPointLightElement>;
feSpecularLighting: React.SVGProps<SVGFESpecularLightingElement>;
feSpotLight: React.SVGProps<SVGFESpotLightElement>;
feTile: React.SVGProps<SVGFETileElement>;
feTurbulence: React.SVGProps<SVGFETurbulenceElement>;
filter: React.SVGProps<SVGFilterElement>;
foreignObject: React.SVGProps<SVGForeignObjectElement>;
g: React.SVGProps<SVGGElement>;
image: React.SVGProps<SVGImageElement>;
line: React.SVGProps<SVGLineElement>;
linearGradient: React.SVGProps<SVGLinearGradientElement>;
marker: React.SVGProps<SVGMarkerElement>;
mask: React.SVGProps<SVGMaskElement>;
metadata: React.SVGProps<SVGMetadataElement>;
path: React.SVGProps<SVGPathElement>;
pattern: React.SVGProps<SVGPatternElement>;
polygon: React.SVGProps<SVGPolygonElement>;
polyline: React.SVGProps<SVGPolylineElement>;
radialGradient: React.SVGProps<SVGRadialGradientElement>;
rect: React.SVGProps<SVGRectElement>;
stop: React.SVGProps<SVGStopElement>;
switch: React.SVGProps<SVGSwitchElement>;
symbol: React.SVGProps<SVGSymbolElement>;
text: React.SVGProps<SVGTextElement>;
textPath: React.SVGProps<SVGTextPathElement>;
tspan: React.SVGProps<SVGTSpanElement>;
use: React.SVGProps<SVGUseElement>;
view: React.SVGProps<SVGViewElement>;
}
}
}
| mit |
Magik3a/PatientManagement_Admin | PatientManagement/PatientManagement.Web/Modules/PatientManagement/Dashboard/CalendarPatientDialog.ts | 612 | /// <reference path="../Patients/PatientsDialog.ts" />
namespace PatientManagement.PatientManagement {
@Serenity.Decorators.panel(false)
@Serenity.Decorators.registerClass()
export class CalendarPatientDialog extends PatientsDialog {
public onSaveSuccess(response: Serenity.SaveResponse): void {
$("#calendar").fullCalendar('refetchEvents');
}
loadEntity(entity: PatientsRow) {
super.loadEntity(entity);
Serenity.EditorUtils.setReadOnly(this.form.Name, true);
Q.initFullHeightGridPage(this.element);
}
}
} | mit |
vuikit/vuikit | packages/vuikit/tests/core/transition/stories/index.js | 135 | import { storiesOf } from '@storybook/vue'
storiesOf('Core/Transition', module)
.add('Default', () => require('./default').default)
| mit |
IVAgafonov/coral-group | app/services/system/newstagsService.js | 1563 | (function () {
'use strict';
angular.module('systemModule')
.service('newstagsService', ['$http', function($http) {
return {
get: function() {
return $http({
method: 'GET',
url: '/api/v1/newstags/get'
});
},
getItems: function() {
return $http({
method: 'GET',
url: '/api/v1/newstags/items'
});
},
saveItem: function(tag_template) {
return $http({
url: '/api/v1/newstags/items',
method: 'UPDATE',
data: {
tag_template: tag_template,
}
});
},
deleteItem: function(id) {
return $http({
url: '/api/v1/newstags/items',
method: 'DELETE',
data: {
id: id
}
});
},
sortItems: function(list) {
return $http({
url: '/api/v1/newstags/items',
method: 'POST',
data: {
list: list
}
});
}
};
}]);
})(); | mit |
KingOfFawns/Special_Course | Special Course/Assets/Plugins/StansAssets/Modules/AndroidNative/Scripts/Social/Twitter/Tasks/TW_FollowersIdsRequest.cs | 1221 | ////////////////////////////////////////////////////////////////////////////////
//
// @module Android Native Plugin for Unity3D
// @author Osipov Stanislav (Stan's Assets)
// @support [email protected]
//
////////////////////////////////////////////////////////////////////////////////
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
// The documentation can be foudn at:
//https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
public class TW_FollowersIdsRequest : TW_APIRequest {
public static TW_FollowersIdsRequest Create() {
return new GameObject("TW_FollowersIdsRequest").AddComponent<TW_FollowersIdsRequest>();
}
void Awake() {
//https://dev.twitter.com/docs/api/1.1/get/followers/ids
SetUrl("https://api.twitter.com/1.1/followers/ids.json");
}
protected override void OnResult(string data) {
Dictionary<string, object> ids = ANMiniJSON.Json.Deserialize(data) as Dictionary<string, object>;
TW_APIRequstResult result = new TW_APIRequstResult(true, data);
foreach(object id in (ids["ids"] as List<object>) ) {
string val = System.Convert.ToString(id);
result.ids.Add(val);
}
SendCompleteResult(result);
}
}
| mit |
zlz/cyan | src/b/scripts/provider.auth.js | 575 | /*global angular*/
angular.module('app').provider('auth', function() {
let that = this;
this.$get = () => {
return that;
};
this.create = (...para) => {
window.sessionStorage.setItem('userAuth', JSON.stringify(para[0]));
return true;
};
this.check = (...para) => {
if (window.sessionStorage.getItem('userAuth')) {
return true;
} else {
return false;
}
};
this.destory = (...para) => {
window.sessionStorage.removeItem('userAuth');
return true;
};
});
| mit |
berlios/pe | src/page_01/task044.cpp | 1505 | #include <algorithm>
#include <gmpxx.h>
#include <vector>
#include "base/number_theory.h"
#include "base/task.h"
// This struct represents p(a + n) - p(a).
struct PentagonalDifference {
PentagonalDifference(int n, int a)
: n_(n), a_(a),
value_(NthPentagonalNumber(a + n) - NthPentagonalNumber(a)) { }
int n_;
int a_;
mpz_class value_;
};
TASK(44) {
std::vector<PentagonalDifference> heap;
auto cmp = [](const PentagonalDifference &first,
const PentagonalDifference &second) {
return first.value_ > second.value_;
};
auto heap_push = [&](int n, int a) {
heap.push_back(PentagonalDifference(n, a));
std::push_heap(heap.begin(), heap.end(), cmp);
};
auto heap_pop = [&]() {
std::pop_heap(heap.begin(), heap.end(), cmp);
auto ret = heap.back();
heap.pop_back();
return ret;
};
heap_push(1, 1);
heap_push(2, 1);
int current_max_n = 2;
while (true) {
auto min_difference = heap_pop();
int a = min_difference.a_;
int n = min_difference.n_;
mpz_class sum = NthPentagonalNumber(a + n) + NthPentagonalNumber(a);
if (IsPentagonalNumber(min_difference.value_) && IsPentagonalNumber(sum)) {
return min_difference.value_;
}
heap_push(n, a + 1);
if (current_max_n == n) {
heap_push(n + 1, 1);
current_max_n++;
}
}
}
| mit |
azraelrabbit/webstack | depot/src/Depot.Tests/DefaultCacheTests.cs | 299 | using NUnit.Framework;
namespace depot.Tests
{
[TestFixture]
public class DefaultCacheTests : CacheTests
{
[SetUp]
public void SetUp()
{
Cache = new DefaultCache();
FileCacheDependency = new DefaultFileCacheDependency();
}
}
} | mit |
tunnckoCore/starts-with | benchmark/fixtures/little-negative.js | 44 | module.exports = [
'a/b/c.txt', 'c.txt'
]
| mit |
djazayeri/openmrs-contrib-analyzecontributions | all-commits-by-year.js | 2325 | var _ = require('lodash');
var elasticsearch = require('elasticsearch');
var HUGE_SIZE = 10000;
var csv = require("fast-csv");
var fs = require("fs");
var year = process.argv[2];
if (!(/\d{4}/.test(year))) {
console.log("Usage: all-commits-by-year.js 2015 [repo]");
process.exit(1);
}
var repo = process.argv[3];
if (repo) {
console.log("Looking at repo: " + repo);
} else {
console.log("Looking across all repos");
}
var esClient = new elasticsearch.Client({
host: 'http://localhost:9200',
log: 'info'
});
function prettyName(repoName) {
repoName = repoName.replace("openmrs-", "");
repoName = repoName.replace("module-", "");
return repoName;
}
var query;
if (repo) {
query = {
bool: {
filter: [
{term: {year: year}},
{term: {repo: repo}}
]
}
}
} else {
query = {
term: {year: year}
};
}
esClient.search({
index: "commits",
body: {
query: query,
size: HUGE_SIZE
}
}, function (error, response) {
if (error) {
console.log("ERROR!!!!");
console.log(error);
}
if (response.hits.total >= HUGE_SIZE) {
console.log("!!!!! TOO MANY RESULTS !!!!! NEED TO REWRITE TO USE SCROLL API !!!!!");
}
else {
console.log("Got " + response.hits.total + " hits");
}
var data = _.map(response.hits.hits, function (item) {
let src = item['_source'];
return {
repo: src.repo,
sha: src.sha,
date: src.date,
username: src.key,
name: src.raw.commit.author.name,
email: src.raw.commit.author.email,
message: src.raw.commit.message
}
});
try {
fs.mkdirSync("output");
} catch (err) {
// directory already exists; not a problem
}
var filename = "output/commits-" + year + "-" + (repo ? repo : "all-repos") + ".csv";
var ws = fs.createWriteStream(filename);
csv.write(data, {
headers: true
}).pipe(ws);
console.log("Wrote: " + filename);
}); | mit |
jmarrec/OpenStudioMeasures | Add A Fully Defined Daylight Sensor/measure.rb | 14704 | # Author: Julien Marrec
# email: [email protected]
# start the measure
class AddAFullyDefinedDaylightSensor < OpenStudio::Ruleset::ModelUserScript
# human readable name
def name
return "Add Fully Defined Daylight Sensor to a zone"
end
# human readable description
def description
return "This measure adds a fully defined daylight sensor based on all input parameters (X,Y,Z, etc)."
end
# human readable description of modeling approach
def modeler_description
return "Place the daylight sensor in sketchup as needed to get the required parameters. You'll need these values to use this measure.
This measure is only intended to make it possible to use in PAT for example and avoid needing to define an additional OSM just to add daylight as wanted."
end
def create_sensor(model, zone, is_primary, fraction_controlled, x_pos_si, y_pos_si, z_pos_si, phi, setpoint_si, control_type, min_power_fraction, min_light_fraction)
#create a new sensor and put at the center of the space
sensor = OpenStudio::Model::DaylightingControl.new(model)
if is_primary
sensor.setName("#{zone.name} Primary daylighting control")
else
sensor.setName("#{zone.name} Secondary daylighting control")
end
# Create a new Point3d to put sensor where needed (set in SI units)
# new_point = OpenStudio::Point3d.new(x_pos_si, y_pos_si, z_pos_si)
new_point = OpenStudio::Point3d.new(x_pos_si.value, y_pos_si.value, z_pos_si.value)
sensor.setPosition(new_point)
# Set the Phi rotation around Z-Axis
sensor.setPhiRotationAroundZAxis(phi)
# Assign the illuminance (has to be set in SI units)
sensor.setIlluminanceSetpoint(setpoint_si.value)
# Assign the rest
sensor.setLightingControlType(control_type)
sensor.setMinimumInputPowerFractionforContinuousDimmingControl(min_power_fraction)
sensor.setMinimumLightOutputFractionforContinuousDimmingControl(min_light_fraction)
# Right now I just dump it into the first space I find... This could be a problem if you do use multiple spaces into one thermal zone. (/!\Is it really needed? might only apply if radiance as engine)
zone_space = zone.spaces[0]
puts "zone_space in zone: #{zone_space.name}, handle: #{zone_space.handle}"
sensor.setSpace(zone_space)
zone.setPrimaryDaylightingControl(sensor)
# Set fraction controlled
zone.setFractionofZoneControlledbyPrimaryDaylightingControl(fraction_controlled)
return sensor
end
# define the arguments that the user will input
def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
#make a choice argument for model objects
zone_handles = OpenStudio::StringVector.new
zone_display_names = OpenStudio::StringVector.new
#putting model object and names into hash
zone_handles_args = model.getThermalZones
zone_handles_args_hash = {}
zone_handles_args.each do |zone_handles_arg|
zone_handles_args_hash[zone_handles_arg.name.to_s] = zone_handles_arg
end
#looping through sorted hash of model objects
zone_handles_args_hash.sort.map do |key,value|
#only include if thermal zone is used in model( ???)
if value.spaces.size > 0
zone_handles << value.handle.to_s
zone_display_names << key
end
end
#make a choice argument for zone
zone = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("zone", zone_handles, zone_display_names,true)
zone.setDisplayName("Add Daylight Sensor to this Thermal Zone")
args << zone
#make an argument to determine if primary or secondary
is_primary = OpenStudio::Ruleset::OSArgument::makeBoolArgument("is_primary",true)
is_primary.setDisplayName("Is it the primary lighting control?")
is_primary.setDefaultValue(true)
is_primary.setDescription("If false, the secondaryLightingControl will be affected")
args << is_primary
#make an argument for fraction of lights controlled
fraction_controlled = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("fraction_controlled",true)
fraction_controlled.setDisplayName("Fraction of Zone lighting controlled by this daylight control")
fraction_controlled.setDefaultValue(1)
args << fraction_controlled
#make an argument for setpoint
setpoint = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("setpoint",true)
setpoint.setDisplayName("Daylighting Setpoint (fc)")
setpoint.setDescription("1 fc = 10.76 lux. Default of 46.45 fc is 500 lux")
setpoint.setDefaultValue(46.45)
args << setpoint
#make an argument for control_type
chs = OpenStudio::StringVector.new
chs << "None"
chs << "Continuous"
chs << "Stepped"
chs << "Continuous/Off"
control_type = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("control_type",chs)
control_type.setDisplayName("Daylighting Control Type")
control_type.setDefaultValue("Continuous/Off")
args << control_type
#make an argument for min_power_fraction
min_power_fraction = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("min_power_fraction",true)
min_power_fraction.setDisplayName("Daylighting Minimum Input Power Fraction(min = 0 max = 0.6)")
min_power_fraction.setDefaultValue(0.3)
args << min_power_fraction
#make an argument for min_light_fraction
min_light_fraction = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("min_light_fraction",true)
min_light_fraction.setDisplayName("Daylighting Minimum Light Output Fraction (min = 0 max = 0.6)")
min_light_fraction.setDefaultValue(0.2)
args << min_light_fraction
#make an argument for Position X-Coordinate
x_pos = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("x_pos",true)
x_pos.setDisplayName("Position X-Coordinate (ft)")
args << x_pos
#make an argument for Position X-Coordinate
y_pos = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("y_pos",true)
y_pos.setDisplayName("Position Y-Coordinate (ft)")
args << y_pos
#make an argument for height
z_pos = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("z_pos",true)
z_pos.setDisplayName("Position Z-Coordinate (ft)")
z_pos.setDescription("Sensor Height from floor. Default value is 2.5 ft / 30 inches / 76.2 cm")
z_pos.setDefaultValue(2.5)
args << z_pos
#make an argument for Phi Rotation around Z-Axis
phi = OpenStudio::Ruleset::OSArgument::makeDoubleArgument("phi",true)
phi.setDisplayName("Phi Rotation around Z-axis")
phi.setDescription("Sensor rotation around the Z-axis, defines the direction towards which the sensor is looking. We assume Psi and Theta rotation = 0")
args << phi
return args
end
# define what happens when the measure is run
def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end
#assign the user inputs to variables
zone = runner.getOptionalWorkspaceObjectChoiceValue("zone",user_arguments,model)
is_primary = runner.getBoolArgumentValue("is_primary",user_arguments)
fraction_controlled = runner.getDoubleArgumentValue("fraction_controlled",user_arguments)
setpoint = runner.getDoubleArgumentValue("setpoint",user_arguments)
control_type = runner.getStringArgumentValue("control_type",user_arguments)
min_power_fraction = runner.getDoubleArgumentValue("min_power_fraction",user_arguments)
min_light_fraction = runner.getDoubleArgumentValue("min_light_fraction",user_arguments)
x_pos = runner.getDoubleArgumentValue("x_pos",user_arguments)
y_pos = runner.getDoubleArgumentValue("y_pos",user_arguments)
z_pos = runner.getDoubleArgumentValue("z_pos",user_arguments)
phi = runner.getDoubleArgumentValue("phi",user_arguments)
# check the zone for reasonableness
if zone.empty?
handle = runner.getStringArgumentValue("zone",user_arguments)
if handle.empty?
runner.registerError("No zone was selected.")
else
runner.registerError("The selected zone type with handle '#{handle}' was not found in the model. It may have been removed by another measure.")
end
return false
else
if not zone.get.to_ThermalZone.empty?
#If everything's alright, get the actual Thermal Zone object from the handle
zone = zone.get.to_ThermalZone.get
runner.registerInfo("Found the zone #{zone.name}")
runner.registerInfo("Spaces linked to zone: #{zone.spaces.size}")
else
runner.registerError("Script Error - argument not showing up as ThermalZone type.")
end
end
#check the fraction of lights controlled
if fraction_controlled < 0.0 or fraction_controlled > 1.0
runner.registerError("The requested Fraction of Zone Lights controlled of #{fraction_controlled} is outside the acceptable range of 0 to 1.")
return false
end
#check the setpoint for reasonableness
if setpoint < 0 or setpoint > 9999 #dfg need input on good value
runner.registerError("A setpoint of #{setpoint} foot-candles is outside the measure limit.")
return false
elsif setpoint > 100
# 100 fc is a 1000 lux, that's already too high for most applications.
runner.registerWarning("A setpoint of #{setpoint} foot-candles is abnormally high.")
end
#check the min_power_fraction for reasonableness
if min_power_fraction < 0.0 or min_power_fraction > 0.6
runner.registerError("The requested minimum input power fraction of #{min_power_fraction} for continuous dimming control is outside the acceptable range of 0 to 0.6.")
return false
end
#check the min_light_fraction for reasonableness
if min_light_fraction < 0.0 or min_light_fraction > 0.6
runner.registerError("The requested minimum light output fraction of #{min_light_fraction} for continuous dimming control is outside the acceptable range of 0 to 0.6.")
return false
end
#check the height for reasonableness
if z_pos < -360 or z_pos > 360 # neg ok because space origin may not be floor
runner.registerError("A setpoint of #{z_pos} inches is outside the measure limit.")
return false
elsif z_pos > 72
runner.registerWarning("A setpoint of #{z_pos} inches is abnormally high.")
elseif z_pos < 0
runner.registerWarning("Typically the sensor height should be a positive number, however if your space origin is above the floor then a negative sensor height may be appropriate.")
end
#Would be nice to try to check whether the sensor is within the zone/space, but we assume the user has placed it using sketchup and therefore can't make any mistakes...
#setup OpenStudio units that we will need
unit_setpoint_ip = OpenStudio::createUnit("fc").get
unit_setpoint_si = OpenStudio::createUnit("lux").get
unit_length_ip = OpenStudio::createUnit("ft").get
unit_length_si = OpenStudio::createUnit("m").get
#define starting units
setpoint_ip = OpenStudio::Quantity.new(setpoint, unit_setpoint_ip)
x_pos_ip = OpenStudio::Quantity.new(x_pos, unit_length_ip)
y_pos_ip = OpenStudio::Quantity.new(y_pos, unit_length_ip)
z_pos_ip = OpenStudio::Quantity.new(z_pos, unit_length_ip)
#unit conversion from IP units to SI units
setpoint_si = OpenStudio::convert(setpoint_ip, unit_setpoint_si).get
x_pos_si = OpenStudio::convert(x_pos_ip, unit_length_si).get
y_pos_si = OpenStudio::convert(y_pos_ip, unit_length_si).get
z_pos_si = OpenStudio::convert(z_pos_ip, unit_length_si).get
#reporting initial condition of model
runner.registerInitialCondition("Will try to add a daylight sensor to '#{zone.name}'.")
if (is_primary and zone.primaryDaylightingControl.empty?) or (not is_primary and zone.secondaryDaylightingControl.empty?)
#create a new sensor and put at the center of the space
sensor = OpenStudio::Model::DaylightingControl.new(model)
sensor.setName("#{zone.name} daylighting control")
# Create a new Point3d to put sensor where needed (set in SI units)
# new_point = OpenStudio::Point3d.new(x_pos_si, y_pos_si, z_pos_si)
new_point = OpenStudio::Point3d.new(x_pos_si.value, y_pos_si.value, z_pos_si.value)
sensor.setPosition(new_point)
# Set the Phi rotation around Z-Axis
sensor.setPhiRotationAroundZAxis(phi)
# Assign the illuminance (has to be set in SI units)
sensor.setIlluminanceSetpoint(setpoint_si.value)
# Assign the rest
sensor.setLightingControlType(control_type)
sensor.setMinimumInputPowerFractionforContinuousDimmingControl(min_power_fraction)
sensor.setMinimumLightOutputFractionforContinuousDimmingControl(min_light_fraction)
# Right now I just dump it into the first space I find... This could be a problem if you do use multiple spaces into one thermal zone. (/!\Is it really needed? might only apply if radiance as engine)
zone_space = zone.spaces[0]
runner.registerInfo("zone_space in zone: #{zone_space.name}, handle: #{zone_space.handle}")
sensor.setSpace(zone_space)
if is_primary
# Assign the sensor as a Primary Daylighting Control to the Thermal Zone
zone.setPrimaryDaylightingControl(sensor)
# Set fraction controlled
zone.setFractionofZoneControlledbyPrimaryDaylightingControl(fraction_controlled)
else
primary_fraction = zone.fractionofZoneControlledbyPrimaryDaylightingControl
total_fraction = fraction_controlled + primary_fraction
if total_fraction > 1
runner.registerError("The sum of Primary Fraction (#{primary_fraction}) and the desired Secondary Fraction (#{fraction_controlled}) of Zone lights controlled exceeds 1!")
return false
end
# Assign the sensor as a Primary Daylighting Control to the Thermal Zone
zone.setSecondaryDaylightingControl(sensor)
# Set fraction controlled
zone.setFractionofZoneControlledbySecondaryDaylightingControl(fraction_controlled)
end
else
runner.registerWarning("Thermal zone '#{zone.name}' already had a daylighting sensor. No sensor was added.")
end #end if
# Report final condition of model
runner.registerFinalCondition("Added a daylighting sensor to #{zone.name}. Here is the sensor definition \n\n #{sensor}")
puts zone.to_s
return true
end #end run
end #end class
# register the measure to be used by the application
AddAFullyDefinedDaylightSensor.new.registerWithApplication
| mit |
Symftony/form-handler | tests/Form/Extension/NotSubmitted/Type/NotSubmittedTypeExtensionTest.php | 1194 | <?php
namespace Symftony\FormHandler\Tests\Form\Extension\Invalid\Type;
use Symftony\FormHandler\Form\Extension\NotSubmitted\Type\NotSubmittedTypeExtension;
use Symfony\Component\OptionsResolver\OptionsResolver;
class NotSubmittedTypeExtensionTest extends \PHPUnit_Framework_TestCase
{
/**
* @var OptionsResolver
*/
private $optionsResolverMock;
/**
* @var NotSubmittedTypeExtension
*/
private $notSubmittedTypeExtension;
public function setUp()
{
$this->optionsResolverMock = $this->getMock(OptionsResolver::class);
$this->notSubmittedTypeExtension = new NotSubmittedTypeExtension();
}
public function testConfigureOptions()
{
$this->optionsResolverMock->expects($this->once())
->method('setDefaults')
->with($this->equalTo([
'handler_not_submitted' => false,
]));
$this->notSubmittedTypeExtension->configureOptions($this->optionsResolverMock);
}
public function testGetExtendedType()
{
$this->assertEquals('Symfony\Component\Form\Extension\Core\Type\FormType', $this->notSubmittedTypeExtension->getExtendedType());
}
}
| mit |
ckcollab/chin-up | project/apps/chinup/migrations/0007_auto__add_field_metric_boolean.py | 1887 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Metric.boolean'
db.add_column(u'chinup_metric', 'boolean',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
def backwards(self, orm):
# Deleting field 'Metric.boolean'
db.delete_column(u'chinup_metric', 'boolean')
models = {
u'chinup.metric': {
'Meta': {'object_name': 'Metric'},
'boolean': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'daily': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'description_best': ('django.db.models.fields.TextField', [], {}),
'description_worst': ('django.db.models.fields.TextField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'monthly': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
u'chinup.metricrecord': {
'Meta': {'object_name': 'MetricRecord'},
'datetime': ('django.db.models.fields.DateField', [], {}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'measurement': ('django.db.models.fields.IntegerField', [], {'default': '5', 'blank': 'True'}),
'metric': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['chinup.Metric']"}),
'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
}
}
complete_apps = ['chinup'] | mit |
shahabuddinp91/site | application/views/dashboard/settings/addLogo.php | 2029 | <section class="logosection">
<div class="col-md-offset-1 col-md-8 col-md-offset-1">
<div class="logo">
<div class="panel-info modal-content">
<div class="panel-heading text-center">Change Your Settings</div>
<p class="msg"><?php echo $this->session->flashdata('msg'); ?></p>
<p class="msg"><?php // echo validation_errors(); ?></p>
<?php echo form_open_multipart('Dashboard/logoSloganProcess', array('class' => 'form-horizontal')); ?>
<div class="form-group cmndiv">
<label for="name" class="col-md-offset-2 col-md-2 ttl">University Name</label>
<div class="col-md-6">
<input type="text" id="name" class="samefld" name="name" placeholder="Write Your University Name!">
</div>
</div>
<div class="form-group cmndiv">
<label for="title" class="col-md-offset-2 col-md-2 ttl">Title</label>
<div class="col-md-6">
<input type="text" id="title" name="title" class="samefld" placeholder="Write Versity Title!">
</div>
</div>
<div class="form-group cmndiv">
<label for="logofile" class="col-md-offset-2 col-md-2 ttl">Change Logo</label>
<div class="col-md-6">
<input type="file" name="logofile" class="logofile" id="logofile" placeholder="Change Your Logo">
</div>
</div>
<div class="form-group cmndiv">
<label for="" class="col-md-offset-2 col-md-2 ttl"></label>
<div class="col-md-6">
<input type="submit" class="btn-success submitbtn" name="save" value="Save">
</div>
</div>
<?php echo form_close(); ?>
</div>
</div>
</div>
</section>
| mit |
actfong/mixcloud | lib/mixcloud/track.rb | 356 | module Mixcloud
class Track < Mixcloud::Resource
include PopularNewHot
attr_accessor :public_url,
:api_url,
:name,
:key,
:slug,
:artist_url
# This class contains the following instance methods
# #popular_url
# #new_url
# #hot_url
end
end
| mit |
NikiStanchev/SoftUni | AngularFundamentals/AngularExamProject/recipe-blog/src/app/services/upload.service.ts | 2232 | import { Injectable } from '@angular/core';
import { AngularFireModule } from 'angularfire2';
import { GalleryRecipe } from '../models/galleryRecipe.model';
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database';
import { Upload } from '../models/upload.model';
import { Recipe } from '../models/recipe.model';
import * as firebase from 'firebase';
import * as _ from 'lodash';
import { Router } from '@angular/router';
@Injectable()
export class UploadService {
private imagesPath = '/images';
private recipePath = '/recipes';
constructor(private ngFire: AngularFireModule, private db: AngularFireDatabase, private router:Router) { }
uploadFile(files:FileList, recipe:Recipe){
const storageRef = firebase.storage().ref();
const filesIdx = _.range(files.length);
_.each(filesIdx, (idx) => {
const uploadFile = new Upload(files[idx]);
const uploadTask = storageRef.child(`${this.imagesPath}/${recipe.recipeName}/${uploadFile.file.name}`)
.put(uploadFile.file);
uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED,
// three observers
// 1.) state_changed observer
(snapshot) => {
// upload in progress
recipe.progress = (uploadTask.snapshot.bytesTransferred / uploadTask.snapshot.totalBytes) * 100;
},
// 2.) error observer
(error) => {
// upload failed
console.log(error);
},
// 3.) success observer
(): any => {
uploadFile.url = uploadTask.snapshot.downloadURL;
uploadFile.name = uploadFile.file.name;
this.saveFileData(uploadFile).then((r)=>{
recipe.imageKeys.push(r.key);
if(files.length === recipe.imageKeys.length){
this.saveRecipeData(recipe);
}
});
}
);
});
//this.router.navigate(['']);
}
private saveFileData(upload: Upload) {
const newRef = this.db.list(`${this.imagesPath}/`).push(upload);
return newRef;
}
private saveRecipeData(recipe: Recipe){
this.db.list(`${this.recipePath}/`).push(recipe).then(()=>{
this.router.navigate(['']);
})
}
} | mit |
wilcommerce/Wilcommerce.Core | src/Wilcommerce.Core.Common/Properties/AssemblyInfo.cs | 835 | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Wilcommerce.Core.Common")]
[assembly: AssemblyTrademark("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2fcdeae8-985b-4535-befc-7a517ae99dec")]
| mit |
greg1dime/project | src/Project/UserBundle/Tests/Controller/UserControllerTest.php | 1947 | <?php
namespace Project\UserBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class UserControllerTest extends WebTestCase
{
/*
public function testCompleteScenario()
{
// Create a new client to browse the application
$client = static::createClient();
// Create a new entry in the database
$crawler = $client->request('GET', '/project_user/');
$this->assertEquals(200, $client->getResponse()->getStatusCode(), "Unexpected HTTP status code for GET /project_user/");
$crawler = $client->click($crawler->selectLink('Create a new entry')->link());
// Fill in the form and submit it
$form = $crawler->selectButton('Create')->form(array(
'project_userbundle_usertype[field_name]' => 'Test',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check data in the show view
$this->assertGreaterThan(0, $crawler->filter('td:contains("Test")')->count(), 'Missing element td:contains("Test")');
// Edit the entity
$crawler = $client->click($crawler->selectLink('Edit')->link());
$form = $crawler->selectButton('Edit')->form(array(
'project_userbundle_usertype[field_name]' => 'Foo',
// ... other fields to fill
));
$client->submit($form);
$crawler = $client->followRedirect();
// Check the element contains an attribute with value equals "Foo"
$this->assertGreaterThan(0, $crawler->filter('[value="Foo"]')->count(), 'Missing element [value="Foo"]');
// Delete the entity
$client->submit($crawler->selectButton('Delete')->form());
$crawler = $client->followRedirect();
// Check the entity has been delete on the list
$this->assertNotRegExp('/Foo/', $client->getResponse()->getContent());
}
*/
}
| mit |
mbostler/blog5 | test/models/user_test.rb | 439 | # == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string
# name :string not null
# password_digest :string not null
# created_at :datetime not null
# updated_at :datetime not null
#
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| mit |
Develman/DevelSuite | src/DevelSuite/http/dsResponse.php | 7505 | <?php
/*
* This file is part of the DevelSuite
* Copyright (C) 2012 Georg Henkel <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace DevelSuite\http;
use DevelSuite\config\dsConfig;
/**
* FIXME
*
* @package DevelSuite\http
* @author Georg Henkel <[email protected]>
* @version 1.0
*/
class dsResponse {
private $protocol = "HTTP/1.1";
private $statusCode = "200";
private $statusText = "OK";
private $contentType = "text/html";
private $charset = "UTF-8";
private $headers = array();
private $content;
private $cookies = array();
private $headersOnly;
/**
* Constructor
*/
public function __construct() {
$this->protocol = dsConfig::read("app.http.protocol", "HTTP/1.1");
$this->charset = dsConfig::read("app.http.charset", "UTF-8");
}
/**
* Holds HTTP response statuses
*
* @var array
*/
protected $_statusCodes = array(
100 => 'Continue',
101 => 'Switching Protocols',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authoritative Information',
204 => 'No Content',
205 => 'Reset Content',
206 => 'Partial Content',
300 => 'Multiple Choices',
301 => 'Moved Permanently',
302 => 'Found',
303 => 'See Other',
304 => 'Not Modified',
305 => 'Use Proxy',
307 => 'Temporary Redirect',
400 => 'Bad Request',
401 => 'Unauthorized',
402 => 'Payment Required',
403 => 'Forbidden',
404 => 'Not Found',
405 => 'Method Not Allowed',
406 => 'Not Acceptable',
407 => 'Proxy Authentication Required',
408 => 'Request Time-out',
409 => 'Conflict',
410 => 'Gone',
411 => 'Length Required',
412 => 'Precondition Failed',
413 => 'Request Entity Too Large',
414 => 'Request-URI Too Large',
415 => 'Unsupported Media Type',
416 => 'Requested range not satisfiable',
417 => 'Expectation Failed',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
503 => 'Service Unavailable',
504 => 'Gateway Time-out'
);
public function setStatusCode($code, $text) {
$this->statusCode = $code;
if(NULL !== $text) {
$this->statusText = $text;
} else {
$this->statusText = $statusTexts[$code];
}
}
public function setHeadersOnly($headersOnly) {
$this->headersOnly = $headersOnly;
}
public function headersOnly() {
return $this->headersOnly;
}
public function setContentType($contentType) {
$this->contentType = $contentType;
}
public function getContentType() {
return $this->contentType;
}
/**
* Sets a header.
*
* @param string $name header name
* @param string $value Value (if null, remove the header)
* @param bool $replace Replace for the value
*
*/
public function addHeader($name, $value = NULL) {
if (!isset($value)) {
$this->headers[$name] = NULL;
} else {
$this->headers[$name] = $value;
}
}
/**
* Checks if response has given HTTP header.
*
* @param string $name HTTP header name
*
* @return bool
*/
public function hasHeader($name) {
return array_key_exists($name, $this->headers);
}
/**
* Add content of the page(s)
*
* @param $content
* content displaying the page
*/
public function setContent($content) {
$this->content = $content;
}
/**
* @return the content
*/
public function getContent() {
return $this->content;
}
/**
* Replace current content with a new one
*
* @param string $newContent
* replacing content
*/
public function replaceContent($newContent) {
$this->content = $newContent;
}
/**
* Sends HTTP headers and cookies. Only the first invocation of this method will send the headers.
* Subsequent invocations will silently do nothing. This allows certain actions to send headers early,
* while still using the standard controller.
*/
public function sendHeaders()
{
// status-line
$status = "{$this->protocol} {$this->statusCode} {$this->statusText}";
header($status);
$contentType = "Content-Type: " . "{$this->contentType}; charset={$this->charset}";
header($contentType);
foreach ($this->headers as $name => $value) {
if($value === NULL) {
header("{$name}");
} else {
header("{$name}: {$value}");
}
}
// cookies
foreach ($this->cookies as $cookie) {
setcookie($cookie['name'], $cookie['value'], $cookie['expire'], $cookie['path'], $cookie['domain'], $cookie['secure'], $cookie['httpOnly']);
}
}
/**
* Sends the HTTP headers and the content.
*/
public function send() {
$this->sendHeaders();
if(!$this->headersOnly) {
$this->content = ob_get_clean();
echo $this->content;
}
}
/**
* Redirects to another url. If immediately is TRUE it redirects
* directly without finishing the script.
*
* @param string $url
* url to which will redirected
* @param bool $immediately
* redirect immediately?
*/
public function redirectURL($url, $immediately = FALSE) {
$this->addHeader("Location", $url);
if($immediately === TRUE) {
$this->setHeadersOnly(TRUE);
$this->send();
exit();
}
}
/**
* Sets the correct headers to instruct the client to not cache the response
*/
public function disableCache() {
$this->addHeader('Expires', "Mon, 26 Jul 1997 05:00:00 GMT");
$this->addHeader('Last-Modified', "Mon, 26 Jul 1997 05:00:00 GMT");
$this->addHeader('Cache-Control', "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
$this->addHeader('Pragma', "no-cache");
}
/**
* Sets the correct headers to instruct the client to cache the response.
*
* @param string $since
* A valid time since the response text has not been modified
* @param string $time
* A valid time for cache expiry
*/
public function cache($since, $time = '+1 day') {
if (!is_integer($time)) {
$time = strtotime($time);
}
$this->addHeader('Date', gmdate("D, j M Y G:i:s ", time()) . "GMT");
$this->addHeader('Last-Modified', gmdate("D, j M Y G:i:s ", $since) . "GMT");
$this->addHeader('Expires', gmdate("D, j M Y H:i:s", $time) . " GMT");
$this->addHeader('Cache-Control', "public, max-age=" . ($time - time()));
$this->addHeader('Pragma', "cache");
}
/**
* Sets a cookie
*
* @param string $name
* HTTP header name
* @param string $value
* Value for the cookie
* @param string $expire
* Cookie expiration period
* @param string $path
* Path
* @param string $domain
* Domain name
* @param bool $secure
* If secure
* @param bool $httpOnly
* If uses only HTTP
*/
public function setCookie($name, $value, $expire = NULL, $path = '/', $domain = '', $secure = FALSE, $httpOnly = FALSE) {
if ($expire !== NULL) {
if (is_numeric($expire)) {
$expire = (int) $expire;
} else {
$expire = strtotime($expire);
if ($expire === FALSE || $expire == -1) {
throw new dsResponseException('Your expire parameter is not valid.');
}
}
}
$this->cookies[$name] = array(
'name' => $name,
'value' => $value,
'expire' => $expire,
'path' => $path,
'domain' => $domain,
'secure' => $secure ? true : false,
'httpOnly' => $httpOnly);
}
/**
* Deletes a cookie
*
* @param string $name
* Name of the cookie
*/
public function deleteCookie($name, $path = '/', $domain = '', $secure = FALSE) {
setCookie($name, "", time() - 3600, $path, $domain, $secure);
unset($this->cookies[$name]);
}
} | mit |
paysdoc/js-mutation-testing | src/mutationOperator/UnaryExpressionMO.js | 1420 | /**
* This command removes unary expressions.
*
* e.g. -42 becomes 42, -true becomes true, !false becomes false, ~123 becomes 123.
*
* Created by Merlin Weemaes on 2/19/15.
*/
(function(module) {
'use strict';
var MutationUtils = require('../utils/MutationUtils'),
MutationOperator = require('./MutationOperator');
var code = 'UNARY_EXPRESSION';
function UnaryExpressionMO(astNode) {
MutationOperator.call(this, astNode);
this.code = code;
}
UnaryExpressionMO.prototype.apply = function () {
var mutationInfo;
if (!this._original) {
this._original = this._astNode;
this._astNode = this._astNode.argument;
mutationInfo = MutationUtils.createUnaryOperatorMutation(this._astNode, this._parentMutationId, "");
}
return mutationInfo;
};
UnaryExpressionMO.prototype.revert = function() {
this._astNode = this._original || this._astNode;
this._original = null;
};
UnaryExpressionMO.prototype.getReplacement = function() {
var astNode = this._astNode;
return {
value: null,
begin: astNode.range[0],
end: astNode.range[0]+1
};
};
module.exports.create = function(astNode) {
return astNode.operator ? [new UnaryExpressionMO(astNode)] : [];
};
module.exports.code = code;
})(module);
| mit |
fagbokforlaget/eportaljs | lib/client.js | 3481 | var request = require('urllib').request;
// Eportal object
function Eportal(params) {
params = params || {};
this.host = params.auth_host;
this.data_host = params.eportal_host || params.auth_host;
this.api_key = params.api_key;
this.api_secret = params.api_secret;
this.grant_type = params.grant_type || "client_credentials";
this.scope = params.scope || "dbok read_full write_full";
return this;
};
// Two legged OAuth server side workflow
Eportal.prototype.getToken = function(callback) {
var _ = this;
var token_url = this.host + "/OAuth/Token";
request(token_url, {
method: 'POST',
headers: {
'Content-Type': 'Application/x-www-form-urlencoded'
},
dataType: 'json',
data: {
client_id: this.api_key,
client_secret: this.api_secret,
grant_type: this.grant_type,
scope: this.scope
}
}, function (err, data, res) {
callback(err, data);
});
};
// Create new book
Eportal.prototype.addBook = function(params, callback) {
var _ = this;
this.getToken(function(err, data) {
if (err) {
console.error("Couldn't fetch access token");
callback(err, null);
return;
}
else {
var access_token = data.access_token
request(_.data_host + "/add/book", {
method: 'POST',
dataType: 'json',
headers: {
'Authorization': 'Bearer '+ access_token,
'Content-Type': 'application/json'
},
content: JSON.stringify(params),
}, function(err, book, res) {
if (err || res.statusCode !== 200) {
callback(true, null);
return;
}
else {
callback(false, book);
}
});
}
});
};
// Update book
// Keep API sane
Eportal.prototype.upsertBook = function(id, params, callback) {
if (typeof id === "undefined") {
console.error("Book ID is required to update book");
return;
}
// use api upsert method
params["ExternalID"] = id;
this.addBook(params, callback);
};
// Create new book
Eportal.prototype.getBook = function(id, callback) {
var _ = this;
this.getToken(function(err, data) {
if (err) {
console.error("Couldn't fetch access token");
callback(err, null);
return;
}
else {
var access_token = data.access_token
request(_.data_host + "/get/book/"+ id, {
method: 'GET',
dataType: 'json',
headers: {
'Authorization': 'Bearer '+ access_token
}
}, function(err, book, res) {
if (err || res.statusCode !== 200) {
callback(true, null);
return;
}
else {
callback(false, book);
}
});
}
});
};
// Delete book
Eportal.prototype.deleteBook = function(id, callback) {
var _ = this;
this.getToken(function(err, data) {
if (err) {
console.error("Couldn't fetch access token");
callback(err, null);
return;
}
else {
var access_token = data.access_token
request(_.data_host + "/delete/book/"+ id, {
method: 'GET',
dataType: 'json',
headers: {
'Authorization': 'Bearer '+ access_token
}
}, function(err, book, res) {
if (err && res.statusCode !== 200) {
callback(true, null);
return;
}
else {
callback(false, book);
}
});
}
});
};
module.exports = Eportal;
| mit |
cloudmodel/cloudmodel | app/models/cloud_model/mixins/smart_to_string.rb | 152 | module CloudModel
module Mixins
module SmartToString
def to_s options={}
"#{model_name.human} '#{name}'"
end
end
end
end | mit |
Pouf/CodingCompetition | CiO/digits-multiplication.py | 213 | from functools import reduce
def checkio(i):
digits = str(i).replace('0','')
result = reduce(lambda x, y: int(x)*int(y), digits)
return int(result)
golf=lambda n:(n%10or 1)*golf(n//10)if n else 1
| mit |
Octachore/INTECH-TP-NetworkApp | src/app/services/SocketService.ts | 1023 | import {Injectable, NgZone } from "@angular/core";
import { ServerConfiguration } from './ServerConfiguration';
import * as io from 'socket.io-client';
@Injectable()
export class SocketService {
private url: string;
private socket: SocketIOClient.Socket;
private connect: Promise<SocketIOClient.Socket>;
private zone:NgZone;
constructor( config: ServerConfiguration, zone:NgZone ){
this.url = config.url;
this.zone = zone;
this.socket = io(this.url);
this.connect = new Promise<SocketIOClient.Socket>((resolve, reject)=>{
this.socket.on('connect', function(){
resolve(this.socket);
});
});
}
on(event: string, callback: (...data: any[]) => void){
this.connect.then( s => this.socket.on(event, (data) => {
this.zone.run( () => callback.apply(this, data) );
} ));
}
emit(event:string, ...args:any[]){
this.connect.then( s => this.socket.emit(event, args) );
}
} | mit |
munkychop/bullet | example/js/app/app.js | 1474 | // TODO : Visually display the current state of Bullet.events
// TODO : Provide buttons to add/remove events
// TODO : Provide buttons to map/unmap events to callbacks??
(function () {
'use strict';
var Bullet = window.Bullet;
// Bullet.setStrictMode(true);
Bullet.addEventName('foo');
Bullet.addEventName('bar');
Bullet.addEventName('baz');
var buttonFoo = document.getElementById('button-foo');
var buttonBar = document.getElementById('button-bar');
var buttonBaz = document.getElementById('button-baz');
var textFoo = document.getElementById('text-foo');
var textBar = document.getElementById('text-bar');
var textBaz = document.getElementById('text-baz');
var numFooEvents = 0;
var numBarEvents = 0;
var numBazEvents = 0;
function fooEventHandler ()
{
numFooEvents++;
textFoo.innerHTML = numFooEvents;
}
function barEventHandler ()
{
numBarEvents++;
textBar.innerHTML = numBarEvents;
}
function bazEventHandler ()
{
numBazEvents++;
textBaz.innerHTML = numBazEvents;
}
function triggerFoo ()
{
Bullet.trigger(Bullet.events.foo);
}
function triggerBar ()
{
Bullet.trigger(Bullet.events.bar);
}
function triggerBaz ()
{
Bullet.trigger(Bullet.events.baz);
}
Bullet.on(Bullet.events.foo, fooEventHandler);
Bullet.on(Bullet.events.bar, barEventHandler);
Bullet.once(Bullet.events.baz, bazEventHandler);
buttonFoo.onclick = triggerFoo;
buttonBar.onclick = triggerBar;
buttonBaz.onclick = triggerBaz;
})(); | mit |
zenkovnick/pfr | lib/migration/doctrine/1384166288_version9.php | 3835 | <?php
/**
* This class has been auto-generated by the Doctrine ORM Framework
*/
class Version9 extends Doctrine_Migration_Base
{
public function up()
{
$this->dropForeignKey('account', 'account_chief_pilot_id_sf_guard_user_id');
$this->dropForeignKey('flight', 'flight_pic_id_sf_guard_user_id');
$this->dropForeignKey('flight', 'flight_sic_id_sf_guard_user_id');
$this->createForeignKey('account', 'account_chief_pilot_id_sf_guard_user_id_1', array(
'name' => 'account_chief_pilot_id_sf_guard_user_id_1',
'local' => 'chief_pilot_id',
'foreign' => 'id',
'foreignTable' => 'sf_guard_user',
'onUpdate' => '',
'onDelete' => 'SET NULL',
));
$this->createForeignKey('flight', 'flight_pic_id_sf_guard_user_id_1', array(
'name' => 'flight_pic_id_sf_guard_user_id_1',
'local' => 'pic_id',
'foreign' => 'id',
'foreignTable' => 'sf_guard_user',
'onUpdate' => '',
'onDelete' => 'SET NULL',
));
$this->createForeignKey('flight', 'flight_sic_id_sf_guard_user_id_1', array(
'name' => 'flight_sic_id_sf_guard_user_id_1',
'local' => 'sic_id',
'foreign' => 'id',
'foreignTable' => 'sf_guard_user',
'onUpdate' => '',
'onDelete' => 'SET NULL',
));
$this->addIndex('account', 'account_chief_pilot_id', array(
'fields' =>
array(
0 => 'chief_pilot_id',
),
));
$this->addIndex('flight', 'flight_pic_id', array(
'fields' =>
array(
0 => 'pic_id',
),
));
$this->addIndex('flight', 'flight_sic_id', array(
'fields' =>
array(
0 => 'sic_id',
),
));
}
public function down()
{
$this->createForeignKey('account', 'account_chief_pilot_id_sf_guard_user_id', array(
'name' => 'account_chief_pilot_id_sf_guard_user_id',
'local' => 'chief_pilot_id',
'foreign' => 'id',
'foreignTable' => 'sf_guard_user',
'onUpdate' => '',
'onDelete' => 'CASCADE',
));
$this->createForeignKey('flight', 'flight_pic_id_sf_guard_user_id', array(
'name' => 'flight_pic_id_sf_guard_user_id',
'local' => 'pic_id',
'foreign' => 'id',
'foreignTable' => 'sf_guard_user',
'onUpdate' => '',
'onDelete' => 'CASCADE',
));
$this->createForeignKey('flight', 'flight_sic_id_sf_guard_user_id', array(
'name' => 'flight_sic_id_sf_guard_user_id',
'local' => 'sic_id',
'foreign' => 'id',
'foreignTable' => 'sf_guard_user',
'onUpdate' => '',
'onDelete' => 'CASCADE',
));
$this->dropForeignKey('account', 'account_chief_pilot_id_sf_guard_user_id_1');
$this->dropForeignKey('flight', 'flight_pic_id_sf_guard_user_id_1');
$this->dropForeignKey('flight', 'flight_sic_id_sf_guard_user_id_1');
$this->removeIndex('account', 'account_chief_pilot_id', array(
'fields' =>
array(
0 => 'chief_pilot_id',
),
));
$this->removeIndex('flight', 'flight_pic_id', array(
'fields' =>
array(
0 => 'pic_id',
),
));
$this->removeIndex('flight', 'flight_sic_id', array(
'fields' =>
array(
0 => 'sic_id',
),
));
}
} | mit |
labai/opa | opa-pa/src/test/java/opalib/opapa/impl/IntTestBase.java | 477 | package opalib.opapa.impl;
import opalib.opapa.OpaServer;
import org.junit.Assume;
import org.junit.Before;
/**
* @author Augustus
* created on 2018.12.22
*/
public class IntTestBase {
protected OpaServer server;
@Before
public void init() {
Assume.assumeTrue("Are integration tests enabled?", TestParams.INT_TESTS_ENABLED);
server = IntTestStruct.createOpaServer(TestParams.APP_SERVER);
}
protected void log(String msg) {
System.out.println(msg);
}
}
| mit |
lftzzzzfeng/myaolin | application/models/MemberModel.php | 3671 | <?php
/**
* Created by PhpStorm.
* User: LiuFeng
* Date: 2017/8/22
* Time: 9:26
*/
require_once dirname(__FILE__) . '/../util/Constant.php';
class MemberModel extends CI_Model
{
const TABLE_MEMBER = 'member';
const SOURCE_TYPE_WEIBO = 1;
const SOURCE_TYPE_WECHAT = 2;
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->library('session');
}
/**
* 是否为会员
*
* @param int $sourceType 来源
* @param string $username 用户名
*
* @return boolean
*/
public function existMember($sourceType, $username)
{
$condition = [
'sourceType' => $sourceType,
'username' => $username,
'status' => \util\Constant::STATUS_ACTIVE
];
$member = $this->db->select('id')->where($condition)->get(self::TABLE_MEMBER)->result_array();
if ($member) {
return true;
} else {
return false;
}
}
/**
* 存储会员
*
* @param int $sourceType 来源
* @param string $uid 第三方id
* @param string $username 用户名称
* @param string $email 邮件
* @param string $mobile 手机
* @param int $status 状态
*
* @return int
*/
public function saveMember($sourceType, $uid, $username, $email = null, $mobile = null, $status = 1)
{
$data = [];
if ($sourceType == self::SOURCE_TYPE_WEIBO) {
$member = $this->db->where(['uid' => $uid, 'isDeleted' => \util\Constant::IS_DELETED_NO])->get(self::TABLE_MEMBER)->row_array();
} else if ($sourceType == self::SOURCE_TYPE_WECHAT) {
$member = $this->db->where(['uid' => $uid, 'isDeleted' => \util\Constant::IS_DELETED_NO])->get(self::TABLE_MEMBER)->row_array();
}
$data['sourceType'] = $sourceType;
if ($uid) {
$data['uid'] = $uid;
}
if ($username) {
$data['username'] = $username;
}
if ($email) {
$data['email'] = $email;
}
if ($mobile) {
$data['mobile'] = $mobile;
}
$data['status'] = $status;
if ($member) {
$savedId = $member['id'];
$data['lastLoginTimestamp'] = time();
$this->db->where('id', intval($savedId));
$this->db->update(self::TABLE_MEMBER, $data);
} else {
$data['createdTimestamp'] = time();
$this->db->insert(self::TABLE_MEMBER, $data);
$savedId = $this->db->insert_id();
}
return $savedId;
}
/**
* 获取微博渠道会员
*
* @param string $uid 三方id
*
* @return array
*/
public function getMemberInWeiBo($uid)
{
$condition = [
'sourceType' => self::SOURCE_TYPE_WEIBO,
'uid' => $uid,
'status' => \util\Constant::STATUS_ACTIVE
];
return $this->db->select('id, sourceType, uid, username, email, mobile')->where($condition)->get(self::TABLE_MEMBER)->row_array();
}
/**
* 判断用户是否存在
*
* @param $souceType
* @param $uid
*
* @return boolean
*/
public function isExistMember($sourceType, $uid)
{
$condition = [
'sourceType' => $sourceType,
'uid' => $uid,
'status' => \util\Constant::STATUS_ACTIVE
];
if ($this->db->select('id')->where($condition)->get(self::TABLE_MEMBER)->row()) {
return true;
} else {
return false;
}
}
}
| mit |
andbet39/recipeMean | app/controllers/answers.server.controller.js | 2499 | 'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
errorHandler = require('./errors.server.controller'),
Answer = mongoose.model('Answer'),
_ = require('lodash');
var ObjectId = (require('mongoose').Types.ObjectId);
/**
* Create a Answer
*/
exports.create = function(req, res) {
var answer = new Answer(req.body);
answer.user = req.user;
answer.enquire._id = req.enquire;
console.log (answer);
answer.save(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(answer);
}
});
};
/**
* Show the current Answer
*/
exports.read = function(req, res) {
res.jsonp(req.answer);
};
/**
* Update a Answer
*/
exports.update = function(req, res) {
var answer = req.answer ;
answer = _.extend(answer , req.body);
answer.save(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(answer);
}
});
};
/**
* Delete an Answer
*/
exports.delete = function(req, res) {
var answer = req.answer ;
answer.remove(function(err) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(answer);
}
});
};
/**
* List of Answers
*/
exports.list = function(req, res) {
Answer.find().sort('-created').populate('user', 'displayName').exec(function(err, answers) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(answers);
}
});
};
/**
* Answer middleware
*/
exports.answerByID = function(req, res, next, id) {
Answer.findById(id).populate('user', 'displayName').exec(function(err, answer) {
if (err) return next(err);
if (! answer) return next(new Error('Failed to load Answer ' + id));
req.answer = answer ;
next();
});
};
exports.answerByEnquireID = function(req,res){
console.log('Queried Answer for enquire id :' + req.params.enquireId);
Answer.find({'enquire': new ObjectId(req.params.enquireId)}).sort('-created').exec(function(err, answers) {
if (err) {
return res.status(400).send({
message: errorHandler.getErrorMessage(err)
});
} else {
res.jsonp(answers);
}
});
};
/**
* Answer authorization middleware
*/
exports.hasAuthorization = function(req, res, next) {
if (req.answer.user.id !== req.user.id) {
return res.status(403).send('User is not authorized');
}
next();
};
| mit |
xlevus/python-diana | diana/__init__.py | 169 | from .injector import Injector, NoProvider # noqa
from .module import Module, provider, contextprovider, provides # noqa
__version__ = "3.1.2"
injector = Injector()
| mit |
websoftwares/ci-cd-webtask-example | function-with-context.test.js | 729 | 'use strict'
const tape = require('tape')
const functionWithContext = require('./function-with-context')
let contextMock = { data: { name: null } }
const cbSpy = (t, expected) => (error, actual) => {
t.equal(null, error, `Assert expected: null matches actual: ${error}`)
t.deepEqual(
expected,
actual,
`Assert expected: ${JSON.stringify(expected)} matches actual: ${JSON.stringify(actual)}`
)
}
tape('Function with context test cases', (t) => {
const names = ['Boris', 'Anonymous']
for (let i = 0; i < names.length; i++) {
let name = names[i] === 'Anonymous' ? null : names[i]
contextMock.data.name = name
functionWithContext(contextMock, cbSpy(t, { hello_you: names[i] }))
}
t.end()
})
| mit |
Michayal/michayal.github.io | node_modules/mathjs/lib/entry/dependenciesAny/dependenciesMolarMassC12.generated.js | 695 | "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.molarMassC12Dependencies = void 0;
var _dependenciesBigNumberClass = require("./dependenciesBigNumberClass.generated");
var _dependenciesUnitClass = require("./dependenciesUnitClass.generated");
var _factoriesAny = require("../../factoriesAny.js");
/**
* THIS FILE IS AUTO-GENERATED
* DON'T MAKE CHANGES HERE
*/
var molarMassC12Dependencies = {
BigNumberDependencies: _dependenciesBigNumberClass.BigNumberDependencies,
UnitDependencies: _dependenciesUnitClass.UnitDependencies,
createMolarMassC12: _factoriesAny.createMolarMassC12
};
exports.molarMassC12Dependencies = molarMassC12Dependencies; | mit |
wix/wix-style-react | packages/wix-style-react/src/Modal/Modal.driver.d.ts | 514 | import { BaseDriver } from 'wix-ui-test-utils/driver-factory';
export interface ModalDriver<T> extends BaseDriver {
element: () => T;
isOpen: () => boolean;
getChildBySelector: (selector: string) => HTMLElement | null;
isScrollable: () => boolean;
closeButtonExists: () => boolean;
clickOnOverlay: () => boolean;
clickOnCloseButton: () => boolean;
getContent: () => Element;
getContentStyle: () => CSSStyleDeclaration;
getContentLabel: () => string | null;
getZIndex: () => string | null;
}
| mit |
andra49/kakas-visualisasi | resources/views/dataset/upload.blade.php | 1751 | @extends('layouts.master')
@section('content')
<div class="container-fluid">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Unggah Dataset Baru</div>
<div class="panel-body">
<div class="about-section">
<div class="text-content">
<div class="span7 offset1">
@if(Session::has('success'))
<div class="alert-box success">
<h2>{!! Session::get('success') !!}</h2>
</div>
@endif
<div class="secure">Upload dataset</div>
{!! Form::open(array('url'=>'dataset/upload','method'=>'POST', 'files'=>true)) !!}
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="control-group">
<div class="controls">
{!! Form::file('dataset') !!}
</div>
@if(Session::has('error'))
<p class="errors">{!! Session::get('error') !!}</p>
@endif
</div>
<div id="success"> </div>
{!! Form::submit('Submit', array('class'=>'btn btn-default send-btn pull-right')) !!}
{!! Form::close() !!}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection | mit |
alxhub/angular | packages/compiler-cli/test/compliance/test_cases/r3_view_compiler_styling/component_styles/GOLDEN_PARTIAL.js | 7197 | /****************************************************************************************************
* PARTIAL FILE: encapsulation_default.js
****************************************************************************************************/
import { Component, NgModule } from '@angular/core';
import * as i0 from "@angular/core";
export class MyComponent {
}
MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); };
MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: MyComponent, selector: "my-component", ngImport: i0, template: '...', isInline: true, styles: ["div.foo { color: red; }", ":host p:nth-child(even) { --webkit-transition: 1s linear all; }"] });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MyComponent, [{
type: Component,
args: [{
selector: 'my-component',
styles: [
'div.foo { color: red; }', ':host p:nth-child(even) { --webkit-transition: 1s linear all; }'
],
template: '...'
}]
}], null, null); })();
export class MyModule {
}
MyModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: MyModule });
MyModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } });
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })();
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MyModule, [{
type: NgModule,
args: [{ declarations: [MyComponent] }]
}], null, null); })();
/****************************************************************************************************
* PARTIAL FILE: encapsulation_default.d.ts
****************************************************************************************************/
import * as i0 from "@angular/core";
export declare class MyComponent {
static ɵfac: i0.ɵɵFactoryDef<MyComponent, never>;
static ɵcmp: i0.ɵɵComponentDefWithMeta<MyComponent, "my-component", never, {}, {}, never, never>;
}
export declare class MyModule {
static ɵmod: i0.ɵɵNgModuleDefWithMeta<MyModule, [typeof MyComponent], never, never>;
static ɵinj: i0.ɵɵInjectorDef<MyModule>;
}
/****************************************************************************************************
* PARTIAL FILE: encapsulation_none.js
****************************************************************************************************/
import { Component, NgModule, ViewEncapsulation } from '@angular/core';
import * as i0 from "@angular/core";
export class MyComponent {
}
MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); };
MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: MyComponent, selector: "my-component", ngImport: i0, template: '...', isInline: true, styles: ["div.tall { height: 123px; }", ":host.small p { height:5px; }"], encapsulation: i0.ViewEncapsulation.None });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MyComponent, [{
type: Component,
args: [{
selector: 'my-component',
encapsulation: ViewEncapsulation.None,
styles: ['div.tall { height: 123px; }', ':host.small p { height:5px; }'],
template: '...'
}]
}], null, null); })();
export class MyModule {
}
MyModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: MyModule });
MyModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } });
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })();
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MyModule, [{
type: NgModule,
args: [{ declarations: [MyComponent] }]
}], null, null); })();
/****************************************************************************************************
* PARTIAL FILE: encapsulation_none.d.ts
****************************************************************************************************/
import * as i0 from "@angular/core";
export declare class MyComponent {
static ɵfac: i0.ɵɵFactoryDef<MyComponent, never>;
static ɵcmp: i0.ɵɵComponentDefWithMeta<MyComponent, "my-component", never, {}, {}, never, never>;
}
export declare class MyModule {
static ɵmod: i0.ɵɵNgModuleDefWithMeta<MyModule, [typeof MyComponent], never, never>;
static ɵinj: i0.ɵɵInjectorDef<MyModule>;
}
/****************************************************************************************************
* PARTIAL FILE: encapsulation_shadow_dom.js
****************************************************************************************************/
import { Component, NgModule, ViewEncapsulation } from '@angular/core';
import * as i0 from "@angular/core";
export class MyComponent {
}
MyComponent.ɵfac = function MyComponent_Factory(t) { return new (t || MyComponent)(); };
MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ version: "0.0.0-PLACEHOLDER", type: MyComponent, selector: "my-component", ngImport: i0, template: '...', isInline: true, styles: ["div.cool { color: blue; }", ":host.nice p { color: gold; }"], encapsulation: i0.ViewEncapsulation.ShadowDom });
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MyComponent, [{
type: Component,
args: [{
encapsulation: ViewEncapsulation.ShadowDom,
selector: 'my-component',
styles: ['div.cool { color: blue; }', ':host.nice p { color: gold; }'],
template: '...'
}]
}], null, null); })();
export class MyModule {
}
MyModule.ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: MyModule });
MyModule.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ factory: function MyModule_Factory(t) { return new (t || MyModule)(); } });
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(MyModule, { declarations: [MyComponent] }); })();
(function () { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MyModule, [{
type: NgModule,
args: [{ declarations: [MyComponent] }]
}], null, null); })();
/****************************************************************************************************
* PARTIAL FILE: encapsulation_shadow_dom.d.ts
****************************************************************************************************/
import * as i0 from "@angular/core";
export declare class MyComponent {
static ɵfac: i0.ɵɵFactoryDef<MyComponent, never>;
static ɵcmp: i0.ɵɵComponentDefWithMeta<MyComponent, "my-component", never, {}, {}, never, never>;
}
export declare class MyModule {
static ɵmod: i0.ɵɵNgModuleDefWithMeta<MyModule, [typeof MyComponent], never, never>;
static ɵinj: i0.ɵɵInjectorDef<MyModule>;
}
| mit |
mycoin/lotus | noah-service/src/main/java/com/breakidea/noah/service/impl/UserServiceImpl.java | 1996 | package com.breakidea.noah.service.impl;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.breakidea.noah.common.exception.ServiceException;
import com.breakidea.noah.common.model.UserModel;
import com.breakidea.noah.common.parameter.UserParameter;
import com.breakidea.noah.common.service.UserService;
import com.breakidea.noah.common.vo.UserVO;
import com.breakidea.noah.dao.UserDao;
import com.breakidea.noah.support.Encoder;
@Service
public class UserServiceImpl implements UserService {
@Resource
private UserDao userDao;
@Override
public void add(UserParameter param) throws ServiceException {
if (!StringUtils.hasLength(param.getPassword())) {
throw new ServiceException("Bad Parameter", null);
}
String password = param.getPassword();
String encode = Encoder.encodeQuietly(password);
param.setPassword(encode);
param.setStatus("SK");
userDao.insert(param);
}
@Override
public void delete(UserParameter param) {
userDao.delete(param);
}
@Override
public List<UserVO> queryList(UserParameter param) {
List<UserVO> vos = new ArrayList<UserVO>();
List<UserModel> models = userDao.query(param);
if (!CollectionUtils.isEmpty(models)) {
for (UserModel model : models) {
UserVO vo = new UserVO();
BeanUtils.copyProperties(model, vo);
vos.add(vo);
}
}
return vos;
}
@Override
public void update(UserParameter param) {
UserModel model = userDao.queryById(param.getId());
if (model == null) {
userDao.insert(param);
} else {
userDao.update(param);
}
}
}
| mit |
Karasiq/scalajs-highcharts | src/main/scala/com/highstock/config/SeriesTreemapAnimation.scala | 885 | /**
* Automatically generated file. Please do not edit.
* @author Highcharts Config Generator by Karasiq
* @see [[http://api.highcharts.com/highstock]]
*/
package com.highstock.config
import scalajs.js, js.`|`
import com.highcharts.CleanJsObject
import com.highcharts.HighchartsUtils._
/**
* @note JavaScript name: <code>series<treemap>-animation</code>
*/
@js.annotation.ScalaJSDefined
class SeriesTreemapAnimation extends com.highcharts.HighchartsGenericObject {
val duration: js.UndefOr[Double] = js.undefined
}
object SeriesTreemapAnimation {
/**
*/
def apply(duration: js.UndefOr[Double] = js.undefined): SeriesTreemapAnimation = {
val durationOuter: js.UndefOr[Double] = duration
com.highcharts.HighchartsGenericObject.toCleanObject(new SeriesTreemapAnimation {
override val duration: js.UndefOr[Double] = durationOuter
})
}
}
| mit |
reinvent-the-wheel/LeetCode | PascalsTriangle2.java | 2241 | /*
*key point: much like the Pascal's Triangle quesion, the only difference
* is we don't need to store previous row; just return the last row is enough,
* it's even easier than that question.
*
* However, since I didn't realize that my solution for Pascal's Triangle question
* already meets the requirment of O(k) extra space. I tried several other methods
* to calculate the kth row directly with the help of combination formula,
* but I was blocked by data type range overflow
*
* The lesson is always making sure the requirements of questions before coding anything
*/
public class Solution {
public ArrayList<Integer> getRow(int rowIndex) {
ArrayList<Integer> result = new ArrayList<Integer>();
if(rowIndex < 0)
return result;
//two ArrayList for current row and last row
ArrayList<Integer> lastRow = new ArrayList<Integer>();
ArrayList<Integer> currentRow = new ArrayList<Integer>();
ArrayList<Integer> temp = null;
//treat first line separately
lastRow.add(1);
if(rowIndex == 0)
return lastRow;
//init lastRow as second line
lastRow.add(1);
if(rowIndex == 1){
return lastRow;
}
//start from third line, lineNum is 0-based index
int lineNum = 2;
for(lineNum = 2;lineNum <= rowIndex;lineNum++){
//add the first '1' to a new row
currentRow.add(1);
//calculate the middle numbers by adding two numbers on its "shoulder"
//within every ArrayList, it's zero-based index
//last row has only lineNum-1 elements
for(int i = 0;i < lineNum-1;i++){
currentRow.add(lastRow.get(i) + lastRow.get(i+1));
}
//add the last '1' to this row
currentRow.add(1);
lastRow.clear();
//the current working row becomes last row, new current row should be empty
temp = lastRow;
lastRow = currentRow;
currentRow = temp;
}
return lastRow;
}
}
| mit |
soutarm/Discovr | Discovr.Agent/Properties/AssemblyInfo.cs | 1441 | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Resources;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Discovr.Agent")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Discovr.Agent")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("39df3157-f252-4733-9941-84c504a356ea")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
| mit |
XyLnEn/projetTest1 | Test_Integration_2/src/fr/nantes/cta/one/AirwayImpl.java | 651 | package fr.nantes.cta.one;
import fr.nantes.cta.Airway;
import fr.nantes.cta.VOR;
public class AirwayImpl implements Airway{
private VOR _depart, _arriver;
public AirwayImpl(VOR start, VOR stop){
_depart = start;
_arriver = stop;
}
public double getDistance() {
return _depart.distanceTo(_arriver);
}
public String GetVORDepart(){
return _depart.getName();
}
public String GetVORArrive(){
return _arriver.getName();
}
public VOR departure() {
// TODO Auto-generated method stub
return null;
}
public VOR arrival() {
// TODO Auto-generated method stub
return null;
}
}
| mit |
reidab/citizenry | db/migrate/20110326230725_convert_group_projects_to_has_to_many.rb | 304 | class ConvertGroupProjectsToHasToMany < ActiveRecord::Migration
def self.up
add_column :groups_projects, :id, :primary_key
rename_table :groups_projects, :group_projects
end
def self.down
rename_table :group_projects, :groups_projects
remove_column :groups_projects, :id
end
end
| mit |
IonicaBizau/arc-assembler | clients/ace-builds/src-noconflict/theme-vibrant_ink.js | 2506 | "use strict";
ace.define("ace/theme/vibrant_ink", ["require", "exports", "module", "ace/lib/dom"], function (require, exports, module) {
exports.isDark = true;
exports.cssClass = "ace-vibrant-ink";
exports.cssText = ".ace-vibrant-ink .ace_gutter {\
background: #1a1a1a;\
color: #BEBEBE\
}\
.ace-vibrant-ink .ace_print-margin {\
width: 1px;\
background: #1a1a1a\
}\
.ace-vibrant-ink {\
background-color: #0F0F0F;\
color: #FFFFFF\
}\
.ace-vibrant-ink .ace_cursor {\
color: #FFFFFF\
}\
.ace-vibrant-ink .ace_marker-layer .ace_selection {\
background: #6699CC\
}\
.ace-vibrant-ink.ace_multiselect .ace_selection.ace_start {\
box-shadow: 0 0 3px 0px #0F0F0F;\
border-radius: 2px\
}\
.ace-vibrant-ink .ace_marker-layer .ace_step {\
background: rgb(102, 82, 0)\
}\
.ace-vibrant-ink .ace_marker-layer .ace_bracket {\
margin: -1px 0 0 -1px;\
border: 1px solid #404040\
}\
.ace-vibrant-ink .ace_marker-layer .ace_active-line {\
background: #333333\
}\
.ace-vibrant-ink .ace_gutter-active-line {\
background-color: #333333\
}\
.ace-vibrant-ink .ace_marker-layer .ace_selected-word {\
border: 1px solid #6699CC\
}\
.ace-vibrant-ink .ace_invisible {\
color: #404040\
}\
.ace-vibrant-ink .ace_keyword,\
.ace-vibrant-ink .ace_meta {\
color: #FF6600\
}\
.ace-vibrant-ink .ace_constant,\
.ace-vibrant-ink .ace_constant.ace_character,\
.ace-vibrant-ink .ace_constant.ace_character.ace_escape,\
.ace-vibrant-ink .ace_constant.ace_other {\
color: #339999\
}\
.ace-vibrant-ink .ace_constant.ace_numeric {\
color: #99CC99\
}\
.ace-vibrant-ink .ace_invalid,\
.ace-vibrant-ink .ace_invalid.ace_deprecated {\
color: #CCFF33;\
background-color: #000000\
}\
.ace-vibrant-ink .ace_fold {\
background-color: #FFCC00;\
border-color: #FFFFFF\
}\
.ace-vibrant-ink .ace_entity.ace_name.ace_function,\
.ace-vibrant-ink .ace_support.ace_function,\
.ace-vibrant-ink .ace_variable {\
color: #FFCC00\
}\
.ace-vibrant-ink .ace_variable.ace_parameter {\
font-style: italic\
}\
.ace-vibrant-ink .ace_string {\
color: #66FF00\
}\
.ace-vibrant-ink .ace_string.ace_regexp {\
color: #44B4CC\
}\
.ace-vibrant-ink .ace_comment {\
color: #9933CC\
}\
.ace-vibrant-ink .ace_entity.ace_other.ace_attribute-name {\
font-style: italic;\
color: #99CC99\
}\
.ace-vibrant-ink .ace_indent-guide {\
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYNDTc/oPAALPAZ7hxlbYAAAAAElFTkSuQmCC) right repeat-y\
}";
var dom = require("../lib/dom");
dom.importCssString(exports.cssText, exports.cssClass);
}); | mit |
philgough/NIST-NetworkVis | parse_data/parse_data.py | 4205 | import os
import ujson as json
import re
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('folder')
args = parser.parse_args()
folder_path = args.folder
# check what files there are to parse
files = []
for file_name in sorted(os.listdir(folder_path)):
if file_name[0] == 'C':
l = len(file_name) - 18
n = ''
for i in range(l):
n = n+(file_name[1 + i])
# print n
files.append(n)
print files
# create a folder to put them in
if not os.path.exists('../'+folder_path):
os.makedirs('../'+folder_path+'/')
data = []
configurations = []
with open('../'+folder_path+'/averages.json', 'wb') as output_f:
print '*** writing averages.json ***'
averages = []
for i, f in enumerate(files):
# av_list = [{'x':0, 'c':0, 'u':0}]
av_list = [[[0],[0],[0]]]
# print len(av_list)
av_dict = {'x':0, 'c':0, 'u':0}
current_file = f
rows = []
config = []
index = 0
# read traffic data
with open(folder_path+'/C'+current_file+'Visualization.txt') as data_f:
print '*** reading data file ' + str(i) + ' of ' + str(len(files)) + ' ***'
# next(data_f)
for i, row in enumerate(data_f):
# print row
if i == 0:
config = row.strip()
else:
r = row.strip().split()
rows.append(r)
if i > 1:
if index < r[0]:
# print r[0]
av_list.append([[0],[0],[0]])
index = int(r[0])
if r[4] == 'X':
av_list[index][0][0] += 1
# print r[4]
elif r[4] == 'C':
av_list[index][1][0] += 1
# print r[4]
elif r[4] == 'U':
# print r[4]
# print av_list[index]
av_list[index][2][0] += 1
data.append(rows)
configurations.append(config)
averages.append(av_list)
output_f.write('{')
for i, f in enumerate(files):
# print len(averages[i])
print '** file: ' + str(f) + ' ***'
if i > 0:
output_f.write(",\n")
output_f.write('"' + f + '":\n\t[\n')
# for max number of timesteps
for j in range(1, 3002):
total = averages[i][j][0][0] + averages[i][j][1][0] + averages[i][j][2][0]
# print total
if total == 218:
if j > 1:
output_f.write(',\n')
output_f.write('\t\t{"X": ')
output_f.write(str(averages[i][j][0][0]))
output_f.write(', "C": ')
output_f.write(str(averages[i][j][1][0]))
output_f.write(', "U": ')
output_f.write(str(averages[i][j][2][0]))
output_f.write('}')
output_f.write('\n\t]')
output_f.write('\n}')
dataDict = {}
maxRates = []
config_split = config.strip().split()
config_l = len(config_split)
# print config_split
for i, f in enumerate(files):
print '** file:', str(f)
maxRate = re.sub('[^\d\.]', '',config_split[config_l-3])
increment = re.sub('[^\d\.]', '',config_split[config_l-1])
# print 'maxRate:', maxRate, 'increment:', increment
maxRates.append(maxRate)
injectionRate = []
for j in range(int(maxRate)/int(increment) + 1):
router = []
for k in range(1, 219): # since there are 218 routers
lineDict = {}
for l, item in enumerate(data[i][j*218 + k]):
lineDict[data[0][0][l]] = item
# print data[0][0][l], item
# injectionRate.append({data})
router.append(lineDict)
injectionRate.append(router)
dataDict[f] = injectionRate
# write data as JSON v3
with open('../'+folder_path+'/routerData.json', 'w') as output_f:
json.dump(dataDict, output_f)
with open('../'+folder_path+'/configurations.json', 'w') as output_f:
print '*** writing configurations.json ***'
output = {}
f_names = []
for i, f in enumerate(files):
f_names.append(f)
output['files'] = f_names
c_names = []
for i, c in enumerate(configurations):
c_names.append(c)
output['configurations'] = c_names
output['numFiles'] = str(len(files))
output['groupSize'] = [16, 32, 122, 8, 40]
max_r = []
for i, m in enumerate(maxRates):
max_r.append(str(m))
output['maxRates'] = max_r
output['groupStrings'] = ["B", "P", "A", "D", "F"]
output['groupFullStrings'] = ["Backbone Routers", "Pop Routers", "Normal Access Routers", "Directly Connected Routers", "Fast Access Routers"]
output['occupancyTitles'] = ["Cut off", "Congested", "Unoccupied"]
output['increment'] = str(increment)
json.dump(output, output_f)
print 'done'
| mit |
marvinmarnold/mart | lib/carts/reports.js | 2610 | Meteor.methods({
'mart/report/carts': function(startDate, endDate) {
check(startDate, Date)
check(endDate, Date)
if(!Mart.isAdmin()) {
throw new Meteor.Error('invalid-permission', 'you dont have permission to do that')
}
var collection = Mart.Carts.find({$and: [
{submittedAt: {$gt: startDate}},
{submittedAt: {$lt: endDate}},
]}, {fields: {
_id: 1,
storefrontId: 1,
merchantId: 1,
state: 1,
userId: 1,
storefrontNameAtCheckout: 1,
productNameAtCheckout: 1,
storefrontIdAtCheckout: 1,
addressAtCheckout: 1,
cityAtCheckout: 1,
stateAtCheckout: 1,
zipAtCheckout: 1,
contactFirstName: 1,
contactLastName: 1,
contactRentingOnBehalfBiz: 1,
contactCity: 1,
contactZIP: 1,
cardId: 1,
submittedAt: 1,
connectionFeeAtCheckout: 1,
merchantCutAtCheckout: 1,
serviceFeeAtCheckout: 1,
taxAtCheckout: 1,
totalAtCheckout: 1,
subtotalAtCheckout: 1,
preTaxTotalAtCheckout: 1,
netAtCheckout: 1,
depositAtCheckout: 1
}}).fetch();
var heading = true; // Optional, defaults to true
var delimiter = ";" // Optional, defaults to ",";
return exportcsv.exportToCSV(collection, heading, delimiter);
},
'mart/report/storefronts': function() {
if(!Mart.isAdmin()) {
throw new Meteor.Error('invalid-permission', 'you dont have permission to do that')
}
var collection = Mart.Storefronts.find({}, {fields: {
_id: 1,
userId: 1,
name: 1,
isPublished: 1,
isDeleted: 1,
address: 1,
city: 1,
state: 1,
zip: 1,
createdAt: 1,
updatedAt:1,
lowestPriceCents: 1,
lowestPriceUnit: 1
}}).fetch();
var heading = true; // Optional, defaults to true
var delimiter = ";" // Optional, defaults to ",";
return exportcsv.exportToCSV(collection, heading, delimiter);
},
'mart/report/products': function() {
if(!Mart.isAdmin()) {
throw new Meteor.Error('invalid-permission', 'you dont have permission to do that')
}
var collection = Mart.Products.find({}, {fields: {
_id: 1,
storefrontId: 1,
name: 1,
isPublished: 1,
isDeleted: 1,
createdAt: 1,
updatedAt: 1,
lowestPriceCents: 1,
lowestPriceUnit: 1,
occupancy: 1,
size: 1
}}).fetch();
var heading = true; // Optional, defaults to true
var delimiter = ";" // Optional, defaults to ",";
return exportcsv.exportToCSV(collection, heading, delimiter);
}
})
| mit |
KitKare/KitKare | KitKare.App/kitkare/app/src/main/java/kitkare/kitkare/app/activities/AboutUsActivity.java | 961 | package kitkare.kitkare.app.activities;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.Context;
import android.os.Bundle;
import android.app.Activity;
import kitkare.kitkare.R;
import kitkare.kitkare.app.activities.fragments.AboutUsFragment;
public class AboutUsActivity extends Activity {
private final Context context = this;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about_us);
if (savedInstanceState == null) {
this.getFragment(new AboutUsFragment());
}
}
private void getFragment(Fragment fragment){
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.setCustomAnimations(R.animator.fragment_slide_left, R.animator.fragment_slide_right);
ft.add(R.id.container, fragment).addToBackStack("tag").commit();
}
} | mit |
azadkuh/gason-- | tests/parser1/main.cpp | 7072 | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <stddef.h>
#include "gason.hpp"
///////////////////////////////////////////////////////////////////////////////
/* sample1.json is:
{
"array": [
1,
2,
3
],
"boolean": true,
"null": null,
"number": 123,
"object": {
"a": "b",
"c": "d",
"e": "f"
},
"string": "Hello World"
}
*/
///////////////////////////////////////////////////////////////////////////////
class JSonGason
{
gason::JsonAllocator iallocator;
public:
bool doTest_sample1() {
puts("\n /---- sample1.json ---\\");
FILE* fp = fopen("../sample-jsons/sample1.json", "r+t");
if ( fp == 0 ) {
puts("sample1.json not found!");
return false;
}
// hold json data through the test
char buffer[257] = {0};
fread(buffer, 256, 1, fp);
fclose(fp);
// parsing
gason::JsonValue root;
gason::JsonParseStatus status = gason::jsonParse(buffer, root, iallocator);
// buffer will be over-written by jsonParse
if ( status != gason::JSON_PARSE_OK ) {
fprintf(stdout, "parsing failed! %d", static_cast<int>(status));
return false;
}
// finding / reading values
bool ok = false;
if ( root.child("array").at(1).toInt(&ok) != 2 ) {
puts("reading array element failed!");
}
if ( !root("number").isNumber() ) {
puts("number is not a number!");
}
if ( strncmp(root("object")("c").toString(), "d", 1) != 0 ) {
puts("readinf object.c failed!");
}
printf("string is: %s\n", root("string").toString());
// iteration
gason::JsonIterator it = gason::begin( root.child("object") );
while ( it.isValid() ) {
printf("%s = %s\n", it->key, it->value.toString());
it++;
}
// invalid object / index
size_t index = 7;
gason::JsonValue item = root("array")[index];
if ( !item ) {
printf("array[%lu] does not exist.\n", index);
} else if ( !item.isNumber() ) {
printf("array[%lu] is not a number.\n", index);
} else {
printf("array[%lu] = %d\n", index, item.toInt());
}
return true;
}
bool doTest_fathers() {
puts("\n /---- fathers.json ---\\");
FILE* fp = fopen("../sample-jsons/fathers.json", "r+t");
if ( fp == 0 ) {
puts("fathers.json not found!");
return false;
}
// hold json data through the test
static const size_t KBufferLength = 128*1024;
char buffer[KBufferLength+1] = {0};
fread(buffer, KBufferLength, 1, fp);
fclose(fp);
// parsing
gason::JsonValue root;
gason::JsonParseStatus status = gason::jsonParse(buffer, root, iallocator);
// buffer will be over-written by jsonParse
if ( status != gason::JSON_PARSE_OK ) {
puts("parsing failed!");
return false;
}
size_t childrenStat[10] = {0};
gason::JsonIterator it = gason::begin(root("fathers"));
while ( it.isValid() ) {
gason::JsonValue father = it->value;
size_t childrenCount = 0;
for ( gason::JsonIterator chit = gason::begin(father("sons")); chit.isValid(); chit++ ) {
childrenCount++;
}
for ( gason::JsonIterator chit = gason::begin(father("daughters")); chit.isValid(); chit++ ) {
childrenCount++;
}
childrenStat[childrenCount] = childrenStat[childrenCount] + 1;
it++;
}
for ( size_t i = 0; i < 10; i++ ) {
printf("%02lu father(s) has/have %lu child/children.\n", childrenStat[i], i);
}
return true;
}
bool doTest_servlet() {
puts("\n /---- servlet.json ---\\");
FILE* fp = fopen("../sample-jsons/servlet.json", "r+t");
if ( fp == 0 ) {
puts("servlet.json not found!");
return false;
}
// hold json data through the test
static const size_t KBufferLength = 4*1024;
char buffer[KBufferLength+1] = {0};
fread(buffer, KBufferLength, 1, fp);
fclose(fp);
// parsing
gason::JsonValue root;
gason::JsonParseStatus status = gason::jsonParse(buffer, root, iallocator);
// buffer will be over-written by jsonParse
if ( status != gason::JSON_PARSE_OK ) {
puts("parsing failed!");
return false;
}
bool ok = false;
gason::JsonValue deepChild = root
.child("web-app")
.child ("servlet").at(0)
.child("init-param")
.child("maxUrlLength");
if ( deepChild && deepChild.isNumber() ) {
int maxUrlLength = deepChild.toInt(&ok);
if ( maxUrlLength != 500 ) {
printf("maxUrlLength = %d, should be 500!", maxUrlLength);
} else {
puts("maxUrlLength = 500");
}
} else {
puts("can not find maxUrlLength in the specified path!");
}
return true;
}
bool doTest_makefile() {
puts("\n /---- makefile.json ---\\");
FILE* fp = fopen("../sample-jsons/makefile.json", "r+t");
if ( fp == 0 ) {
puts("makefile.json not found!");
return false;
}
// hold json data through the test
static const size_t KBufferLength = 32*1024;
char buffer[KBufferLength+1] = {0};
fread(buffer, KBufferLength, 1, fp);
fclose(fp);
// parsing
gason::JsonValue root;
gason::JsonParseStatus status = gason::jsonParse(buffer, root, iallocator);
// buffer will be over-written by jsonParse
if ( status != gason::JSON_PARSE_OK ) {
puts("parsing failed!");
return false;
}
gason::JsonValue cmd = root("command");
gason::JsonValue mak = root("data");
printf("command is: %s\n",
(cmd.isString()) ? cmd.toString() : "!!! not found" );
printf("data is: %lu bytes.\n",
(mak.isString()) ? strlen(mak.toString()) : 0 );
return true;
}
};
///////////////////////////////////////////////////////////////////////////////
int main(int , char **)
{
JSonGason tester;
for ( size_t i = 0; i < 100; i++ ) {
printf("\n\n---------------------> test iteration %03lu\n", i+1);
tester.doTest_servlet();
tester.doTest_fathers();
tester.doTest_sample1();
tester.doTest_makefile();
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
| mit |
jostylr/literate-programming | tests/logs/lprc.js | 2125 | /*global module, require */
module.exports = function(Folder, args) {
Folder.requires.merge(Folder.plugins.snippets, {
jquery : '<script type="text/javascript"' +
'src="https://ajax.googleapis.com/ajax/libs/jquery/' +
'ARG0||1.9.0|/jquery.min.js"></script>',
geogebra: "http://geogebra.org",
mathjax : '<script type="text/x-mathjax-config">' +
'MathJax.Hub.Config({'+
'extensions: ["tex2jax.js"],'+
'jax: ["input/TeX", "output/HTML-CSS"],'+
'tex2jax: {'+
'inlineMath: [ [\'$\',\'$\'], ["\\(","\\)"] ],'+
' displayMath: [ [\'$$\',\'$$\'], ["\\[","\\]"] ],'+
' processEscapes: true'+
'},'+
'"HTML-CSS": { availableFonts: ["TeX"] }, '+
'TeX: {'+
'Macros: {'+
' R: "{\\mathbb{R}}",'+
' C: "{\\mathbb{C}}" }'+
'}'+
'}); '+
'</script><script type="text/javascript" ' +
'src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?' +
'config=TeX-AMS-MML_HTMLorMML"> </script> ',
bootswatch : '<link rel="stylesheet" href="http://bootswatch.com/' +
'ARG0||journal|/bootstrap.min.css">',
katex : '<link rel="stylesheet" ' +
'href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/' +
'0.6.0/katex.min.css">' +
'<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/' +
'0.6.0/katex.min.js"></script>'+
'<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/' +
'0.6.0/contrib/auto-render.min.js"></script>',
'katex-body' : '<script>renderMathInElement(document.body);</script>',
'katex-style': '<link rel="stylesheet" ' +
'href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/' +
'0.6.0/katex.min.css">'
});
var mdp = Folder.plugins.md;
// we replace def because we want to anchorify all.
mdp.old = mdp.def;
mdp.def = mdp.req(mdp.options).
use(require('markdown-it-anchor', {renderPermalink:true}));
};
| mit |
robertlemke/flow-development-collection | TYPO3.Flow/Classes/TYPO3/Flow/I18n/Exception.php | 591 | <?php
namespace TYPO3\Flow\I18n;
/* *
* This script belongs to the Flow framework. *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the MIT license. *
* */
/**
* A generic Locale exception
*
* @api
*/
class Exception extends \TYPO3\Flow\Exception
{
}
| mit |
chipjacks/runlab | config/env/production.js | 1943 | 'use strict';
module.exports = {
db: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || 'mongodb://' + (process.env.DB_1_PORT_27017_TCP_ADDR || 'localhost') + '/runlabs',
assets: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.min.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.min.css',
],
js: [
'public/lib/angular/angular.min.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/angular-ui-router/release/angular-ui-router.min.js',
'public/lib/angular-ui-utils/ui-utils.min.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.min.js'
]
},
css: 'public/dist/application.min.css',
js: 'public/dist/application.min.js'
},
facebook: {
clientID: process.env.FACEBOOK_ID || 'APP_ID',
clientSecret: process.env.FACEBOOK_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: process.env.TWITTER_KEY || 'CONSUMER_KEY',
clientSecret: process.env.TWITTER_SECRET || 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
google: {
clientID: process.env.GOOGLE_ID || 'APP_ID',
clientSecret: process.env.GOOGLE_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: process.env.LINKEDIN_ID || 'APP_ID',
clientSecret: process.env.LINKEDIN_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
},
github: {
clientID: process.env.GITHUB_ID || 'APP_ID',
clientSecret: process.env.GITHUB_SECRET || 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
mailer: {
from: process.env.MAILER_FROM || 'MAILER_FROM',
options: {
service: process.env.MAILER_SERVICE_PROVIDER || 'MAILER_SERVICE_PROVIDER',
auth: {
user: process.env.MAILER_EMAIL_ID || 'MAILER_EMAIL_ID',
pass: process.env.MAILER_PASSWORD || 'MAILER_PASSWORD'
}
}
}
}; | mit |
mafiya69/corefx | src/System.Reflection/ref/4.0/System.Reflection.Manual.cs | 6604 | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
// This is only needed for COMAwareEventInfo to inherit from EventInfo. Next version when
// Reflection is extensible then we should remove this InternalsVisibleTo.
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Runtime.InteropServices, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")]
// This is required so that AssemblyBuilder can derive from Assembly.
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reflection.Emit, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")]
// This is required so that DynamicMethod can derive from MethodInfo.
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Reflection.Emit.Lightweight, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")]
// This is required for ProjectN to extend reflection. Once we make extensibility via contracts work on desktop, this can be removed.
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("System.Private.Reflection.Extensibility, PublicKey=002400000480000094000000060200000024000052534131000400000100010007D1FA57C4AED9F0A32E84AA0FAEFD0DE9E8FD6AEC8F87FB03766C834C99921EB23BE79AD9D5DCC1DD9AD236132102900B723CF980957FC4E177108FC607774F29E8320E92EA05ECE4E821C0A5EFE8F1645C4C0C93C1AB99285D622CAA652C1DFAD63D745D6F2DE5F17E5EAF0FC4963D261C8A12436518206DC093344D5AD293")]
namespace System.Reflection
{
public partial class TypeInfo
{
// These members are promoted from Type.
public abstract System.Reflection.TypeAttributes Attributes { get; }
public abstract int GetArrayRank();
public abstract System.Type GetElementType();
public abstract Type[] GetGenericParameterConstraints();
public virtual bool IsSubclassOf(System.Type c) { return default(bool); }
public abstract Type[] GenericTypeArguments { get; }
public abstract Type GetGenericTypeDefinition();
public abstract Assembly Assembly { get; }
public abstract Type BaseType { get; }
public abstract bool ContainsGenericParameters { get; }
public abstract MethodBase DeclaringMethod { get; }
public abstract string FullName { get; }
public abstract GenericParameterAttributes GenericParameterAttributes { get; }
public abstract int GenericParameterPosition { get; }
public abstract Guid GUID { get; }
public bool HasElementType { get { return default(bool); } }
public bool IsAbstract { get { return default(bool); } }
public bool IsAnsiClass { get { return default(bool); } }
public bool IsArray { get { return default(bool); } }
public bool IsAutoClass { get { return default(bool); } }
public bool IsAutoLayout { get { return default(bool); } }
public bool IsByRef { get { return default(bool); } }
public bool IsClass { get { return default(bool); } }
public abstract bool IsEnum { get; }
public bool IsExplicitLayout { get { return default(bool); } }
public abstract bool IsGenericParameter { get; }
public abstract bool IsGenericType { get; }
public abstract bool IsGenericTypeDefinition { get; }
public bool IsImport { get { return default(bool); } }
public bool IsInterface { get { return default(bool); } }
public bool IsLayoutSequential { get { return default(bool); } }
public bool IsMarshalByRef { get { return default(bool); } }
public bool IsNested { get { return default(bool); } }
public bool IsNestedAssembly { get { return default(bool); } }
public bool IsNestedFamANDAssem { get { return default(bool); } }
public bool IsNestedFamily { get { return default(bool); } }
public bool IsNestedFamORAssem { get { return default(bool); } }
public bool IsNestedPrivate { get { return default(bool); } }
public bool IsNestedPublic { get { return default(bool); } }
public bool IsNotPublic { get { return default(bool); } }
public bool IsPointer { get { return default(bool); } }
public virtual bool IsPrimitive { get { return default(bool); } }
public bool IsPublic { get { return default(bool); } }
public bool IsSealed { get { return default(bool); } }
public bool IsVisible { get { return default(bool); } }
public abstract bool IsSerializable { get; }
public bool IsSpecialName { get { return default(bool); } }
public bool IsUnicodeClass { get { return default(bool); } }
public virtual bool IsValueType { get { return default(bool); } }
public abstract string Namespace { get; }
public abstract string AssemblyQualifiedName { get; }
public abstract Type MakeArrayType();
public abstract Type MakeArrayType(int rank);
public abstract Type MakeByRefType();
public abstract Type MakeGenericType(params System.Type[] typeArguments);
public abstract Type MakePointerType();
}
// These should be made public when reflection extensibility via contracts is supported on all platforms.
// In the meantime, these will be exposed via wrapper factory methods in System.Private.Reflection.Extensibility.
public partial struct CustomAttributeNamedArgument
{
internal CustomAttributeNamedArgument(Type attributeType, string memberName, bool isField, CustomAttributeTypedArgument typedValue) { }
}
public partial struct CustomAttributeTypedArgument
{
internal CustomAttributeTypedArgument(Type argumentType, object value) { }
}
}
| mit |
kpj/OsciPy | system.py | 3392 | """
Class which stores coupled collection of Kuramoto oscillators
"""
import numpy as np
import pandas as pd
from scipy.integrate import odeint
import seaborn as sns
import matplotlib.pylab as plt
class System(object):
"""
Represent system of oscillators
"""
def __init__(self, A, B, omega, OMEGA):
"""
Create a system of Kuramoto oscillators.
Arguments:
A
Interal coupling matrix of the system
B
Coupling of the external force to each oscillator
omega
Internal oscillator frequency
OMEGA
External driving force frequency
"""
self._A = A
self._B = B
self._OMEGA = OMEGA
self._omegas = omega * np.ones(A.shape[0])
@property
def A(self):
return self._A
@property
def B(self):
return self._B
@property
def OMEGA(self):
return self._OMEGA
@property
def omegas(self):
return self._omegas
@property
def Phi(self):
return lambda t: self.OMEGA * t
def _get_equation(self):
"""
Generate ODE system
"""
def func(theta, t=0):
ode = []
for i, omega in enumerate(self.omegas):
ode.append(
omega \
+ np.sum([self.A[i,j] * np.sin(theta[j] - theta[i])
for j in range(len(self.omegas))]) \
+ self.B[i] * np.sin(self.Phi(t) - theta[i])
)
return np.array(ode)
return func
def solve(self, dt, T, init=None):
"""
Solve system of ODEs.
Arguments:
dt
Step size of the simulation
T
Maximal time to run the simulation to
init
Initial condition of the system
"""
ts = np.arange(0, T, dt)
if init is None:
init = np.random.uniform(0, 2*np.pi, size=self.omegas.shape)
sol = odeint(self._get_equation(), init, ts).T
return sol, ts
@staticmethod
def plot_solution(driver_sol, sols, ts):
"""
Plot solution of oscillator system.
Arguments:
driver_sol
Solution of external driver
sols
List of system solutions
ts
List of time points of the simulation
"""
# confine to circular region
sols %= 2*np.pi
driver_sol %= 2*np.pi
# convert to DataFrame
df = pd.DataFrame.from_dict([
{
'theta': theta,
'time': ts[i],
'oscillator': osci+1,
'source': 'raw'
}
for osci, sol in enumerate(sols)
for i, theta in enumerate(sol)
])
df = df.append(pd.DataFrame.from_dict([
{
'theta': theta,
'time': ts[i],
'oscillator': 'driver',
'source': 'raw'
}
for i, theta in enumerate(driver_sol)
]))
# plot result
plt.figure()
sns.tsplot(
time='time', value='theta',
condition='oscillator', unit='source',
data=df)
plt.show()
| mit |
Jesus/dropbox_api_v2 | spec/endpoints/files/create_folder_batch_spec.rb | 1678 | describe DropboxApi::Client, "#create_folder_batch" do
before :each do
@client = DropboxApi::Client.new
end
it "returns the created folders synchronously", :cassette => "create_folder_batch/synchronous_result_success" do
result = @client.create_folder_batch ["/Create Batch", "/Create Batch 1"]
expect(result.first).to be_a(DropboxApi::Metadata::Folder)
expect(result.last).to be_a(DropboxApi::Metadata::Folder)
end
it "returns async_job_id when large entries are passed", :cassette => "create_folder_batch/large_entries" do
paths = []
100.times { |i| paths << "/Folder #{i}"}
async_result = @client.create_folder_batch(paths)
expect(async_result).to be_a(Hash)
expect(async_result).to have_key("async_job_id")
end
it "returns async_job_id when force_async is true", :cassette => "create_folder_batch/force_async_true" do
async_result = @client.create_folder_batch(["/Create Batch 2", "/Create Batch 3"], { :force_async => true })
expect(async_result).to be_a(Hash)
expect(async_result).to have_key("async_job_id")
end
it "when autorename is true, does not return error for repeated entries", :cassette => "create_folder_batch/autorename_true" do
result = @client.create_folder_batch(["/Create Batch 1", "/Create Batch 1"], { :autorename => true })
expect(result).not_to include(a_kind_of(DropboxApi::Errors::FolderConflictError))
end
it "raises error, when invalid option is passed", :cassette => "create_folder_batch/invalid_option" do
expect {
@client.create_folder_batch(["/Create Batch 4", "/Create Batch 5"], { :async => true })
}.to raise_error(ArgumentError)
end
end
| mit |
nilsschmidt1337/ldparteditor | src/org/nschmidt/ldparteditor/helper/ShellHelper.java | 2920 | /* MIT - License
Copyright (c) 2012 - this year, Nils Schmidt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
package org.nschmidt.ldparteditor.helper;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
/**
* A helper class for various shell actions (center on screen, ...)
*
* @author nils
*
*/
public enum ShellHelper {
INSTANCE;
/**
* Centers a shell on the primary screen
*
* @param sh
* The shell to center
*/
public static final void centerShellOnPrimaryScreen(final Shell sh) {
Monitor primary = Display.getCurrent().getPrimaryMonitor();
Rectangle bounds = primary.getBounds();
Rectangle rect = sh.getBounds();
int x = bounds.x + (bounds.width - rect.width) / 2;
int y = bounds.y + (bounds.height - rect.height) / 2;
sh.setLocation(x, y);
}
/**
* Calculates the absolute position from a Control on the Shell
* @param cmp the Control
* @return the absolute position of this Control on the Shell
*/
public static final Point absolutePositionOnShell(Control cmp) {
int absX = 0;
int absY = 0;
while (!(cmp instanceof Shell)) {
if (cmp instanceof Control) {
Control con = cmp;
Point ownPos = con.getLocation();
cmp = con.getParent();
absX += ownPos.x;
absY += ownPos.y;
} else {
break;
}
}
if (cmp instanceof Shell sh) {
absX += sh.getLocation().x;
absY += sh.getLocation().y;
}
return new Point(absX, absY);
}
}
| mit |
Proxiweb/react-boilerplate | app/components/Toggle/index.js | 778 | /**
*
* LocaleToggle
*
*/
import React from 'react';
import PropTypes from 'prop-types';
// import { FormattedMessage } from 'react-intl';
import styles from './styles.css';
import ToggleOption from '../ToggleOption';
function Toggle(props) {
// eslint-disable-line react/prefer-stateless-function
let content = <option>--</option>;
// If we have items, render them
if (props.values) {
content = props.values.map(value =>
<ToggleOption key={value} value={value} message={props.messages[value]} />
);
}
return (
<select onChange={props.onToggle} className={styles.toggle}>
{content}
</select>
);
}
Toggle.propTypes = {
onToggle: PropTypes.func,
values: PropTypes.array,
messages: PropTypes.object,
};
export default Toggle;
| mit |
RostovTeam/hackaton | app/tests/DbTestCase.php | 700 | <?php
/**
* DbTestCase
* Makes a better standard class
*
* @author Polosin Maxim <[email protected]>
* @copyright Geoads, 2012
* @package Geoads
*/
class DbTestCase extends CDbTestCase {
public function truncateTable($tableName) {
$db = $this->getDbConnection();
$schema=$db->getSchema();
if(($table=$schema->getTable($tableName))!==null)
{
$db->createCommand('TRUNCATE '.$table->rawName)->execute();
$schema->resetSequence($table,1);
}
else
throw new CException("Table '$tableName' does not exist.");
}
}
| mit |
neilhanekom/digrest | modules/orders/tests/server/order.server.routes.tests.js | 6679 | 'use strict';
var should = require('should'),
request = require('supertest'),
path = require('path'),
mongoose = require('mongoose'),
User = mongoose.model('User'),
Order = mongoose.model('Order'),
express = require(path.resolve('./config/lib/express'));
/**
* Globals
*/
var app, agent, credentials, user, order;
/**
* Order routes tests
*/
describe('Order CRUD tests', function() {
before(function(done) {
// Get application
app = express.init(mongoose);
agent = request.agent(app);
done();
});
beforeEach(function(done) {
// Create user credentials
credentials = {
username: 'username',
password: 'password'
};
// Create a new user
user = new User({
firstName: 'Full',
lastName: 'Name',
displayName: 'Full Name',
email: '[email protected]',
username: credentials.username,
password: credentials.password,
provider: 'local'
});
// Save a user to the test db and create new Order
user.save(function() {
order = {
name: 'Order Name'
};
done();
});
});
it('should be able to save Order instance if logged in', function(done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function(signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
// Get the userId
var userId = user.id;
// Save a new Order
agent.post('/api/orders')
.send(order)
.expect(200)
.end(function(orderSaveErr, orderSaveRes) {
// Handle Order save error
if (orderSaveErr) done(orderSaveErr);
// Get a list of Orders
agent.get('/api/orders')
.end(function(ordersGetErr, ordersGetRes) {
// Handle Order save error
if (ordersGetErr) done(ordersGetErr);
// Get Orders list
var orders = ordersGetRes.body;
// Set assertions
(orders[0].user._id).should.equal(userId);
(orders[0].name).should.match('Order Name');
// Call the assertion callback
done();
});
});
});
});
it('should not be able to save Order instance if not logged in', function(done) {
agent.post('/api/orders')
.send(order)
.expect(403)
.end(function(orderSaveErr, orderSaveRes) {
// Call the assertion callback
done(orderSaveErr);
});
});
it('should not be able to save Order instance if no name is provided', function(done) {
// Invalidate name field
order.name = '';
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function(signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
// Get the userId
var userId = user.id;
// Save a new Order
agent.post('/api/orders')
.send(order)
.expect(400)
.end(function(orderSaveErr, orderSaveRes) {
// Set message assertion
(orderSaveRes.body.message).should.match('Please fill Order name');
// Handle Order save error
done(orderSaveErr);
});
});
});
it('should be able to update Order instance if signed in', function(done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function(signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
// Get the userId
var userId = user.id;
// Save a new Order
agent.post('/api/orders')
.send(order)
.expect(200)
.end(function(orderSaveErr, orderSaveRes) {
// Handle Order save error
if (orderSaveErr) done(orderSaveErr);
// Update Order name
order.name = 'WHY YOU GOTTA BE SO MEAN?';
// Update existing Order
agent.put('/api/orders/' + orderSaveRes.body._id)
.send(order)
.expect(200)
.end(function(orderUpdateErr, orderUpdateRes) {
// Handle Order update error
if (orderUpdateErr) done(orderUpdateErr);
// Set assertions
(orderUpdateRes.body._id).should.equal(orderSaveRes.body._id);
(orderUpdateRes.body.name).should.match('WHY YOU GOTTA BE SO MEAN?');
// Call the assertion callback
done();
});
});
});
});
it('should be able to get a list of Orders if not signed in', function(done) {
// Create new Order model instance
var orderObj = new Order(order);
// Save the Order
orderObj.save(function() {
// Request Orders
request(app).get('/api/orders')
.end(function(req, res) {
// Set assertion
res.body.should.be.an.Array.with.lengthOf(1);
// Call the assertion callback
done();
});
});
});
it('should be able to get a single Order if not signed in', function(done) {
// Create new Order model instance
var orderObj = new Order(order);
// Save the Order
orderObj.save(function() {
request(app).get('/api/orders/' + orderObj._id)
.end(function(req, res) {
// Set assertion
res.body.should.be.an.Object.with.property('name', order.name);
// Call the assertion callback
done();
});
});
});
it('should be able to delete Order instance if signed in', function(done) {
agent.post('/api/auth/signin')
.send(credentials)
.expect(200)
.end(function(signinErr, signinRes) {
// Handle signin error
if (signinErr) done(signinErr);
// Get the userId
var userId = user.id;
// Save a new Order
agent.post('/api/orders')
.send(order)
.expect(200)
.end(function(orderSaveErr, orderSaveRes) {
// Handle Order save error
if (orderSaveErr) done(orderSaveErr);
// Delete existing Order
agent.delete('/api/orders/' + orderSaveRes.body._id)
.send(order)
.expect(200)
.end(function(orderDeleteErr, orderDeleteRes) {
// Handle Order error error
if (orderDeleteErr) done(orderDeleteErr);
// Set assertions
(orderDeleteRes.body._id).should.equal(orderSaveRes.body._id);
// Call the assertion callback
done();
});
});
});
});
it('should not be able to delete Order instance if not signed in', function(done) {
// Set Order user
order.user = user;
// Create new Order model instance
var orderObj = new Order(order);
// Save the Order
orderObj.save(function() {
// Try deleting Order
request(app).delete('/api/orders/' + orderObj._id)
.expect(403)
.end(function(orderDeleteErr, orderDeleteRes) {
// Set message assertion
(orderDeleteRes.body.message).should.match('User is not authorized');
// Handle Order error error
done(orderDeleteErr);
});
});
});
afterEach(function(done) {
User.remove().exec(function(){
Order.remove().exec(function(){
done();
});
});
});
});
| mit |
wolfoux/soleil | src/soleil/SiteBundle/DependencyInjection/soleilSiteExtension.php | 879 | <?php
namespace soleil\SiteBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class soleilSiteExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
}
}
| mit |
phantom-root/fhq | www/api/events/get.php | 1352 | <?php
/*
* API_NAME: Get event
* API_DESCRIPTION: Method for get event info
* API_ACCESS: all
* API_INPUT: id - integer, id of event
*/
$curdir_events_get = dirname(__FILE__);
include_once ($curdir_events_get."/../api.lib/api.base.php");
include_once ($curdir_events_get."/../api.lib/api.security.php");
include_once ($curdir_events_get."/../api.lib/api.helpers.php");
include_once ($curdir_events_get."/../../config/config.php");
$response = APIHelpers::startpage($config);
$conn = APIHelpers::createConnection($config);
$params = array();
$where = array();
if (!APIHelpers::issetParam('id'))
APIHelpers::showerror(1220, 'not found parameter id');
$id = APIHelpers::getParam('id', 0);
if (!is_numeric($id))
APIHelpers::showerror(1221, 'incorrect id');
$conn = APIHelpers::createConnection($config);
try {
$stmt = $conn->prepare('SELECT * FROM public_events WHERE id = ?');
$stmt->execute(array(intval($id)));
if ($row = $stmt->fetch()) {
$response['result'] = 'ok';
$response['data']['id'] = $row['id'];
$response['data']['type'] = htmlspecialchars($row['type']);
$response['data']['message'] = htmlspecialchars($row['message']);
} else {
APIHelpers::showerror(1222, 'not found event with this id');
}
} catch(PDOException $e) {
APIHelpers::showerror(1223, $e->getMessage());
}
APIHelpers::endpage($response);
| mit |
kunalghosh/T-61.6050-Special-Course-in-Deep-Learning | exercises/utils/logistic_reg.py | 1644 | from __future__ import division
import theano
import theano.tensor as T
import numpy as np
# ------- DEBUG CODE --------
# def softmax(mat):
# exp_vals = np.exp(mat)
# sum_exp = np.sum(exp_vals,axis=1)
# return np.true_divide(exp_vals,sum_exp)
#
# def neq(a,b):
# return np.mean((a == b).astype(int))
#
# T = np
# T.nnet.softmax = softmax
# np.neq = neq
# ------- END DEBUG ---------
class LogisticRegression(object):
'''
Refactoring the methods used in ex2 into a class
'''
def __init__(self, inpt, n_in, n_out):
self.inpt = inpt
# print (n_in, n_out)
self.W = theano.shared(
value=np.zeros(
(n_in, n_out),
# (n_out, n_in),
dtype = theano.config.floatX
),
name = 'W',
borrow = True)
self.b = theano.shared(
value = np.zeros(
(n_out,),
# (n_in,),
dtype = theano.config.floatX
),
name = 'b',
borrow = True
)
self.p_y_given_x = self.__get_p_y_given_x()
self.y_pred = T.argmax(self.p_y_given_x, axis=1)
self.params = [self.W, self.b]
def negative_log_likelihood(self, y):
'''
Log likelihood cost
'''
return -T.mean(T.log(self.p_y_given_x)[T.arange(y.shape[0]),y])
def __get_p_y_given_x(self):
return T.nnet.softmax(T.dot(self.inpt,self.W)+self.b)
def get_error(self, y):
return T.mean(T.neq(self.y_pred,y))
| mit |
mass/git-friend | client/app.js | 2470 | angular.module('git-friend', [])
.controller('GitFriendController', function($scope, $http, $q) {
$scope.user = {};
$scope.friends = [];
$scope.isAuth = false;
$scope.remaining = null;
$http.get('/isAuth')
.success(function(data) {
$scope.isAuth = data.isAuth;
$scope.remaining = data.remaining;
})
.error(function() {
$scope.isAuth = false;
});
$scope.loadData = function(username) {
$scope.user = {};
$scope.friends = [];
$scope.error = null;
$http.get('/user/' + username)
.success(function(data) {
angular.extend($scope.user, data);
$scope.user.stars = [];
$scope.remaining = data.remaining;
})
.error(function(data) {
$scope.error = data.error;
});
$http.get('/stars/' + username)
.success(function(data) {
$scope.remaining = data.remaining;
$scope.user.stars = _.sortBy(data.stars, 'stargazers_count');
var starMap = _.indexBy($scope.user.stars, 'full_name');
var friends = [];
var repoQueries = [];
_.forEach(starMap, function(repo) {
if (repo.stargazers_count < 5000) {
repoQueries.push(
$http.get('/stargazers/' + repo.full_name)
.then(function(result) {
var starData = result.data;
$scope.remaining = starData.remaining;
starMap[repo.full_name].stargazers = starData.stargazers;
_.forEach(starData.stargazers, function(stargazer) {
if (!_.find(friends, {'login': stargazer.login})) {
friends.push({'login': stargazer.login, 'count': 1});
} else {
_.find(friends, {'login': stargazer.login}).count++;
}
});
}, function(result) {
$scope.error = result.data.error;
})
);
}
});
$q.all(repoQueries).then(function() {
_.remove(friends, function(friend) {
return friend.login === $scope.user.login;
});
$scope.friends = _.sortBy(friends, 'count').reverse().slice(0, 8);
})
})
.error(function(data) {
$scope.error = data.error;
});
}
});
| mit |
cedricziel/idea-php-typo3-plugin | typo3-cms/testData/com/cedricziel/idea/typo3/tca/codeInspection/v10/invalid_internal_type_v9.php | 735 | <?php
defined('TYPO3_MODE') or die();
define('TYPO3_branch', '9.5');
$ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xlf:';
return [
'ctrl' => [
],
'interface' => [
],
'columns' => [
'description' => [
'exclude' => true,
'label' => $ll . 'tx_news_domain_model_link.description',
'config' => [
'type' => 'group',
'internal_type' => <warning descr="Internal type 'file_reference' is deprecated, will be removed with v10.0">'file_reference'</warning>,
'rows' => 5,
'behaviour' => [
'allowLanguageSynchronization' => true,
],
]
],
]
];
| mit |
DavidTimms/texo | test/texo-bench.js | 2132 | var list = require("../texo.js");
function range (n) {
var numbers = [];
for (var i = 0; i < n; i++) {
numbers.push(i);
}
return numbers;
}
function consRange (n) {
var numbers = list();
for (var i = 0; i < n; i++) {
numbers = numbers.append(i);
}
return numbers;
}
function sumArray (items) {
var total = 0;
while (items.length > 0) {
total += items[0];
items = items.slice(1);
}
return total;
}
function sumArrayRA (items) {
var total = 0;
for (var i = 0; i < items.length; i++) {
total += items[i];
}
return total;
}
function sumReduce (items) {
return items.reduce(function (a, b) {return a + b});
}
function sumList (items) {
var total = 0;
while (items.count > 0) {
total += items(0);
items = items.slice(1);
}
return total;
}
function sumListRA (items) {
var total = 0;
for (var i = 0; i < items.count; i++) {
total += items(i);
}
return total;
}
function mapTest (items) {
return items
.map(function (x) {return x * 2})
.map(function (x) {return x / 3})
.map(function (x) {return x + 8})
.map(function (x) {return x - 9})[0];
}
function LazyMapTest (items) {
return items
.lazyMap(function (x) {return x * 2})
.lazyMap(function (x) {return x / 3})
.lazyMap(function (x) {return x + 8})
.lazyMap(function (x) {return x - 9})
.flatten()(0);
}
function time (name, func) {
var start = Date.now();
var result = func.apply(null, Array.prototype.slice.call(arguments, 2));
console.log(name + ": " + (Date.now() - start) + "ms", "result: " + result);
}
var testArray = range(1000000);
var testList = list.fromArray(testArray).append(8);
//// run once for JIT warmup
sumArrayRA(testArray);
sumReduce(testArray);
sumListRA(testList);
sumReduce(testList);
//time("JS Array", sumArray, testArray);
time("JS Array Random Access", sumArrayRA, testArray);
time("JS Array Reduce", sumReduce, testArray);
//time("Immutable List", sumList, testList);
time("Immutable List Random Access", sumListRA, testList);
time("Immutable List Reduce", sumReduce, testList);
time("JS Array Map", mapTest, testArray);
time("Immutable List Lazy Map", LazyMapTest, testList); | mit |
ahwizzang/bootstrap-select | dist/js/i18n/defaults-ua_UA.min.js | 615 | /*!
* Bootstrap-select v1.6.2 (http://silviomoreto.github.io/bootstrap-select/)
*
* Copyright 2013-2014 bootstrap-select
* Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE)
*/
!function(a){a.fn.selectpicker.defaults={noneSelectedText:"Нічого не вибрано",noneResultsText:"Збігів не знайдено",countSelectedText:"Вибрано {0} із {1}",maxOptionsText:["Досягнута межа ({n} {var} максимум)","Досягнута межа в групі ({n} {var} максимум)",["items","item"]],multipleSeparator:", "}}(jQuery);
| mit |
TeamSPoon/logicmoo_workspace | packs_web/swish/web/node_modules/bootstrap/js/src/popover.js | 4213 | /**
* --------------------------------------------------------------------------
* Bootstrap (v5.0.2): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
import { defineJQueryPlugin } from './util/index'
import SelectorEngine from './dom/selector-engine'
import Tooltip from './tooltip'
/**
* ------------------------------------------------------------------------
* Constants
* ------------------------------------------------------------------------
*/
const NAME = 'popover'
const DATA_KEY = 'bs.popover'
const EVENT_KEY = `.${DATA_KEY}`
const CLASS_PREFIX = 'bs-popover'
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
const Default = {
...Tooltip.Default,
placement: 'right',
offset: [0, 8],
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip">' +
'<div class="popover-arrow"></div>' +
'<h3 class="popover-header"></h3>' +
'<div class="popover-body"></div>' +
'</div>'
}
const DefaultType = {
...Tooltip.DefaultType,
content: '(string|element|function)'
}
const Event = {
HIDE: `hide${EVENT_KEY}`,
HIDDEN: `hidden${EVENT_KEY}`,
SHOW: `show${EVENT_KEY}`,
SHOWN: `shown${EVENT_KEY}`,
INSERTED: `inserted${EVENT_KEY}`,
CLICK: `click${EVENT_KEY}`,
FOCUSIN: `focusin${EVENT_KEY}`,
FOCUSOUT: `focusout${EVENT_KEY}`,
MOUSEENTER: `mouseenter${EVENT_KEY}`,
MOUSELEAVE: `mouseleave${EVENT_KEY}`
}
const CLASS_NAME_FADE = 'fade'
const CLASS_NAME_SHOW = 'show'
const SELECTOR_TITLE = '.popover-header'
const SELECTOR_CONTENT = '.popover-body'
/**
* ------------------------------------------------------------------------
* Class Definition
* ------------------------------------------------------------------------
*/
class Popover extends Tooltip {
// Getters
static get Default() {
return Default
}
static get NAME() {
return NAME
}
static get Event() {
return Event
}
static get DefaultType() {
return DefaultType
}
// Overrides
isWithContent() {
return this.getTitle() || this._getContent()
}
getTipElement() {
if (this.tip) {
return this.tip
}
this.tip = super.getTipElement()
if (!this.getTitle()) {
SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove()
}
if (!this._getContent()) {
SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove()
}
return this.tip
}
setContent() {
const tip = this.getTipElement()
// we use append for html objects to maintain js events
this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle())
let content = this._getContent()
if (typeof content === 'function') {
content = content.call(this._element)
}
this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content)
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
}
// Private
_addAttachmentClass(attachment) {
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
}
_getContent() {
return this._element.getAttribute('data-bs-content') || this._config.content
}
_cleanTipClass() {
const tip = this.getTipElement()
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
if (tabClass !== null && tabClass.length > 0) {
tabClass.map(token => token.trim())
.forEach(tClass => tip.classList.remove(tClass))
}
}
// Static
static jQueryInterface(config) {
return this.each(function () {
const data = Popover.getOrCreateInstance(this, config)
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
}
})
}
}
/**
* ------------------------------------------------------------------------
* jQuery
* ------------------------------------------------------------------------
* add .Popover to jQuery only if jQuery is present
*/
defineJQueryPlugin(Popover)
export default Popover
| mit |
loremipsumdolor/CastFast | src/com/mpatric/mp3agic/ID3v2CommentFrameData.java | 4304 | package com.mpatric.mp3agic;
import java.io.UnsupportedEncodingException;
public class ID3v2CommentFrameData extends AbstractID3v2FrameData {
private static final String DEFAULT_LANGUAGE = "eng";
private String language;
private EncodedText description;
private EncodedText comment;
public ID3v2CommentFrameData(boolean unsynchronisation) {
super(unsynchronisation);
}
public ID3v2CommentFrameData(boolean unsynchronisation, String language, EncodedText description, EncodedText comment) {
super(unsynchronisation);
this.language = language;
this.description = description;
this.comment = comment;
}
public ID3v2CommentFrameData(boolean unsynchronisation, byte[] bytes) throws InvalidDataException {
super(unsynchronisation);
synchroniseAndUnpackFrameData(bytes);
}
@Override
protected void unpackFrameData(byte[] bytes) throws InvalidDataException {
try {
language = BufferTools.byteBufferToString(bytes, 1, 3);
} catch (UnsupportedEncodingException e) {
language = "";
}
int marker = BufferTools.indexOfTerminatorForEncoding(bytes, 4, bytes[0]);
if (marker >= 4) {
description = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, 4, marker - 4));
marker += description.getTerminator().length;
} else {
description = new EncodedText(bytes[0], "");
marker = 4;
}
comment = new EncodedText(bytes[0], BufferTools.copyBuffer(bytes, marker, bytes.length - marker));
}
@Override
protected byte[] packFrameData() {
byte[] bytes = new byte[getLength()];
if (comment != null) bytes[0] = comment.getTextEncoding();
else bytes[0] = 0;
String langPadded;
if (language == null) {
langPadded = DEFAULT_LANGUAGE;
} else if (language.length() > 3) {
langPadded = language.substring(0, 3);
} else {
langPadded = BufferTools.padStringRight(language, 3, '\00');
}
try {
BufferTools.stringIntoByteBuffer(langPadded, 0, 3, bytes, 1);
} catch (UnsupportedEncodingException e) {
}
int marker = 4;
if (description != null) {
byte[] descriptionBytes = description.toBytes(true, true);
BufferTools.copyIntoByteBuffer(descriptionBytes, 0, descriptionBytes.length, bytes, marker);
marker += descriptionBytes.length;
} else {
bytes[marker++] = 0;
}
if (comment != null) {
byte[] commentBytes = comment.toBytes(true, false);
BufferTools.copyIntoByteBuffer(commentBytes, 0, commentBytes.length, bytes, marker);
}
return bytes;
}
@Override
protected int getLength() {
int length = 4;
if (description != null) length += description.toBytes(true, true).length;
else length++;
if (comment != null) length += comment.toBytes(true, false).length;
return length;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public EncodedText getComment() {
return comment;
}
public void setComment(EncodedText comment) {
this.comment = comment;
}
public EncodedText getDescription() {
return description;
}
public void setDescription(EncodedText description) {
this.description = description;
}
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + ((comment == null) ? 0 : comment.hashCode());
result = prime * result
+ ((description == null) ? 0 : description.hashCode());
result = prime * result
+ ((language == null) ? 0 : language.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
ID3v2CommentFrameData other = (ID3v2CommentFrameData) obj;
if (comment == null) {
if (other.comment != null)
return false;
} else if (!comment.equals(other.comment))
return false;
if (description == null) {
if (other.description != null)
return false;
} else if (!description.equals(other.description))
return false;
if (language == null) {
if (other.language != null)
return false;
} else if (!language.equals(other.language))
return false;
return true;
}
}
| mit |
getswagcoin/swagcoin | src/qt/optionsdialog.cpp | 9038 | #include "optionsdialog.h"
#include "ui_optionsdialog.h"
#include "bitcoinunits.h"
#include "monitoreddatamapper.h"
#include "netbase.h"
#include "optionsmodel.h"
#include <QDir>
#include <QIntValidator>
#include <QLocale>
#include <QMessageBox>
OptionsDialog::OptionsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::OptionsDialog),
model(0),
mapper(0),
fRestartWarningDisplayed_Proxy(false),
fRestartWarningDisplayed_Lang(false),
fProxyIpValid(true)
{
ui->setupUi(this);
/* Network elements init */
#ifndef USE_UPNP
ui->mapPortUpnp->setEnabled(false);
#endif
ui->proxyIp->setEnabled(false);
ui->proxyPort->setEnabled(false);
ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));
ui->socksVersion->setEnabled(false);
ui->socksVersion->addItem("5", 5);
ui->socksVersion->addItem("4", 4);
ui->socksVersion->setCurrentIndex(0);
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy()));
ui->proxyIp->installEventFilter(this);
/* Window elements init */
#ifdef Q_OS_MAC
/* remove Window tab on Mac */
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
#endif
/* Display elements init */
QDir translations(":translations");
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
foreach(const QString &langStr, translations.entryList())
{
QLocale locale(langStr);
/** check if the locale name consists of 2 parts (language_country) */
if(langStr.contains("_"))
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
else
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language (locale name)", e.g. "German (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
}
ui->unit->setModel(new BitcoinUnits(this));
/* Widget-to-option mapper */
mapper = new MonitoredDataMapper(this);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setOrientation(Qt::Vertical);
/* enable apply button when data modified */
connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton()));
/* disable apply button when new data loaded */
connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton()));
/* setup/change UI elements when proxy IP is invalid/valid */
connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool)));
}
OptionsDialog::~OptionsDialog()
{
delete ui;
}
void OptionsDialog::setModel(OptionsModel *model)
{
this->model = model;
if(model)
{
connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
mapper->setModel(model);
setMapper();
mapper->toFirst();
}
/* update the display unit, to not use the default ("BTC") */
updateDisplayUnit();
/* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang()));
/* disable apply button after settings are loaded as there is nothing to save */
disableApplyButton();
}
void OptionsDialog::setMapper()
{
/* Main */
mapper->addMapping(ui->transactionFee, OptionsModel::Fee);
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
/* Network */
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
/* Window */
#ifndef Q_OS_MAC
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
#endif
/* Display */
mapper->addMapping(ui->lang, OptionsModel::Language);
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
}
void OptionsDialog::enableApplyButton()
{
ui->applyButton->setEnabled(true);
}
void OptionsDialog::disableApplyButton()
{
ui->applyButton->setEnabled(false);
}
void OptionsDialog::enableSaveButtons()
{
/* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */
if(fProxyIpValid)
setSaveButtonState(true);
}
void OptionsDialog::disableSaveButtons()
{
setSaveButtonState(false);
}
void OptionsDialog::setSaveButtonState(bool fState)
{
ui->applyButton->setEnabled(fState);
ui->okButton->setEnabled(fState);
}
void OptionsDialog::on_resetButton_clicked()
{
if(model)
{
// confirmation dialog
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"),
tr("Some settings may require a client restart to take effect.") + "<br><br>" + tr("Do you want to proceed?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if(btnRetVal == QMessageBox::Cancel)
return;
disableApplyButton();
/* disable restart warning messages display */
fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = true;
/* reset all options and save the default values (QSettings) */
model->Reset();
mapper->toFirst();
mapper->submit();
/* re-enable restart warning messages display */
fRestartWarningDisplayed_Lang = fRestartWarningDisplayed_Proxy = false;
}
}
void OptionsDialog::on_okButton_clicked()
{
mapper->submit();
accept();
}
void OptionsDialog::on_cancelButton_clicked()
{
reject();
}
void OptionsDialog::on_applyButton_clicked()
{
mapper->submit();
disableApplyButton();
}
void OptionsDialog::showRestartWarning_Proxy()
{
if(!fRestartWarningDisplayed_Proxy)
{
QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting Swagcoin."), QMessageBox::Ok);
fRestartWarningDisplayed_Proxy = true;
}
}
void OptionsDialog::showRestartWarning_Lang()
{
if(!fRestartWarningDisplayed_Lang)
{
QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting Swagcoin."), QMessageBox::Ok);
fRestartWarningDisplayed_Lang = true;
}
}
void OptionsDialog::updateDisplayUnit()
{
if(model)
{
/* Update transactionFee with the current unit */
ui->transactionFee->setDisplayUnit(model->getDisplayUnit());
}
}
void OptionsDialog::handleProxyIpValid(QValidatedLineEdit *object, bool fState)
{
// this is used in a check before re-enabling the save buttons
fProxyIpValid = fState;
if(fProxyIpValid)
{
enableSaveButtons();
ui->statusLabel->clear();
}
else
{
disableSaveButtons();
object->setValid(fProxyIpValid);
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
}
}
bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
{
if(event->type() == QEvent::FocusOut)
{
if(object == ui->proxyIp)
{
CService addr;
/* Check proxyIp for a valid IPv4/IPv6 address and emit the proxyIpValid signal */
emit proxyIpValid(ui->proxyIp, LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr));
}
}
return QDialog::eventFilter(object, event);
}
| mit |
sauli6692/ibc-server | pmm/apps.py | 81 | from django.apps import AppConfig
class PmmConfig(AppConfig):
name = 'pmm'
| mit |
VVoev/Telerik-Academy | 15.Data-Structures-and-Algorithms/BIG FAT CHEAT SHEET/Cheatsheet/Cheatsheet/02.Deque/Program.cs | 3504 | using System;
using System.Collections;
using System.Collections.Generic;
namespace Deque
{
public class Deque<T> : IEnumerable<T>
{
private const int MIN_CAPACITY = 4;
private T[] buffer;
private int startIndex;
private int size;
private int endIndex;
public Deque()
{
buffer = null;
startIndex = 0;
size = 0;
endIndex = 0;
}
public int Size { get { return size; } }
public bool Empty { get { return size == 0; } }
public int Capacity { get{ return buffer.Length; } }
public T Front { get { return buffer[startIndex]; } }
public T Back {get { return buffer[PrevIndex(endIndex)]; } }
public void PushBack(T value)
{
MakeSpaceForOneMoreIfNeeded();
buffer[endIndex] = value;
endIndex = NextIndex(endIndex);
++size;
}
public void PushFront(T value)
{
MakeSpaceForOneMoreIfNeeded();
startIndex = PrevIndex(startIndex);
buffer[startIndex] = value;
++size;
}
public void PopBack()
{
endIndex = PrevIndex(endIndex);
buffer[endIndex] = default(T);
--size;
}
public void PopFront()
{
buffer[startIndex] = default(T);
startIndex = NextIndex(startIndex);
--size;
}
public void Reserve(int newSize)
{
if (newSize < size)
{
return;
}
var newBuffer = new T[newSize];
for (int i = 0, j = startIndex;
i < size;
++i, j = NextIndex(j))
{
newBuffer[i] = buffer[j];
}
startIndex = 0;
endIndex = size;
buffer = newBuffer;
}
private int NextIndex(int index)
{
++index;
if (index == buffer.Length)
{
index = 0;
}
return index;
}
private int PrevIndex(int index)
{
if (index == 0)
{
index = buffer.Length;
}
--index;
return index;
}
private void MakeSpaceForOneMoreIfNeeded()
{
if (buffer == null)
{
buffer = new T[MIN_CAPACITY];
}
else if (size == buffer.Length)
{
Reserve(size * 2);
}
}
public T this[int index]
{
get
{
return buffer[AdaptIndex(index)];
}
set
{
buffer[AdaptIndex(index)] = value;
}
}
private int AdaptIndex(int index)
{
int realIndex = startIndex + index;
if (realIndex >= buffer.Length)
{
realIndex -= buffer.Length;
}
return realIndex;
}
public IEnumerator<T> GetEnumerator()
{
for (int i = startIndex, j = 0;
j < size;
i = NextIndex(i), ++j)
{
yield return buffer[i];
}
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
} | mit |
ldipotetjob/onlinetor | src/org/itadaki/bobbin/peer/protocol/PeerProtocolConstants.java | 5622 | /*
* Copyright (c) 2010 Matthew J. Francis and Contributors of the Bobbin Project
* This file is distributed under the MIT licence. See the LICENCE file for further information.
*/
package org.itadaki.bobbin.peer.protocol;
/**
* Constants used in the peer protocol
*/
public class PeerProtocolConstants {
/**
* The maximum length of a piece request - 128K
*/
public static final int MAXIMUM_PIECE_LENGTH = 131072;
/**
* The maximum length of a protocol message (after its length header)<br>
* Large enough for the largest possible "piece" message.
*/
public static final int MAXIMUM_MESSAGE_LENGTH = MAXIMUM_PIECE_LENGTH + 9;
/**
* The length used when requesting piece blocks
*/
public static final int BLOCK_LENGTH = 16384;
/**
* The maximum length allowed for requests from remote peers
*/
public static final int MAXIMUM_BLOCK_LENGTH = 32768;
/**
* The maximum number of pending requests to a single remote peer
*/
public static final int MAXIMUM_OUTBOUND_REQUESTS = 30;
/**
* The maximum number of pending requests a single remote peer may have before we start
* ignoring some
*/
public static final int MAXIMUM_INBOUND_REQUESTS = 250;
/**
* The number of seconds of outbound data inactivity after which a keepalive should be sent
*/
public static final int KEEPALIVE_INTERVAL = 120;
/**
* The number of seconds of inbound data inactivity after which the connection should be
* considered for termination
*/
public static final int IDLE_INTERVAL = 240;
/**
* The number of pieces a peer may report beneath which allowed fast pieces should be allocated
*/
public static final int ALLOWED_FAST_THRESHOLD = 10;
/**
* The maximum simultaneous number of remote piece suggestions, including through both Allowed
* Fast and Suggest Piece messages that are honoured before additional suggestions are dropped
*/
public static final int MAXIMUM_SUGGESTED_PIECES = 64;
/* Basic protocol messages */
/**
* A "choke" message
*/
public static final byte MESSAGE_TYPE_CHOKE = 0;
/**
* An "unchoke" message
*/
public static final byte MESSAGE_TYPE_UNCHOKE = 1;
/**
* An "interested" message
*/
public static final byte MESSAGE_TYPE_INTERESTED = 2;
/**
* A "not interested" message
*/
public static final byte MESSAGE_TYPE_NOT_INTERESTED = 3;
/**
* A "have" message
*/
public static final byte MESSAGE_TYPE_HAVE = 4;
/**
* A "bitfield" message
*/
public static final byte MESSAGE_TYPE_BITFIELD = 5;
/**
* A "request" message
*/
public static final byte MESSAGE_TYPE_REQUEST = 6;
/**
* A "piece" message
*/
public static final byte MESSAGE_TYPE_PIECE = 7;
/**
* A "cancel" message
*/
public static final byte MESSAGE_TYPE_CANCEL = 8;
/* DHT extension messages */
/**
* A "DHT port" message
*/
public static final byte MESSAGE_TYPE_DHT_PORT = 9;
/* Fast extension messages */
/**
* A "suggest piece" message
*/
public static final byte MESSAGE_TYPE_SUGGEST_PIECE = 13;
/**
* A "have all" message
*/
public static final byte MESSAGE_TYPE_HAVE_ALL = 14;
/**
* A "have none" message
*/
public static final byte MESSAGE_TYPE_HAVE_NONE = 15;
/**
* A "reject request" message
*/
public static final byte MESSAGE_TYPE_REJECT_REQUEST = 16;
/**
* An "allowed fast" message
*/
public static final byte MESSAGE_TYPE_ALLOWED_FAST = 17;
/* Extension protocol messages */
/**
* An "extended" message
*/
public static final byte MESSAGE_TYPE_EXTENDED = 20;
/* Extended messages. These are the identifiers we ask the remote peer to use */
/**
* BEP 0009 Extension for Peers to Send Metadata Files
*/
public static final byte EXTENDED_MESSAGE_TYPE_PEER_METADATA = 1;
/**
* BEP 0030 Merkle hash torrent extension
*/
public static final byte EXTENDED_MESSAGE_TYPE_MERKLE = 2;
/**
* Elastic extension
*/
public static final byte EXTENDED_MESSAGE_TYPE_ELASTIC = 3;
/**
* Resource extension
*/
public static final byte EXTENDED_MESSAGE_TYPE_RESOURCE = 4;
/**
* The first available custom extended message
*/
public static final byte EXTENDED_MESSAGE_TYPE_CUSTOM = 5;
/* Elastic extension message subtypes */
/**
* Elastic signature message
*/
public static final byte ELASTIC_MESSAGE_TYPE_SIGNATURE = 0;
/**
* Elastic piece message
*/
public static final byte ELASTIC_MESSAGE_TYPE_PIECE = 1;
/**
* Elastic bitfield message
*/
public static final byte ELASTIC_MESSAGE_TYPE_BITFIELD = 2;
/* Resource extension message subtypes */
/**
* Resource directory message
*/
public static final byte RESOURCE_MESSAGE_TYPE_DIRECTORY = 0;
/**
* Resource transfer message
*/
public static final byte RESOURCE_MESSAGE_TYPE_TRANSFER = 1;
/**
* Resource subscribe message
*/
public static final byte RESOURCE_MESSAGE_TYPE_SUBSCRIBE = 2;
/* Extension protocol identifiers */
/**
* Peer exchange extension
*/
public static final String EXTENSION_PEER_EXCHANGE = "ut_pex";
/**
* BEP 0009 metadata extension
*/
public static final String EXTENSION_PEER_METADATA = "ut_metadata";
/**
* BEP 0028 tracker exchange extension
*/
public static final String EXTENSION_TRACKER_EXCHANGE = "lt_tex";
/**
* BEP 0030 Merkle extension
*/
public static final String EXTENSION_MERKLE = "Tr_hashpiece";
/**
* Elastic extension
*/
public static final String EXTENSION_ELASTIC = "bo_elastic";
/**
* Resource extension
*/
public static final String EXTENSION_RESOURCE = "bo_resource";
/**
* Not instantiable
*/
private PeerProtocolConstants() { }
}
| mit |
wpscanteam/CMSScanner | spec/lib/finders/finder/fingerprinter_spec.rb | 1733 | # frozen_string_literal: true
describe CMSScanner::Finders::Finder::Fingerprinter do
# Dummy class to test the module
class DummyFingerprinterFinder < CMSScanner::Finders::Finder
include CMSScanner::Finders::Finder::Fingerprinter
end
subject(:finder) { DummyFingerprinterFinder.new(target) }
let(:target) { CMSScanner::Target.new('http://e.org/') }
describe '#fingerprint' do
let(:fingerprints) do
{
'f1.css' => {
finder.hexdigest('f1_body') => 'v1'
},
'f2.js' => {
finder.hexdigest('f2_body') => %w[v1 v2],
finder.hexdigest('f2_2_body') => %w[v3]
}
}
end
before { expect(target).to receive(:head_or_get_params).and_return(method: :head) }
context 'when no matches' do
before { stub_request(:head, /.*/).to_return(status: 404) }
it 'does not yield anything' do
expect { |b| finder.fingerprint(fingerprints, &b) }.not_to yield_control
end
end
context 'when matches' do
before do
# Used to simulate a custom 404 homepage with status 200
stub_request(:get, /.*/).to_return(body: '404 body')
stub_request(:head, target.url('f1.css'))
stub_request(:get, target.url('f1.css')).to_return(body: 'f1_body')
stub_request(:head, target.url('f2.js'))
stub_request(:get, target.url('f2.js')).to_return(body: 'f2_body')
end
it 'yields the expected arguments' do
expect { |b| finder.fingerprint(fingerprints, &b) }.to yield_successive_args(
['v1', target.url('f1.css'), finder.hexdigest('f1_body')],
[%w[v1 v2], target.url('f2.js'), finder.hexdigest('f2_body')]
)
end
end
end
end
| mit |
rmachielse/ember-data-paperclip | tests/dummy/app/routes/application.js | 153 | import Ember from 'ember';
const { Route } = Ember;
export default Route.extend({
model() {
return this.get('store').find('product', 1);
}
});
| mit |
serebro/assets-manager | src/Assets/UndefinedEnvException.php | 85 | <?php
namespace Serebro\Assets;
class UndefinedEnvException extends \Exception
{
} | mit |
MarcusTzaen/CNodeUwp | src/CNodeUwp.Models/Topic/Version1/TopicDetailRequest.cs | 693 | using Newtonsoft.Json;
namespace CNodeUwp.Models.Topic.Version1
{
public class TopicDetailRequest
{
public string TopicId { get; set; }
/// <summary>
/// 当为 false 时,不渲染。默认为 true,渲染出现的所有 markdown 格式文本。
/// </summary>
[JsonProperty("mdrender")]
public bool NeedRendered { get; set; } = false;
/// <summary>
/// 用户Token,当需要知道一个主题是否被特定用户收藏时,才需要带此参数。会影响返回值中的 is_collect 值。
/// </summary>
[JsonProperty("accesstoken")]
public string AccessToken { get; set; }
}
}
| mit |
vinhqdang/my_mooc | MOOC-work/coursera/FINISHED/Statistical Mechanics Algorithms and Computations/Week 2/HW2/event_disks_box.py | 2813 | import math, pylab
def wall_time(pos_a, vel_a, sigma):
if vel_a > 0.0:
del_t = (1.0 - sigma - pos_a) / vel_a
elif vel_a < 0.0:
del_t = (pos_a - sigma) / abs(vel_a)
else:
del_t = float('inf')
return del_t
def pair_time(pos_a, vel_a, pos_b, vel_b, sigma):
del_x = [pos_b[0] - pos_a[0], pos_b[1] - pos_a[1]]
del_x_sq = del_x[0] ** 2 + del_x[1] ** 2
del_v = [vel_b[0] - vel_a[0], vel_b[1] - vel_a[1]]
del_v_sq = del_v[0] ** 2 + del_v[1] ** 2
scal = del_v[0] * del_x[0] + del_v[1] * del_x[1]
Upsilon = scal ** 2 - del_v_sq * ( del_x_sq - 4.0 * sigma **2)
if Upsilon > 0.0 and scal < 0.0:
del_t = - (scal + math.sqrt(Upsilon)) / del_v_sq
else:
del_t = float('inf')
return del_t
pos = [[0.25, 0.25], [0.75, 0.25], [0.25, 0.75], [0.75, 0.75]]
vel = [[0.21, 0.12], [0.71, 0.18], [-0.23, -0.79], [0.78, 0.1177]]
singles = [(0, 0), (0, 1), (1, 0), (1, 1), (2, 0), (2, 1), (3, 0), (3, 1)]
pairs = [(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)]
sigma = 0.15
t = 0.0
n_events = 1000000
histo_data = []
for event in range(n_events):
wall_times = [wall_time(pos[k][l], vel[k][l], sigma) for k, l in singles]
pair_times = [pair_time(pos[k], vel[k], pos[l], vel[l], sigma) for k, l in pairs]
next_event = min(wall_times + pair_times)
t_previous = t
for inter_times in range(int(t + 1), int(t + next_event + 1)):
del_t = inter_times - t_previous
for k, l in singles: pos[k][l] += vel[k][l] * del_t
t_previous = inter_times
for k in range(4): histo_data.append(pos[k][0])
t += next_event
#for k, l in singles: pos[k][l] += vel[k][l] * next_event
for k, l in singles: pos[k][l] += vel[k][l] * (t - t_previous)
if min(wall_times) < min(pair_times):
collision_disk, direction = singles[wall_times.index(next_event)]
vel[collision_disk][direction] *= -1.0
else:
a, b = pairs[pair_times.index(next_event)]
del_x = [pos[b][0] - pos[a][0], pos[b][1] - pos[a][1]]
abs_x = math.sqrt(del_x[0] ** 2 + del_x[1] ** 2)
e_perp = [c / abs_x for c in del_x]
del_v = [vel[b][0] - vel[a][0], vel[b][1] - vel[a][1]]
scal = del_v[0] * e_perp[0] + del_v[1] * e_perp[1]
for k in range(2):
vel[a][k] += e_perp[k] * scal
vel[b][k] -= e_perp[k] * scal
for k in pos: histo_data.append(k[0])
#print 'event', event
#print 'time', t
#print 'pos', pos
#print 'vel', vel
#for k in pos: histo_data.append(k[0])
pylab.hist(histo_data, bins=100, normed=True)
pylab.xlabel('x')
pylab.ylabel('frequency')
pylab.title('Frequency of x for event driven Molecular dynamics system for every time unit')
pylab.grid()
pylab.savefig('A331.png')
pylab.show()
| mit |
creativcoder/AlgorithmicProblems | Python/pascal.py | 402 | import pprint
def gen_pascal(nrows):
# the base case
aggregator = [[0,1,0]]
for i in xrange(nrows):
idx = len(aggregator) - 1
aggregator.append(gen_row(aggregator[idx]))
return aggregator
def gen_row(lis):
new_vec = [0]
for i in xrange(1, len(lis)):
new_vec.append(lis[i] + lis[i-1])
new_vec.append(0)
return new_vec
pp = pprint.PrettyPrinter(indent=4)
print pp.pprint(gen_pascal(10))
| mit |
jiboncoco/webzuiplo | application/views/admin/footer.php | 8263 |
<div id="footer-wrapper">
<div id="footer">
<div id="footer-inner">
<div class="footer-top">
<div class="container">
<div class="row">
<div class="widget col-sm-8">
<h2>Disediakan Oleh ZUIPLO</h2>
<div class="row">
<div class="feature col-xs-12 col-sm-6">
<div class="feature-icon col-xs-2 col-sm-2">
<div class="feature-icon-inner">
<i class="fa fa-rocket"></i>
</div><!-- /.feature-icon-inner -->
</div><!-- /.feature-icon -->
<div class="feature-content col-xs-10 col-sm-10">
<h3 class="feature-title">Solusi Pengelolaan Efisien</h3>
<p class="feature-body">
Solusi Tepat untuk mengelola Rumah Kos / Kontrakan milik Anda.
</p>
</div><!-- /.feature-content -->
</div><!-- /.feature -->
<div class="feature col-xs-12 col-sm-6">
<div class="feature-icon col-xs-2 col-sm-2">
<div class="feature-icon-inner">
<i class="fa fa-search"></i>
</div><!-- /.feature-icon-inner -->
</div><!-- /.feature-icon -->
<div class="feature-content col-xs-10 col-sm-10">
<h3 class="feature-title">Solusi yang Tepat untuk Pencarian</h3>
<p class="feature-body">
Solusi Tepat untuk Pencarian Rumah Kontrakan / Kos sesuai keinginan Anda.
</p>
</div><!-- /.feature-content -->
</div><!-- /.feature -->
<div class="feature col-xs-12 col-sm-6">
<div class="feature-icon col-xs-2 col-sm-2">
<div class="feature-icon-inner">
<i class="fa fa-users"></i>
</div><!-- /.feature-icon-inner -->
</div><!-- /.feature-icon -->
<div class="feature-content col-xs-10 col-sm-10">
<h3 class="feature-title">Interaksi lewat Informasi yang Akurat</h3>
<p class="feature-body">
Berinteraksi langsung dengan calon Penyewa Rumah Kontrakan / Kos milik Anda.
</p>
</div><!-- /.feature-content -->
</div><!-- /.feature -->
<div class="feature col-xs-12 col-sm-6">
<div class="feature-icon col-xs-2 col-sm-2">
<div class="feature-icon-inner">
<i class="fa fa-home"></i>
</div><!-- /.feature-icon-inner -->
</div><!-- /.feature-icon -->
<div class="feature-content col-xs-10 col-sm-10">
<h3 class="feature-title">Informasi Rumah yang Akurat</h3>
<p class="feature-body">
Informasi Akurat yang ditampilkan, karena data diperoleh dari Pemilik Rumah langsung.
</p>
</div><!-- /.feature-content -->
</div><!-- /.feature -->
<div class="feature col-xs-12 col-sm-6">
<div class="feature-icon col-xs-2 col-sm-2">
<div class="feature-icon-inner">
<i class="fa fa-mobile"></i>
</div><!-- /.feature-icon-inner -->
</div><!-- /.feature-icon -->
<div class="feature-content col-xs-10 col-sm-10">
<h3 class="feature-title">Strategi Pemasaran</h3>
<p class="feature-body">
Strategi untuk memasarkan Rumah Kontrakan / Kos milik Anda.
</p>
</div><!-- /.feature-content -->
</div><!-- /.feature -->
<div class="feature col-xs-12 col-sm-6">
<div class="feature-icon col-xs-2 col-sm-2">
<div class="feature-icon-inner">
<i class="fa fa-map-marker"></i>
</div><!-- /.feature-icon-inner -->
</div><!-- /.feature-icon -->
<div class="feature-content col-xs-10 col-sm-10">
<h3 class="feature-title">Lokasi Rumah yang terintegrasi dengan Google Maps</h3>
<p class="feature-body">
Lokasi Rumah yang akurat, karena terintgrasi dengan Google Maps.
</p>
</div><!-- /.feature-content -->
</div><!-- /.feature -->
</div><!-- /.row -->
</div><!-- /.widget -->
<div class="widget col-sm-4">
<h2>Kenapa Pilih ZUIPLO?</h2>
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading active">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">
Efisiensi bagi Pencari Rumah Kontrakan/Kos
</a>
</h4>
</div><!-- /.panel-heading -->
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
Solusi Tepat untuk Pencarian Rumah Kontrakan / Kos sesuai keinginan Anda.
</div><!-- /.panel-body -->
</div><!-- /.panel-heading -->
</div><!-- /.panel -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
Menjadi Pemilik Kos/Kontrakan yang dikenal
</a>
</h4>
</div><!-- /.panel-heading -->
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
Anda akan menjadi Pemilik Kos / Kontrakan yang dikenal oleh calon Penyewa Rumah milik Anda.
</div><!-- /.panel-body -->
</div><!-- /.panel-collapse -->
</div><!-- /.panel -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseThree">
Pengelolaan Rumah Kontrakan/ Kos
</a>
</h4>
</div><!-- /.panel-heading -->
<div id="collapseThree" class="panel-collapse collapse">
<div class="panel-body">
Anda bisa mengelola Rumah Kontrakan milik Anda menjadi sangat efisien.
</div><!-- /.panel-body -->
</div><!-- /.panel-collapse -->
</div><!-- /.panel -->
</div><!-- /.panel-group -->
</div><!-- /.widget-->
</div><!-- /.row -->
<hr>
<div class="row">
<div class="col-sm-9">
</div>
<div class="col-sm-3">
<form method="post" action="http://preview.byaviators.com/template/realocation/?" class="form-horizontal form-search">
<div class="form-group has-feedback no-margin">
</div><!-- /.form-group -->
</form>
</div>
</div><!-- /.row -->
</div><!-- /.container -->
</div><!-- /.footer-top -->
<div class="footer-bottom">
<div class="container">
<p class="center no-margin">
© 2016 JICOS, All Right reserved
</p>
<div class="center">
<ul class="social">
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-instagram"></i></a></li>
<li><a href="#">JICOS</a></li>
</ul><!-- /.social -->
</div><!-- /.center -->
</div><!-- /.container -->
</div><!-- /.footer-bottom -->
</div><!-- /#footer-inner -->
</div><!-- /#footer -->
</div><!-- /#footer-wrapper -->
</div><!-- /#wrapper -->
</body>
</html>
| mit |
ChristianRiedl/RoonApi | RoonApiLib/RoonApiBrowse.cs | 6036 | using Newtonsoft.Json;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
/*
Browse Hierarchie
Library
Artists
artist1
Play Artist
Play Now
Start Radio
album1
Play Album
Play Now
Start Radio
Add Next
Add to Queue
track1
Play Now
Start Radio
Add Next
Add to Queue
track2
album2
artist2
Albums
album1
Play Album
Play Now
Start Radio
Add Next
Add to Queue
track1
Play Now
Start Radio
Add Next
Add to Queue
track2
album2
Tracks
Internet Radio
radio1
radio2
Genres
genre1
Play Genre
Play Now
Start Radio
Artists
artist1
Play Artist
Play Now
Start Radio
album1
Play Album
Play Now
Start Radio
Add Next
Add to Queue
track1
Play Now
Start Radio
Add Next
Add to Queue
track2
album2
artist2
Albums
album1
Play Album
Play Now
Start Radio
Add Next
Add to Queue
track1
Play Now
Start Radio
Add Next
Add to Queue
track2
album2
genre2
*/
namespace RoonApiLib
{
public class RoonApiBrowse
{
public const string BrowseLibrary = "Library";
public const string BrowseArtists = "Artists";
public const string BrowseAlbums = "Albums";
public const string BrowseTracks = "Tracks";
public const string BrowseInternetRadio = "Internet Radio";
public const string BrowseGenres = "Genres";
public const string BrowseTIDAL = "TIDAL";
public const string BrowseTIDALFavorites = "Your Favorites";
public const string ActionPlayArtist = "Play Artist";
public const string ActionPlayAlbum = "Play Album";
public const string ActionPlayGenre = "Play Genre";
public const string ActionPlayNow = "Play Now";
public const string ActionStartRadio = "Start Radio";
public const string ActionAddNext = "Add Next";
public const string ActionAddtoQueue = "Add to Queue";
public class BrowseOptions
{
[JsonProperty("hierarchy")]
public string Hierarchy { get; set; }
[JsonProperty("zone_or_output_id")]
public string ZoneOrOutputId { get; set; }
[JsonProperty("item_key")]
public string ItemKey { get; set; }
[JsonProperty("refresh_list")]
public bool RefreshList { get; set; }
[JsonProperty("pop_all")]
public bool PopAll { get; set; }
[JsonProperty("input")]
public string Input { get; set; }
}
public class BrowseList
{
[JsonProperty("level")]
public int Level { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("subtitle")]
public string SubTitle { get; set; }
[JsonProperty("image_key")]
public string ImageKey { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("display_offset")]
public int? DisplayOffset { get; set; }
}
public class BrowseResult
{
[JsonProperty("action")]
public string Action { get; set; }
[JsonProperty("list")]
public BrowseList List { get; set; }
}
public class LoadOptions
{
[JsonProperty("hierarchy")]
public string Hierarchy { get; set; }
[JsonProperty("offset")]
public int Offset { get; set; }
[JsonProperty("set_display_offset")]
public int SetDisplayOffset { get; set; }
}
public class LoadItem
{
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("subtitle")]
public string SubTitle { get; set; }
[JsonProperty("image_key")]
public string ImageKey { get; set; }
[JsonProperty("item_key")]
public string ItemKey { get; set; }
[JsonProperty("hint")]
public string Hint { get; set; }
}
public class LoadResult
{
[JsonProperty("items")]
public LoadItem[] Items { get; set; }
[JsonProperty("offset")]
public int Offset { get; set; }
[JsonProperty("list")]
public BrowseList List { get; set; }
public LoadItem FindItem (string title)
{
return Items.FirstOrDefault((item) => item.Title == title);
}
}
RoonApi _api;
public RoonApiBrowse(RoonApi api)
{
_api = api;
}
public async Task<BrowseResult> Browse(BrowseOptions options)
{
var result = await _api.SendReceive<BrowseResult, BrowseOptions>(RoonApi.ServiceBrowse + "/browse", options);
return result;
}
public async Task<LoadResult> Load(LoadOptions options)
{
var result = await _api.SendReceive<LoadResult, LoadOptions>(RoonApi.ServiceBrowse + "/load", options);
return result;
}
public async Task<LoadResult> BrowseAndLoad(BrowseOptions options)
{
LoadResult result = null;
var browseResult = await Browse(options);
List<LoadItem> items = new List<LoadItem>();
for (int i = 0; i < browseResult.List.Count; i += 100)
{
result = await Load(new LoadOptions { Hierarchy = options.Hierarchy, Offset = i, SetDisplayOffset = i });
items.AddRange(result.Items);
}
result.Items = items.ToArray();
return result;
}
}
}
| mit |
TEDxBucharest/Tedster | app/Http/Controllers/IndexController.php | 3713 | <?php
namespace App\Http\Controllers;
use Facebook\Facebook;
use Imagine\Gd\Imagine;
use Imagine\Image\ImageInterface;
use Imagine\Image\Point;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;
class IndexController extends Controller
{
protected $fb;
protected $storagePath;
protected $userId;
public function __construct()
{
$this->fb = new Facebook([
'app_id' => env('FACEBOOK_APP_ID'),
'app_secret' => env('FACEBOOK_APP_SECRET'),
'default_graph_version' => 'v2.5',
]);
$this->fb->setDefaultAccessToken($_SESSION['facebook_access_token']);
$this->storagePath = Storage::disk('local')->getDriver()->getAdapter()->getPathPrefix();
}
public function welcome()
{
$pictureUrl = $this->getProfilePicture();
$newPicture = $this->addOverlay($pictureUrl);
$options = [
'resolution-units' => ImageInterface::RESOLUTION_PIXELSPERINCH,
'resolution-x' => 72,
'resolution-y' => 72,
'jpeg_quality' => 100,
];
$newPicture->save($this->getPicturePath($this->getProfileId()), $options);
return view('welcome', ['userId' => $this->getProfileId()]);
}
public function upload(Request $request)
{
if (!file_exists($this->getPicturePath())) {
return;
}
$response = $this->uploadPicture($this->getPicturePath(), $request->get('description'));
$photoId = $response->getGraphNode()->getProperty('id');
return redirect(sprintf('https://www.facebook.com/photo.php?fbid=%s&makeprofile=1', $photoId));
}
protected function getProfilePicture()
{
try {
$response = $this->fb->get('/me/picture?type=large&redirect=false&width=400');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
return $response->getGraphObject()->getProperty('url');
}
protected function getProfileId()
{
if (empty($this->userId)) {
try {
$response = $this->fb->get('/me');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
echo 'Graph returned an error: ' . $e->getMessage();
exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
echo 'Facebook SDK returned an error: ' . $e->getMessage();
exit;
}
$this->userId = $response->getGraphObject()->getProperty('id');
}
return $this->userId;
}
protected function addOverlay($pictureUrl)
{
$imagine = new Imagine();
$picture = $imagine->open($pictureUrl);
$overlay = $imagine->open($this->storagePath . env('FACEBOOK_OVERLAY'));
$x = $picture->getSize()->getWidth() - $overlay->getSize()->getWidth();
$y = $picture->getSize()->getHeight() - $overlay->getSize()->getHeight();
$picture->paste($overlay, new Point($x, $y));
return $picture;
}
protected function uploadPicture($path, $message = '')
{
$data = [
'source' => $this->fb->fileToUpload($path),
'message' => $message,
];
return $this->fb->post('/me/photos', $data);
}
protected function getPicturePath()
{
return $this->storagePath . sprintf('profile_%s.jpg', $this->getProfileId());
}
}
| mit |
nourWag/piweb | app/cache/prod/appProdUrlGenerator.php | 64756 | <?php
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Exception\RouteNotFoundException;
use Psr\Log\LoggerInterface;
/**
* appProdUrlGenerator
*
* This class has been auto-generated
* by the Symfony Routing Component.
*/
class appProdUrlGenerator extends Symfony\Component\Routing\Generator\UrlGenerator
{
private static $declaredRoutes = array(
'myappvisiteur_homepage' => array ( 0 => array ( 0 => 'name', ), 1 => array ( '_controller' => 'Myapp\\visiteurBundle\\Controller\\DefaultController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'name', ), 1 => array ( 0 => 'text', 1 => '/hello', ), ), 4 => array ( ), 5 => array ( ),),
'visiter_mall' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\visiteurBundle\\Controller\\VisiteController::visiterAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/visite', ), ), 4 => array ( ), 5 => array ( ),),
'profile_user' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\AccueilController::affAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/', ), ), 4 => array ( ), 5 => array ( ),),
'catalogue' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\packetController::listAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/catalogue', ), ), 4 => array ( ), 5 => array ( ),),
'profile12' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\Profile2Controller::showAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/profile', ), ), 4 => array ( ), 5 => array ( ),),
'edit12' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\Profile2Controller::editAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/edit', ), ), 4 => array ( ), 5 => array ( ),),
'changePassword12' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\ChangePasswordController::changePasswordAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/changePassword', ), ), 4 => array ( ), 5 => array ( ),),
'ajouter_Au_panier' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\PanierController::ajouterAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/ajou', ), ), 4 => array ( ), 5 => array ( ),),
'tunisia_supprimer_du panier' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\PanierController::supprimerAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/supp', ), ), 4 => array ( ), 5 => array ( ),),
'afficher_panier' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\PanierController::affichageAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/panier', ), ), 4 => array ( ), 5 => array ( ),),
'afficher_facture' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\FactureController::ajouterAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/Facture', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_new' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\LiraisonfController::newAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/new', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_create' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\LiraisonfController::createAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/create', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_edit' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\LiraisonfController::editAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/edit', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/user', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_update' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\LiraisonfController::updateAction', ), 2 => array ( '_method' => 'post|put', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/update', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/user', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_recherche' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\LiraisonfController::rechercheAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/recherche', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_ajout' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\LiraisonfController::ajoutAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/user/ajout', ), ), 4 => array ( ), 5 => array ( ),),
'homme' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\userBundle\\Controller\\AccueilController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/a', ), ), 4 => array ( ), 5 => array ( ),),
'myapp_responsable_homepage' => array ( 0 => array ( 0 => 'name', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\DefaultController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'name', ), 1 => array ( 0 => 'text', 1 => '/hello', ), ), 4 => array ( ), 5 => array ( ),),
'respensablePages' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::productListAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/', ), ), 4 => array ( ), 5 => array ( ),),
'profile1' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Profile2Controller::showAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/profile', ), ), 4 => array ( ), 5 => array ( ),),
'changePassword1' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ChangePasswordController::changePasswordAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/changePassword', ), ), 4 => array ( ), 5 => array ( ),),
'respensablePagespack' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ImageController::uploadAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/aff', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_esprit_aff_article' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ImageController::afficheAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/pack', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_esprit_aff_article1' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ImageController::listAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/pack', ), ), 4 => array ( ), 5 => array ( ),),
'pi2tst_homepage2' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\AccueilController::BoutiqueAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/boutique', ), ), 4 => array ( ), 5 => array ( ),),
'path_ajout' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::ajout2Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/ajout', ), ), 4 => array ( ), 5 => array ( ),),
'path_list' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::listAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/listboutique', ), ), 4 => array ( ), 5 => array ( ),),
'path_list2' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::list2Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/comm', ), ), 4 => array ( ), 5 => array ( ),),
'path_recherche' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::rechercheAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/find', ), ), 4 => array ( ), 5 => array ( ),),
'path_delete' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::supprimerAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/del', ), ), 4 => array ( ), 5 => array ( ),),
'path_update' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::modifierAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/maj', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_mail_succ' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\MailController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/succ', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_mail_form' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\MailController::newAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/mail', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_mail_sendpage' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\MailController::sendMailAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/sendmail', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_esprit_' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ImgController::uploadAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/uploadd', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_e' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ImgController::listAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/list', ), ), 4 => array ( ), 5 => array ( ),),
'my_image_ro' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ImgController::photoAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/images', ), ), 4 => array ( ), 5 => array ( ),),
'afficherProduitResp' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherProduitRespAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/afficherProduitResp', ), ), 4 => array ( ), 5 => array ( ),),
'SupprimerProduitRes' => array ( 0 => array ( 0 => 'id', 1 => 'idb', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::SupprimerProduitResAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'idb', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/respensable/pages/SupprimerProduitRes', ), ), 4 => array ( ), 5 => array ( ),),
'modifierProduitRes' => array ( 0 => array ( 0 => 'id', 1 => 'idb', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::modifierProduitResAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'idb', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/respensable/pages/modifierProduitRes', ), ), 4 => array ( ), 5 => array ( ),),
'SupprimerImageProduitRes' => array ( 0 => array ( 0 => 'id', 1 => 'idp', 2 => 'idb', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::SupprimerImageProduitResAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'idb', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'idp', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 3 => array ( 0 => 'text', 1 => '/respensable/pages/SupprimerImageProduitRes', ), ), 4 => array ( ), 5 => array ( ),),
'ajouterProduitRes' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::ajouterProduitResAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/ajouterProduitRes', ), ), 4 => array ( ), 5 => array ( ),),
'testRes' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::testResAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/testRes/', ), ), 4 => array ( ), 5 => array ( ),),
'Chart' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\GrapheController::chartLineAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/Chart', ), ), 4 => array ( ), 5 => array ( ),),
'Ajouter_CarteFidelite' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\CarteFideliteController::AjouterCarteFideliteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/ajoutercarte', ), ), 4 => array ( ), 5 => array ( ),),
'Modifier_CarteFidelite' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\CarteFideliteController::ModifierCarteFideliteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/modifiercarte', ), ), 4 => array ( ), 5 => array ( ),),
'Supprimer_CarteFidelite' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\CarteFideliteController::SupprimerCarteFideliteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/supprimercarte', ), ), 4 => array ( ), 5 => array ( ),),
'Valider_CarteFidelite' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\CarteFideliteController::ValiderCarteFideliteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/validercarte', ), ), 4 => array ( ), 5 => array ( ),),
'Afficher_CarteFidelite' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\CarteFideliteController::AfficherCarteFideliteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/affichercarte', ), ), 4 => array ( ), 5 => array ( ),),
'Rechercher_CarteFidelite' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\CarteFideliteController::RechercherCarteFideliteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/recherchercarte', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\LiraisonfController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/liste', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_delete12' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\LiraisonfController::deleteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/delete1', ), ), 4 => array ( ), 5 => array ( ),),
'supprimerliv' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\LiraisonfController::supprimerAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/supprimerli', ), ), 4 => array ( ), 5 => array ( ),),
'liraisonf_showliv' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\LiraisonfController::showAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/show', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/respensable/pages', ), ), 4 => array ( ), 5 => array ( ),),
'graphe_homepageresp' => array ( 0 => array ( 0 => 'name', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\DefaultController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'name', ), 1 => array ( 0 => 'text', 1 => '/respensable/pages/hello', ), ), 4 => array ( ), 5 => array ( ),),
'_grapheChartLineresp' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\GrapheController::ChartLineAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/ChartLine', ), ), 4 => array ( ), 5 => array ( ),),
'_grapheHistogrammeresp' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\GrapheController::chartHistogrammeAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/histogramme', ), ), 4 => array ( ), 5 => array ( ),),
'_graphePieresp' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\GrapheController::PieAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/respensable/pages/pie', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_esprit_upload' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Image1Controller::uploadAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/upload', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_esprit_list' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Image1Controller::listAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/list', ), ), 4 => array ( ), 5 => array ( ),),
'my_app_esprit_aff_img' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Image1Controller::photo2Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/aff', ), ), 4 => array ( ), 5 => array ( ),),
'my_image_route' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Image1Controller::photoAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/images', ), ), 4 => array ( ), 5 => array ( ),),
'pi2tst_homepage1' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\AccueillController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/homme', ), ), 4 => array ( ), 5 => array ( ),),
'registerAccount' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\AccueillController::registerAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/register', ), ), 4 => array ( ), 5 => array ( ),),
'afficher_produits' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherPAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/afficherP', ), ), 4 => array ( ), 5 => array ( ),),
'paginationpa' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherP2Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/hello', ), ), 4 => array ( ), 5 => array ( ),),
'afficherdetailleProduitNe' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherPDetailleAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/produit', ), ), 4 => array ( ), 5 => array ( ),),
'my_image_route2' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Image1Controller::photo2Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/image', ), ), 4 => array ( ), 5 => array ( ),),
'modifierProduit' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::modifierProduitAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/modifierProduit', ), ), 4 => array ( ), 5 => array ( ),),
'uploadAjout' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Image1Controller::uploadAjoutAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/uploadAjout', ), ), 4 => array ( ), 5 => array ( ),),
'SupprimerProduit' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::SupprimerProduitAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/SupprimerProduit', ), ), 4 => array ( ), 5 => array ( ),),
'AjouterProduit' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::AjouterProduitAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/AjouterProduit', ), ), 4 => array ( ), 5 => array ( ),),
'uploadAjoutProduit' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\Image1Controller::uploadAjoutProduitAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/AjouterProduitImage', ), ), 4 => array ( ), 5 => array ( ),),
'order_produit_prix_achat' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::order_produitAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/order_produit', ), ), 4 => array ( ), 5 => array ( ),),
'order_produit_prixvendre' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::order_produit_prixvendreAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/order_produit_prixvendre', ), ), 4 => array ( ), 5 => array ( ),),
'fixer_nmb_produits' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::fixer_nmb_produitsAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/fixer_nmb_produits', ), ), 4 => array ( ), 5 => array ( ),),
'produit_rechercher' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::produit_rechercherAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/produit_rechercher', ), ), 4 => array ( ), 5 => array ( ),),
'afficherPClient' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherPClientAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/afficherPClient', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_new_threads' => array ( 0 => array ( 0 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::newThreadsAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/api/threads/new', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_edit_thread_commentable' => array ( 0 => array ( 0 => 'id', 1 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::editThreadCommentableAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/commentable/edit', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 3 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_new_thread_comments' => array ( 0 => array ( 0 => 'id', 1 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::newThreadCommentsAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/comments/new', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 3 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_remove_thread_comment' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::removeThreadCommentAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/remove', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'commentId', ), 3 => array ( 0 => 'text', 1 => '/comments', ), 4 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 5 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_edit_thread_comment' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::editThreadCommentAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/edit', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'commentId', ), 3 => array ( 0 => 'text', 1 => '/comments', ), 4 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 5 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_new_thread_comment_votes' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::newThreadCommentVotesAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/votes/new', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'commentId', ), 3 => array ( 0 => 'text', 1 => '/comments', ), 4 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 5 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_get_thread' => array ( 0 => array ( 0 => 'id', 1 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::getThreadAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/\\.]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_get_threads' => array ( 0 => array ( 0 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::getThreadsActions', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_post_threads' => array ( 0 => array ( 0 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::postThreadsAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'POST', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_patch_thread_commentable' => array ( 0 => array ( 0 => 'id', 1 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::patchThreadCommentableAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'PATCH', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/commentable', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 3 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_get_thread_comment' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::getThreadCommentAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/\\.]++', 3 => 'commentId', ), 2 => array ( 0 => 'text', 1 => '/comments', ), 3 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 4 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_patch_thread_comment_state' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::patchThreadCommentStateAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'PATCH', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/state', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'commentId', ), 3 => array ( 0 => 'text', 1 => '/comments', ), 4 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 5 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_put_thread_comments' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::putThreadCommentsAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'PUT', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/\\.]++', 3 => 'commentId', ), 2 => array ( 0 => 'text', 1 => '/comments', ), 3 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 4 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_get_thread_comments' => array ( 0 => array ( 0 => 'id', 1 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::getThreadCommentsAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/comments', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 3 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_post_thread_comments' => array ( 0 => array ( 0 => 'id', 1 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::postThreadCommentsAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'POST', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/comments', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 3 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_get_thread_comment_votes' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::getThreadCommentVotesAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/votes', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'commentId', ), 3 => array ( 0 => 'text', 1 => '/comments', ), 4 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 5 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'fos_comment_post_thread_comment_votes' => array ( 0 => array ( 0 => 'id', 1 => 'commentId', 2 => '_format', ), 1 => array ( '_controller' => 'FOS\\CommentBundle\\Controller\\ThreadController::postThreadCommentVotesAction', '_format' => 'html', ), 2 => array ( '_format' => 'json|xml|html', '_method' => 'POST', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '.', 2 => 'json|xml|html', 3 => '_format', ), 1 => array ( 0 => 'text', 1 => '/votes', ), 2 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'commentId', ), 3 => array ( 0 => 'text', 1 => '/comments', ), 4 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 5 => array ( 0 => 'text', 1 => '/api/threads', ), ), 4 => array ( ), 5 => array ( ),),
'path_categorie1' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::list_categorie1Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/cat', ), ), 4 => array ( ), 5 => array ( ),),
'path_categorie2' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::list_categorie2Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/cat2', ), ), 4 => array ( ), 5 => array ( ),),
'path_categorie4' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::list_categorie4Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/cat4', ), ), 4 => array ( ), 5 => array ( ),),
'path_categorie3' => array ( 0 => array ( 0 => 'nom', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::ListCategorie3Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'nom', ), 1 => array ( 0 => 'text', 1 => '/cat3', ), ), 4 => array ( ), 5 => array ( ),),
'path_promotion' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\boutiqueController::ListPromotionAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/promotion', ), ), 4 => array ( ), 5 => array ( ),),
'pi_homepage1' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\AccueillController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/', ), ), 4 => array ( ), 5 => array ( ),),
'ajouterImage' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::imageAjoutFAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/imageAjoutF', ), ), 4 => array ( ), 5 => array ( ),),
'afficherImage' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherImagePAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/afficherImage', ), ), 4 => array ( ), 5 => array ( ),),
'ajouterImageProduit' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::imageAjoutProduitFAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/imageAjoutFP', ), ), 4 => array ( ), 5 => array ( ),),
'afficherImageProduit' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherImageProduitAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/afGI', ), ), 4 => array ( ), 5 => array ( ),),
'afficherG' => array ( 0 => array ( 0 => 'id', 1 => 'catB', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::affichergAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'catB', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/afG', ), ), 4 => array ( ), 5 => array ( ),),
'afficherGC' => array ( 0 => array ( 0 => 'id', 1 => 'cat', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::affichergFAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'cat', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/afGF', ), ), 4 => array ( ), 5 => array ( ),),
'afficherdetailleProduit2' => array ( 0 => array ( 0 => 'id', 1 => 'bout', ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficherPDetailleAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'bout', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/produit', ), ), 4 => array ( ), 5 => array ( ),),
'afficher_produit_solde' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficher_produit_soldeAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/afficher_produit_solde', ), ), 4 => array ( ), 5 => array ( ),),
'afficher_produit_evenement' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficher_produit_evenementAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/afficher_produit_evenement', ), ), 4 => array ( ), 5 => array ( ),),
'afficher_produit_new' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\ResponsableBundle\\Controller\\ProduitController::afficher_produit_newAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/afficher_produit_new', ), ), 4 => array ( ), 5 => array ( ),),
'myappadmin_homepage' => array ( 0 => array ( 0 => 'name', ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\DefaultController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'name', ), 1 => array ( 0 => 'text', 1 => '/hello', ), ), 4 => array ( ), 5 => array ( ),),
'adminPages' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\PagesAdminController::index1Action', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/', ), ), 4 => array ( ), 5 => array ( ),),
'admin_users_lock_page' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\clientController::lockAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/admin/lock', ), ), 4 => array ( ), 5 => array ( ),),
'adminPages_show' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\PagesAdminController::showAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/show', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/admin', ), ), 4 => array ( ), 5 => array ( ),),
'adminPages_new' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\PagesAdminController::newAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/new', ), ), 4 => array ( ), 5 => array ( ),),
'adminPages_create' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\PagesAdminController::createAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/create', ), ), 4 => array ( ), 5 => array ( ),),
'adminPages_edit' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\PagesAdminController::editAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/edit', ), ), 4 => array ( ), 5 => array ( ),),
'adminPages_update' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\PagesAdminController::updateAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/update', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/admin', ), ), 4 => array ( ), 5 => array ( ),),
'adminPages_delete' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\PagesAdminController::deleteAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/1/delete', ), ), 4 => array ( ), 5 => array ( ),),
'affich' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\clientController::listAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/affichage', ), ), 4 => array ( ), 5 => array ( ),),
'aaa' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\clientController::supprimerAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/admin/supprimer', ), ), 4 => array ( ), 5 => array ( ),),
'rech' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\clientController::RechercheAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/rech', ), ), 4 => array ( ), 5 => array ( ),),
'profile' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\Profile2Controller::showAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/profile', ), ), 4 => array ( ), 5 => array ( ),),
'edit1' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\Profile2Controller::editAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/edit', ), ), 4 => array ( ), 5 => array ( ),),
'logout' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\SecurityController::logoutAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/logout', ), ), 4 => array ( ), 5 => array ( ),),
'upload_pack' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\ImageController::uploadAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/upload', ), ), 4 => array ( ), 5 => array ( ),),
'graphe_homepage' => array ( 0 => array ( 0 => 'name', ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\DefaultController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'name', ), 1 => array ( 0 => 'text', 1 => '/admin/hello', ), ), 4 => array ( ), 5 => array ( ),),
'_grapheChartLine' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\GrapheController::ChartLineAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/ChartLine', ), ), 4 => array ( ), 5 => array ( ),),
'_grapheHistogramme' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\GrapheController::chartHistogrammeAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/histogramme', ), ), 4 => array ( ), 5 => array ( ),),
'_graphePie' => array ( 0 => array ( ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\GrapheController::PieAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/pie', ), ), 4 => array ( ), 5 => array ( ),),
'insert_pack' => array ( 0 => array ( ), 1 => array ( '_controller' => 'MyappadminBundle:Img:upload', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/admin/insert', ), ), 4 => array ( ), 5 => array ( ),),
'image_edit' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'Myapp\\adminBundle\\Controller\\ImageController::editAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/editpa', ), 1 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 2 => array ( 0 => 'text', 1 => '/admin', ), ), 4 => array ( ), 5 => array ( ),),
'page' => array ( 0 => array ( 0 => 'id', ), 1 => array ( '_controller' => 'MyappadminBundle:Pages:page', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'id', ), 1 => array ( 0 => 'text', 1 => '/page', ), ), 4 => array ( ), 5 => array ( ),),
'piwebapp_homepage' => array ( 0 => array ( 0 => 'name', ), 1 => array ( '_controller' => 'piweb\\appBundle\\Controller\\DefaultController::indexAction', ), 2 => array ( ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'name', ), 1 => array ( 0 => 'text', 1 => '/hello', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_security_login' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\SecurityController::loginAction', ), 2 => array ( '_method' => 'GET|POST', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/login', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_security_check' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\SecurityController::checkAction', ), 2 => array ( '_method' => 'POST', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/login_check', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_security_logout' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\SecurityController::logoutAction', ), 2 => array ( '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/logout', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_profile_show' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\ProfileController::showAction', ), 2 => array ( '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/profile/', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_profile_edit' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\ProfileController::editAction', ), 2 => array ( '_method' => 'GET|POST', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/profile/edit', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_registration_register' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\RegistrationController::registerAction', ), 2 => array ( '_method' => 'GET|POST', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/register/', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_registration_check_email' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\RegistrationController::checkEmailAction', ), 2 => array ( '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/register/check-email', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_registration_confirm' => array ( 0 => array ( 0 => 'token', ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\RegistrationController::confirmAction', ), 2 => array ( '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'token', ), 1 => array ( 0 => 'text', 1 => '/register/confirm', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_registration_confirmed' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\RegistrationController::confirmedAction', ), 2 => array ( '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/register/confirmed', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_resetting_request' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\ResettingController::requestAction', ), 2 => array ( '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/resetting/request', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_resetting_send_email' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\ResettingController::sendEmailAction', ), 2 => array ( '_method' => 'POST', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/resetting/send-email', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_resetting_check_email' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\ResettingController::checkEmailAction', ), 2 => array ( '_method' => 'GET', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/resetting/check-email', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_resetting_reset' => array ( 0 => array ( 0 => 'token', ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\ResettingController::resetAction', ), 2 => array ( '_method' => 'GET|POST', ), 3 => array ( 0 => array ( 0 => 'variable', 1 => '/', 2 => '[^/]++', 3 => 'token', ), 1 => array ( 0 => 'text', 1 => '/resetting/reset', ), ), 4 => array ( ), 5 => array ( ),),
'fos_user_change_password' => array ( 0 => array ( ), 1 => array ( '_controller' => 'FOS\\UserBundle\\Controller\\ChangePasswordController::changePasswordAction', ), 2 => array ( '_method' => 'GET|POST', ), 3 => array ( 0 => array ( 0 => 'text', 1 => '/profile/change-password', ), ), 4 => array ( ), 5 => array ( ),),
);
/**
* Constructor.
*/
public function __construct(RequestContext $context, LoggerInterface $logger = null)
{
$this->context = $context;
$this->logger = $logger;
}
public function generate($name, $parameters = array(), $referenceType = self::ABSOLUTE_PATH)
{
if (!isset(self::$declaredRoutes[$name])) {
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
}
list($variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes) = self::$declaredRoutes[$name];
return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
}
}
| mit |
kutyel/my-anime | e2e/pages/ShareAnime.js | 442 | var ShareAnime = function() {
this.load = function() {
return browser.get("/#");
};
this.buttons = function() {
// @Todo - remove sleep() when https://github.com/angular/protractor/issues/2154
browser.sleep(500);
return element.all(by.css('[ng-click="cp.submitContact(item)"]'));
};
this.focusedButton = function() {
return browser.driver.switchTo().activeElement();
};
};
module.exports = ShareAnime;
| mit |
mchome/PixivDaily | pixivdaily/pixivdaily.py | 4640 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''pixiv-daily, the tool which helps you to download the illust from pixiv.
Usage:
pixiv-daily login <pixiv_id> <password>
pixiv-daily daily <date> [-o | --output <output_dir>]
pixiv-daily areadaily <areanum> [-o | --output <output_dir>]
pixiv-daily statedaily <statenum> [-o | --output <output_dir>]
pixiv-daily (-c | --config <config_file>)
pixiv-daily (-h | --help)
pixiv-daily (-v | --version)
Arguments:
<pixiv_id> Your pixiv username
<password> Your pixiv password
<date> Normal daily ranking date
<areanum> Area daily ranking areanumber
<statenum> State daily ranking statenumber
Options:
-o <output_dir> --output <output_dir> Set output folder. [default: CurrentDirectory]
-c <config_file> --config <config_file> Set config file.
-h --help Show this screen.
-v --version Show version.
'''
import os
import sys
import re
from docopt import docopt
from queue import Queue
import utils
import parsers
from downloader import Downloader
def get_valid_filename(s):
return re.sub(r'(?u)[^-\w.]', '', s)
def read_configfile(filepath):
pass
def check_login():
if not os.path.exists(os.path.join(CONFIG_DIR, 'token')):
print('Please login in first!')
return False, None
token = utils.load_data(os.path.join(CONFIG_DIR, 'token'))
vaild, session = utils.Login.check_token(token)
return vaild, session
def attempt_login(username, password):
get_token = utils.Login(username, password)
vaild, session = get_token.login()
if vaild:
utils.save_data(session.cookies, os.path.join(CONFIG_DIR, 'token'))
return vaild
def start(ranking_type, number, output_dir, session):
get_urls = parsers.UrlParser(session, number)
urls = get_urls.get_pages(ranking_type)
picparser = parsers.PicParser(output_dir, number)
dl_dir = picparser.make_dir(ranking_type)
illustids_path = os.path.join(output_dir, 'illustids_list')
illustids_list = set()
if os.path.exists(illustids_path):
illustids_list = utils.load_data(illustids_path)
queue = Queue()
for i in range(8):
worker = Downloader(queue)
worker.daemon = True
worker.start()
if urls:
for url, illust_type in urls.items():
illustid = re.search(r'id=(.*)', url).group(1)
if illustid in illustids_list:
print('This illust was downloaded.')
continue
htmltree = parsers.get_htmlsrc(url, session)
title = get_valid_filename(picparser.get_title(htmltree))
original_image_urls = picparser.get_original_pic(illust_type, htmltree, session)
for original_image_url in original_image_urls:
filebasename = os.path.basename(original_image_url)
if not illust_type == 'illust':
dldir = os.path.join(dl_dir, title)
os.makedirs(dldir, exist_ok=True)
save_path = os.path.join(dldir, title + '_' + filebasename)
else:
save_path = os.path.join(dl_dir, title + '_' + filebasename)
queue.put((original_image_url, save_path))
illustids_list.add(illustid)
utils.save_data(illustids_list, illustids_path)
queue.join()
print('Done')
def init():
global CONFIG_DIR
CONFIG_DIR = os.path.join(os.path.expanduser('~'), '.pixiv-daily')
if not os.path.exists(CONFIG_DIR):
os.makedirs(CONFIG_DIR)
def main():
init()
if arguments['--output'][0] == 'CurrentDirectory':
output_dir = os.path.join(os.getcwd(), 'pixiv_illust')
else:
output_dir = os.path.join(arguments['--output'][0], 'pixiv_illust')
# print(output_dir)
vaild, session = check_login()
if not vaild:
return
if arguments['login']:
attempt_login(arguments['<pixiv_id>'], arguments['<password>'])
elif arguments['daily']:
start('daily', arguments['<date>'], output_dir, session)
elif arguments['areadaily']:
start('areadaily', arguments['<areanum>'], output_dir, session)
elif arguments('statedaily'):
start('statedaily', arguments['<statenum>'], output_dir, session)
if __name__ == '__main__':
arguments = docopt(__doc__, version='PixivDaily 1.0.0')
main()
| mit |
stansL/SpringSecHibernateBackEndSecurityFinished | src/ke/co/greid/entities/Address.java | 3100 | package ke.co.greid.entities;
// Generated Apr 1, 2015 12:52:51 PM by Hibernate Tools 3.4.0.CR1
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* Address generated by hbm2java
*/
@Entity
@Table(name = "address", catalog = "hims")
public class Address implements java.io.Serializable {
private Integer addressId;
private Patient patient;
private String physicalResidence;
private String cellPhone;
private String homePhone;
private String emailAddress;
private String postBox;
private String zipCode;
private String city;
public Address() {
}
public Address(Patient patient) {
this.patient = patient;
}
public Address(Patient patient, String physicalResidence, String cellPhone,
String homePhone, String emailAddress, String postBox,
String zipCode, String city) {
this.patient = patient;
this.physicalResidence = physicalResidence;
this.cellPhone = cellPhone;
this.homePhone = homePhone;
this.emailAddress = emailAddress;
this.postBox = postBox;
this.zipCode = zipCode;
this.city = city;
}
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "address_id", unique = true, nullable = false)
public Integer getAddressId() {
return this.addressId;
}
public void setAddressId(Integer addressId) {
this.addressId = addressId;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "patient_id", nullable = false)
public Patient getPatient() {
return this.patient;
}
public void setPatient(Patient patient) {
this.patient = patient;
}
@Column(name = "physical_residence", length = 45)
public String getPhysicalResidence() {
return this.physicalResidence;
}
public void setPhysicalResidence(String physicalResidence) {
this.physicalResidence = physicalResidence;
}
@Column(name = "cell_phone", length = 45)
public String getCellPhone() {
return this.cellPhone;
}
public void setCellPhone(String cellPhone) {
this.cellPhone = cellPhone;
}
@Column(name = "home_phone", length = 45)
public String getHomePhone() {
return this.homePhone;
}
public void setHomePhone(String homePhone) {
this.homePhone = homePhone;
}
@Column(name = "email_address", length = 45)
public String getEmailAddress() {
return this.emailAddress;
}
public void setEmailAddress(String emailAddress) {
this.emailAddress = emailAddress;
}
@Column(name = "post_box", length = 45)
public String getPostBox() {
return this.postBox;
}
public void setPostBox(String postBox) {
this.postBox = postBox;
}
@Column(name = "zip_code", length = 45)
public String getZipCode() {
return this.zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
@Column(name = "city", length = 45)
public String getCity() {
return this.city;
}
public void setCity(String city) {
this.city = city;
}
}
| mit |
manishbisht/Competitive-Programming | Daily Coding Problem/00002/solution.py | 199 | l=list(map(int,input("Enter The Numbers").split()))
h=[]
for o in l:
s=1
for i in range(0,len(l)):
if o==l[i]:
continue
else:
s=s*l[i]
h.append(s)
| mit |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.