<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>write only characteristic?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7002/write-only-characteristic</link><description>Hi, how to create a write only characteristic? 
 I have tried:
ble_char_md.char_props.read = 0; 
 This does not work.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 May 2015 16:20:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7002/write-only-characteristic" /><item><title>RE: write only characteristic?</title><link>https://devzone.nordicsemi.com/thread/24682?ContentTypeID=1</link><pubDate>Tue, 12 May 2015 16:20:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:321dd52d-cdcc-493f-85ab-f5bc80e21d4e</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@victor: Next time, please edit your question to add more information instead of posting it as an answer :)&lt;/p&gt;
&lt;p&gt;There are 2 sets of a characteristic attribute: permissions and properties.
set char_props.read = 0  only set the property of the characteristic. You should also set the permission :
read_perm.lv and read_perm.sm to zero. Please have a look at the macro BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS() in ble_gap.h&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: write only characteristic?</title><link>https://devzone.nordicsemi.com/thread/24684?ContentTypeID=1</link><pubDate>Mon, 11 May 2015 13:55:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4424fb07-e4d5-488b-afe0-e0f84b46720d</guid><dc:creator>victor</dc:creator><description>&lt;p&gt;My complete code for creating the characteristic:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;	{
	/* ATT metadata */
	ble_gatts_attr_md_t ble_attr_md;

	memset(&amp;amp;ble_attr_md, 0, sizeof(ble_attr_md));

	/* No security is required whatsoever, needs to be changed when encryption
		        is added */
	ble_attr_md.read_perm.lv = 1;
	ble_attr_md.read_perm.sm = 1;
	ble_attr_md.write_perm.lv = 1;
	ble_attr_md.write_perm.sm = 1;

	ble_attr_md.vloc = BLE_GATTS_VLOC_STACK;
	ble_attr_md.rd_auth = 0;
	ble_attr_md.wr_auth = 0;
	ble_attr_md.vlen = 0;

	/* BLE GATT metadata */
	ble_gatts_char_md_t ble_char_md;

	memset(&amp;amp;ble_char_md, 0, sizeof(ble_char_md));

	ble_char_md.p_char_pf = NULL;
	ble_char_md.char_props.read = 0;
	ble_char_md.char_props.write = 1;
	ble_char_md.char_props.write_wo_resp = 1;
	ble_char_md.char_props.notify = 0;

	ble_char_md.p_cccd_md = NULL;
	ble_char_md.p_sccd_md = NULL;
	ble_char_md.p_char_user_desc = NULL;
	ble_char_md.p_user_desc_md = NULL;
	uint8_t name[]=&amp;quot;Crypto key&amp;quot;;
	ble_char_md.p_char_user_desc = name;
	ble_char_md.char_user_desc_size=strlen((const char*)name);
	ble_char_md.char_user_desc_max_size=strlen((const char*)name);

	/* ble characteristic UUID */
	ble_uuid_t ble_uuid;

	ble_uuid.type = mesh_base_uuid_type;
	ble_uuid.uuid = MESH_AES_KEY_UUID;

	/* ble attribute */
	ble_gatts_attr_t ble_attr;

	memset(&amp;amp;ble_attr, 0, sizeof(ble_attr));

	uint8_t key[16]={0};

	ble_attr.init_offs = 0;
	ble_attr.init_len = 16;
	ble_attr.max_len = 16;
	ble_attr.p_attr_md = &amp;amp;ble_attr_md;
	ble_attr.p_uuid = &amp;amp;ble_uuid;
	ble_attr.p_value = (uint8_t*)&amp;amp;key;

	/* add to service */
	ble_gatts_char_handles_t ble_value_char_handles;

	error_code = sd_ble_gatts_characteristic_add(
			g_mesh_service.service_handle,
			&amp;amp;ble_char_md,
			&amp;amp;ble_attr,
			&amp;amp;ble_value_char_handles);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;When connecting with master control I can write some data and then read the data. I do not want to be able to read the data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: write only characteristic?</title><link>https://devzone.nordicsemi.com/thread/24683?ContentTypeID=1</link><pubDate>Mon, 11 May 2015 13:35:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a93b0a86-9c2a-4302-bc26-41cffa324b63</guid><dc:creator>Alex</dc:creator><description>&lt;pre&gt;&lt;code&gt;typedef struct
{
  /* Standard properties */
  uint8_t broadcast       :1; /**&amp;lt; Broadcasting of the value permitted. */
  uint8_t read            :1; /**&amp;lt; Reading the value permitted. */
  uint8_t write_wo_resp   :1; /**&amp;lt; Writing the value with Write Command permitted. */
  uint8_t write           :1; /**&amp;lt; Writing the value with Write Request permitted. */
  uint8_t notify          :1; /**&amp;lt; Notications of the value permitted. */
  uint8_t indicate        :1; /**&amp;lt; Indications of the value permitted. */
  uint8_t auth_signed_wr  :1; /**&amp;lt; Writing the value with Signed Write Command permitted. */
} ble_gatt_char_props_t;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You need to add ble_char_md.char_props.write = 1;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>